From 7756bfda9396bd64f5757fca1c0442ae827659c9 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Wed, 22 Jan 2020 01:30:04 -0800 Subject: [PATCH 001/119] Add rough draft of hashlock contract --- src/test/contracts/hashlock.mligo | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/test/contracts/hashlock.mligo diff --git a/src/test/contracts/hashlock.mligo b/src/test/contracts/hashlock.mligo new file mode 100644 index 000000000..b30f2bc9b --- /dev/null +++ b/src/test/contracts/hashlock.mligo @@ -0,0 +1,16 @@ +type storage = { + hashed: bytes; + unused: bool; +} + +type parameter = { + hashable: bytes; + message: unit -> operation list; +} + +let main ((p,s): parameter * storage) : operation list * storage = + if ((Crypto.sha256 p.hashable) = s.hashed) && s.unused + then + let s: storage = {hashed = s.hashed; unused = false} in + ((p.message ()), s) + else (([]: operation list), s) From d8783874241a448cb4bc1ca21bdc57844ffeed18 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Wed, 22 Jan 2020 01:40:23 -0800 Subject: [PATCH 002/119] Add salt to hashlock contract --- src/test/contracts/hashlock.mligo | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/contracts/hashlock.mligo b/src/test/contracts/hashlock.mligo index b30f2bc9b..acd7fcf9b 100644 --- a/src/test/contracts/hashlock.mligo +++ b/src/test/contracts/hashlock.mligo @@ -9,6 +9,9 @@ type parameter = { } let main ((p,s): parameter * storage) : operation list * storage = + (* We have to use a hash salted with the solvers address, otherwise a baker + could steal *) + let salted: bytes = Bytes.concat p.hashable (Bytes.pack sender) in if ((Crypto.sha256 p.hashable) = s.hashed) && s.unused then let s: storage = {hashed = s.hashed; unused = false} in From af23dcaebb3d1e15e82a092a3b3bdfe40b7fe2de Mon Sep 17 00:00:00 2001 From: Francis Brunelle Date: Wed, 22 Jan 2020 10:16:08 -0500 Subject: [PATCH 003/119] add Telegram link --- .../docs/advanced/entrypoints-contracts.md | 2 +- gitlab-pages/docs/advanced/first-contract.md | 4 ++-- .../docs/advanced/timestamps-addresses.md | 2 +- .../docs/contributors/getting-started.md | 4 ++-- .../docs/contributors/ligo_test_guide.md | 2 +- gitlab-pages/docs/contributors/origin.md | 4 ++-- gitlab-pages/docs/contributors/philosophy.md | 4 ++-- gitlab-pages/docs/intro/installation.md | 2 +- gitlab-pages/docs/intro/what-and-why.md | 6 ++--- .../docs/language-basics/boolean-if-else.md | 6 ++--- .../docs/language-basics/functions.md | 4 ++-- .../docs/language-basics/tezos-specific.md | 2 +- .../tezos-taco-shop-smart-contract.md | 12 +++++----- .../blog/2019-06-13-public-launch-of-ligo.md | 4 ++-- .../website/blog/2019-07-11-ligo-update.md | 6 ++--- gitlab-pages/website/pages/en/contact.js | 4 ++-- gitlab-pages/website/pages/en/index.js | 2 +- gitlab-pages/website/pages/en/versions.js | 2 +- gitlab-pages/website/siteConfig.js | 18 +++++++++++---- gitlab-pages/website/static/img/telegram.svg | 18 +++++++++++++++ .../version-next/contributors/origin.md | 6 ++--- .../version-next/contributors/philosophy.md | 13 +++++------ .../version-next-sidebars.json | 22 ++++++++++++++----- scripts/distribution/generic/parameters.sh | 2 +- .../tezos-protocol-alpha/raw_context.ml | 2 +- 25 files changed, 96 insertions(+), 57 deletions(-) create mode 100644 gitlab-pages/website/static/img/telegram.svg diff --git a/gitlab-pages/docs/advanced/entrypoints-contracts.md b/gitlab-pages/docs/advanced/entrypoints-contracts.md index eeb4fc0ae..3b269d3d2 100644 --- a/gitlab-pages/docs/advanced/entrypoints-contracts.md +++ b/gitlab-pages/docs/advanced/entrypoints-contracts.md @@ -62,7 +62,7 @@ Each entrypoint function receives two arguments: - `parameter` - this is the parameter received in the invocation operation - `storage` - this is the current (real) on-chain storage value -Storage can only be modified by running the smart contract entrypoint, which is responsible for returning a list of operations, and a new storage at the end of it's execution. +Storage can only be modified by running the smart contract entrypoint, which is responsible for returning a list of operations, and a new storage at the end of its execution. ## Built-in contract variables diff --git a/gitlab-pages/docs/advanced/first-contract.md b/gitlab-pages/docs/advanced/first-contract.md index 19861291f..244cae5ab 100644 --- a/gitlab-pages/docs/advanced/first-contract.md +++ b/gitlab-pages/docs/advanced/first-contract.md @@ -33,7 +33,7 @@ Output of the `dry-run` is the return value of our entrypoint function, we can s ## Building a counter contract -Our counter contract will store a single `int` as it's storage, and will accept an `action` variant in order to re-route our single `main` entrypoint into two entrypoints for `addition` and `subtraction`. +Our counter contract will store a single `int` in its storage, and will accept an `action` variant in order to re-route our single `main` entrypoint into two entrypoints for `addition` and `subtraction`. @@ -167,7 +167,7 @@ ligo compile-storage src/counter.ligo main 5 -In our case the LIGO storage value maps 1:1 to it's Michelson representation, however this will not be the case once the parameter is of a more complex data type, like a record. +In our case the LIGO storage value maps 1:1 to its Michelson representation, however this will not be the case once the parameter is of a more complex data type, like a record. ## Invoking a LIGO contract diff --git a/gitlab-pages/docs/advanced/timestamps-addresses.md b/gitlab-pages/docs/advanced/timestamps-addresses.md index e77ba76ee..6538059d7 100644 --- a/gitlab-pages/docs/advanced/timestamps-addresses.md +++ b/gitlab-pages/docs/advanced/timestamps-addresses.md @@ -9,7 +9,7 @@ Timestamps in LIGO, or in Michelson in general are available in smart contracts, ### Current time -You can obtain the current time using the built-in syntax specific expression, please be aware that it's up to the baker to set the current timestamp value. +You can obtain the current time using the built-in syntax specific expression, please be aware that it is up to the baker to set the current timestamp value. diff --git a/gitlab-pages/docs/contributors/getting-started.md b/gitlab-pages/docs/contributors/getting-started.md index 7b186dfad..5a98402d3 100644 --- a/gitlab-pages/docs/contributors/getting-started.md +++ b/gitlab-pages/docs/contributors/getting-started.md @@ -23,9 +23,9 @@ The first issues will most likely be: >Tests are **really** important, we don’t have lots of them, and mostly regression ones. This can’t be stressed enough. Some features are missing not because we can’t add them, but because we don’t know as no tests tell us they are missing. ## How -Issues will be added to Gitlab tagged with `On-boarding and Front-End` / `Middle-End` / `Back-End` / `Everything`. +Issues will be added to GitLab tagged with `On-boarding and Front-End` / `Middle-End` / `Back-End` / `Everything`. -If you try to tackle an issue and you have **any** problem, please tell us by creating a new Gitlab issue, contacting us on Riot, on Discord, or even by mail! +If you try to tackle an issue and you have **any** problem, please tell us by creating a new GitLab issue, contacting us on Riot, on Discord, or even by mail! Problems might include: * Installing the repository or the tools needed to work on it diff --git a/gitlab-pages/docs/contributors/ligo_test_guide.md b/gitlab-pages/docs/contributors/ligo_test_guide.md index 4726c7fe3..eea05d77d 100644 --- a/gitlab-pages/docs/contributors/ligo_test_guide.md +++ b/gitlab-pages/docs/contributors/ligo_test_guide.md @@ -111,4 +111,4 @@ What if we want to write a test of our own? If the test is in the integration te 1. Write a test contract which uses the new syntax or feature in [src/test/contracts](https://gitlab.com/ligolang/ligo/tree/dev/src/test/contracts). 2. Write an integration test in [src/test/integration_tests.ml](https://gitlab.com/ligolang/ligo/blob/dev/src/test/integration_tests.ml) in the vein of existing tests, make sure you add it to the test runner that is currently located at the bottom of the file. 3. Write the feature, assuming it doesn't already exist. Build the resulting version of LIGO without errors. -4. Run the test suite, see if your test(s) pass. If they do, you're probably done. If not it's time to go debugging. +4. Run the test suite, see if your test(s) pass. If they do, you're probably done. If not, it's time to go debugging. diff --git a/gitlab-pages/docs/contributors/origin.md b/gitlab-pages/docs/contributors/origin.md index 9c8df5900..6b20863a3 100644 --- a/gitlab-pages/docs/contributors/origin.md +++ b/gitlab-pages/docs/contributors/origin.md @@ -3,8 +3,8 @@ id: origin title: Origin --- -LIGO is a programming language that aims to provide developers with an uncomplicated and safe way to implement smart-contracts. Since it is being implemented for the Tezos blockchain LIGO compiles to Michelson—the native smart-contract language of Tezos. +LIGO is a programming language that aims to provide developers with an uncomplicated and safe way to implement smart contracts. Since it is being implemented for the Tezos blockchain LIGO compiles to Michelson—the native smart contract language of Tezos. -> Smart-contracts are programs that run within a blockchain network. +> Smart contracts are programs that run within a blockchain network. LIGO was meant to be a language for developing Marigold on top of a hacky framework called Meta-Michelson. However, due to the attention received by the Tezos community, LIGO is now a standalone language being developed to support Tezos directly. \ No newline at end of file diff --git a/gitlab-pages/docs/contributors/philosophy.md b/gitlab-pages/docs/contributors/philosophy.md index 0af6e606b..351a470e2 100644 --- a/gitlab-pages/docs/contributors/philosophy.md +++ b/gitlab-pages/docs/contributors/philosophy.md @@ -6,7 +6,7 @@ title: Philosophy To understand LIGO’s design choices it’s important to understand its philosophy. We have two main concerns in mind while building LIGO. ## Safety -Once a smart-contract is deployed, it will likely be impossible to change it. You must get it right on the first try, and LIGO should help as much as possible. There are multiple ways to make LIGO a safer language for smart-contracts. +Once a smart contract is deployed, it will likely be impossible to change it. You must get it right on the first try, and LIGO should help as much as possible. There are multiple ways to make LIGO a safer language for smart contracts. ### Automated Testing Automated Testing is the process through which a program runs another program, and checks that this other program behaves correctly. @@ -18,7 +18,7 @@ Static analysis is the process of having a program analyze another one. For instance, type systems are a kind of static analysis through which it is possible to find lots of bugs. LIGO already has a simple type system, and we plan to make it much stronger. ### Conciseness -Writing less code gives you less room to introduce errors. That's why LIGO encourages writing lean rather than chunky smart-contracts. +Writing less code gives you less room to introduce errors. That's why LIGO encourages writing lean rather than chunky smart contracts. --- diff --git a/gitlab-pages/docs/intro/installation.md b/gitlab-pages/docs/intro/installation.md index cd45491ab..05c7f72ee 100644 --- a/gitlab-pages/docs/intro/installation.md +++ b/gitlab-pages/docs/intro/installation.md @@ -15,7 +15,7 @@ executable (see below). This manages the Docker bits for you. * Use the Docker image available at [Docker Hub](https://hub.docker.com/r/ligolang/ligo). This lets you run multiple versions and keep your installation(s) self contained, but requires more familiarity with Docker. -Sources for the image can be found on [Gitlab](https://gitlab.com/ligolang/ligo/blob/master/docker/Dockerfile). +Sources for the image can be found on [GitLab](https://gitlab.com/ligolang/ligo/blob/master/docker/Dockerfile). If this is your first time using Docker, you probably want to set up a global LIGO executable as shown below. ### Setting up a globally available `ligo` executable diff --git a/gitlab-pages/docs/intro/what-and-why.md b/gitlab-pages/docs/intro/what-and-why.md index 4cddae9a7..e1588392d 100644 --- a/gitlab-pages/docs/intro/what-and-why.md +++ b/gitlab-pages/docs/intro/what-and-why.md @@ -64,7 +64,7 @@ Unfortunately (???), we **can't run Javascript on the Tezos blockchain** at the ## C-like smart contracts instead of Michelson -Let's take a look at a similar LIGO program. Don't worry if it's a little confusing at first; we'll explain all the syntax in the upcoming sections of the documentation. +Let's take a look at a similar LIGO program. Don't worry if it is a little confusing at first; we'll explain all the syntax in the upcoming sections of the documentation. @@ -133,7 +133,7 @@ The LIGO contract behaves exactly* like the Michelson contract we've saw first, ## Runnable code snippets & exercises Some of the sections in this documentation will include runnable code snippets and exercises. Sources for those are available at -the [LIGO Gitlab repository](https://gitlab.com/ligolang/ligo). +the [LIGO GitLab repository](https://gitlab.com/ligolang/ligo). ### Snippets For example **code snippets** for the *Types* subsection of this doc, can be found here: @@ -142,7 +142,7 @@ For example **code snippets** for the *Types* subsection of this doc, can be fou ### Exercises Solutions to exercises can be found e.g. here: `gitlab-pages/docs/language-basics/exercises/types/**/solutions/**` -### Running snippets / excercise solutions +### Running snippets / exercise solutions In certain cases it makes sense to be able to run/evaluate the given snippet or a solution, usually there'll be an example command which you can use, such as: ```shell diff --git a/gitlab-pages/docs/language-basics/boolean-if-else.md b/gitlab-pages/docs/language-basics/boolean-if-else.md index d57e6fa99..4db3cf15e 100644 --- a/gitlab-pages/docs/language-basics/boolean-if-else.md +++ b/gitlab-pages/docs/language-basics/boolean-if-else.md @@ -141,7 +141,7 @@ const min_age: nat = 16n; (* This function is really obnoxious, but it showcases - how the if statement and it's syntax can be used. + how the if statement and its syntax can be used. Normally, you'd use `with (age > min_age)` instead. *) @@ -168,7 +168,7 @@ let min_age: nat = 16n (** This function is really obnoxious, but it showcases - how the if statement and it's syntax can be used. + how the if statement and its syntax can be used. Normally, you'd use `with (age > min_age)` instead. @@ -183,7 +183,7 @@ let min_age: nat = 16n; (** This function is really obnoxious, but it showcases - how the if statement and it's syntax can be used. + how the if statement and its syntax can be used. Normally, you'd use `with (age > min_age)` instead. diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index 6b5739205..c21fb2dfd 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -71,7 +71,7 @@ argument until every parameter is filled. This is useful because it means that CameLIGO can support [partial application](https://en.wikipedia.org/wiki/Partial_application). Currying is however *not* the preferred way to pass function arguments in CameLIGO. -While this approach is faithful to the original OCaml, it's costlier in Michelson +While this approach is faithful to the original OCaml, it is costlier in Michelson than naive function execution accepting multiple arguments. Instead for most functions with more than one parameter we should place the arguments in a [tuple](language-basics/sets-lists-touples.md) and pass the tuple in as a single @@ -111,7 +111,7 @@ value. Functions without a name, also known as anonymous functions are useful in cases when you want to pass the function as an argument or assign it to a key in a record/map. -Here's how to define an anonymous function assigned to a variable `increment`, with it's appropriate function type signature. +Here's how to define an anonymous function assigned to a variable `increment`, with its appropriate function type signature. ```pascaligo group=c diff --git a/gitlab-pages/docs/language-basics/tezos-specific.md b/gitlab-pages/docs/language-basics/tezos-specific.md index 2e40d786a..55b7be6af 100644 --- a/gitlab-pages/docs/language-basics/tezos-specific.md +++ b/gitlab-pages/docs/language-basics/tezos-specific.md @@ -42,7 +42,7 @@ let id_string = (p: string) : option(string) => { ## Hashing Keys -It's often desirable to hash a public key. In Michelson, certain data structures +It is often desirable to hash a public key. In Michelson, certain data structures such as maps will not allow the use of the `key` type. Even if this weren't the case hashes are much smaller than keys, and storage on blockchains comes at a cost premium. You can hash keys with the `key_hash` type and associated built in function. diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md index e67c79506..9d2bf5ab2 100644 --- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md +++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md @@ -1,13 +1,13 @@ --- id: tezos-taco-shop-smart-contract -title: Taco shop smart-contract +title: Taco shop smart contract ---
-Meet **Pedro**, our *artisan taco chef* who has decided to open a Taco shop on the Tezos blockchain, using a smart-contract. He sells two different kinds of tacos, the **el clásico** and the **especial del chef**. +Meet **Pedro**, our *artisan taco chef* who has decided to open a Taco shop on the Tezos blockchain, using a smart contract. He sells two different kinds of tacos, the **el clásico** and the **especial del chef**. -To help Pedro open his dream taco shop, we'll implement a smart-contract, that will manage supply, pricing & sales of his tacos to the consumers. +To help Pedro open his dream taco shop, we'll implement a smart contract, that will manage supply, pricing & sales of his tacos to the consumers.
@@ -68,7 +68,7 @@ The best way to install the dockerized LIGO is as a **global executable** throug > From now on we'll get a bit more technical. If you run into something we have not covered yet - please try checking out the [LIGO cheat sheet](api/cheat-sheet.md) for some extra tips & tricks. -To begin implementing our smart contract, we need an entry point. We'll call it `main` and it'll specify our contract's storage (`int`) and input parameter (`int`). Of course this is not the final storage/parameter of our contract, but it's something to get us started and test our LIGO installation as well. +To begin implementing our smart contract, we need an entry point. We'll call it `main` and it'll specify our contract's storage (`int`) and input parameter (`int`). Of course this is not the final storage/parameter of our contract, but it is something to get us started and test our LIGO installation as well. ### `taco-shop.ligo` ```pascaligo group=a @@ -138,7 +138,7 @@ end type taco_shop_storage is map(nat, taco_supply); ``` -Next step is to update the `main` entry point to include `taco_shop_storage` as its storage - while doing that let's set the `parameter` to `unit` as well to clear things up. +Next step is to update the `main` entry point to include `taco_shop_storage` in its storage - while doing that let's set the `parameter` to `unit` as well to clear things up. **`taco-shop.ligo`** ```pascaligo group=b+ @@ -154,7 +154,7 @@ function main (const parameter: unit ; const taco_shop_storage : taco_shop_stora ### Populating our storage in a dry-run -When dry-running a contract, it's crucial to provide a correct initial storage value - in our case the storage is type-checked as `taco_shop_storage`. Reflecting [Pedro's daily offer](tutorials/get-started/tezos-taco-shop-smart-contract.md#daily-offer), our storage's value will be defined as following: +When dry-running a contract, it is crucial to provide a correct initial storage value - in our case the storage is type-checked as `taco_shop_storage`. Reflecting [Pedro's daily offer](tutorials/get-started/tezos-taco-shop-smart-contract.md#daily-offer), our storage's value will be defined as following: **Storage value** ```zsh diff --git a/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md b/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md index fb6373d46..e86098de1 100644 --- a/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md +++ b/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md @@ -8,7 +8,7 @@ author: Gabriel Alfour --- ## A Refresher: What is LIGO? -LIGO is a statically typed high-level smart-contract language that compiles down to Michelson. It seeks to be easy to use, extensible and safe. +LIGO is a statically typed high-level smart contract language that compiles down to Michelson. It seeks to be easy to use, extensible and safe. The core language is being developed by The Marigold Project. George Dupéron and Christian Rinderknecht of Nomadic Labs help on the core language, and tooling for LIGO is being developed by Stove Labs (Granary, docs and infrastructure) and Brice Aldrich (syntax highlighting). @@ -95,7 +95,7 @@ We are looking to develop a Super Type System that has the following features: The current version explicitly excludes non-essential features which can produce unexpected explosions in gas costs. To alleviate this constraint, we plan to integrate gas benchmarks on all top-level declarations with some fuzzing. This will allow developers and users to estimate the cost of their contracts in real time. ## Getting Started and Contact -Come visit [our website](https://ligolang.org)! You can also join our [Discord](https://discord.gg/9rhYaEt), Riot (*#ligo-public:matrix.org*) or Telegram Chat (Ligo Public channel). +Come visit [our website](https://ligolang.org)! You can also join our [Discord](https://discord.gg/9rhYaEt), Riot (*#ligo-public:matrix.org*) or [Telegram Chat](https://t.me/LigoLang). diff --git a/gitlab-pages/website/blog/2019-07-11-ligo-update.md b/gitlab-pages/website/blog/2019-07-11-ligo-update.md index 1782b7731..0715c9ff1 100644 --- a/gitlab-pages/website/blog/2019-07-11-ligo-update.md +++ b/gitlab-pages/website/blog/2019-07-11-ligo-update.md @@ -7,7 +7,7 @@ author: Gabriel Alfour --- -It's been a few weeks since our last update. Since then, we've onboarded new collaborators to both LIGO and Marigold, rewritten much of the codebase, and we've begun some exciting new projects. Let's tell you all about it! +It has been a few weeks since our last update. Since then, we've onboarded new collaborators to both LIGO and Marigold, rewritten much of the codebase, and we've begun some exciting new projects. Let's tell you all about it! # LIGO @@ -41,7 +41,7 @@ The most brittle part of our code base is about to become its strongest part. We Concretely: - Running LIGO-in-Browser will become much easier. Instead of having to dry-run it remotely or to rewrite a Michelson interpreter, we'll be able to **directly interpret** the LIGO program. -- It will be possible to prove the properties of Smart-Contracts written in LIGO directly, instead of having to prove the Michelson they produce. +- It will be possible to prove the properties of smart contracts written in LIGO directly, instead of having to prove the Michelson they produce. - Fewer tests will ned to be written and testing will instead focus mostly on the developer-facing layers of the compiler (i.e. syntax, typing), rather than on the actual compiling part. # Marigold @@ -56,4 +56,4 @@ It is thus hard for newcomers (even CS researchers!) to dive into Plasma in a co # Contact -If you have any question, feel free to visit [our website](ligolang.org) and to contact us :) +If you have any question, feel free to visit [our website](https://ligolang.org) and to contact us :) diff --git a/gitlab-pages/website/pages/en/contact.js b/gitlab-pages/website/pages/en/contact.js index 3a41f6cd1..280552588 100644 --- a/gitlab-pages/website/pages/en/contact.js +++ b/gitlab-pages/website/pages/en/contact.js @@ -47,8 +47,8 @@ const TEAM = [ const COMMUNICATION_CHANNELS = [ { - link: 'https://discord.gg/9rhYaEt', - icon: 'img/discord.svg', + link: 'https://t.me/LigoLang', + icon: 'img/telegram.svg', description: "We're hear to help. Ask us anything" }, { diff --git a/gitlab-pages/website/pages/en/index.js b/gitlab-pages/website/pages/en/index.js index a9bc41277..62a8879d3 100644 --- a/gitlab-pages/website/pages/en/index.js +++ b/gitlab-pages/website/pages/en/index.js @@ -77,7 +77,7 @@ module.exports = props => {
-

A friendly smart-contract language for Tezos

+

A friendly smart contract language for Tezos

Michelson was never so easy

diff --git a/gitlab-pages/website/pages/en/versions.js b/gitlab-pages/website/pages/en/versions.js index 4ea4a4f4f..f82441699 100644 --- a/gitlab-pages/website/pages/en/versions.js +++ b/gitlab-pages/website/pages/en/versions.js @@ -102,7 +102,7 @@ function Versions(props) {

You can find past versions of this project on{' '} - Gitlab. + GitLab.

diff --git a/gitlab-pages/website/siteConfig.js b/gitlab-pages/website/siteConfig.js index c42f07a31..e7162d6af 100644 --- a/gitlab-pages/website/siteConfig.js +++ b/gitlab-pages/website/siteConfig.js @@ -4,7 +4,7 @@ let reasonHighlightJs = require('reason-highlightjs'); const siteConfig = { title: 'LIGO', // Title for your website. - tagline: 'LIGO is a friendly smart-contract language for Tezos', + tagline: 'LIGO is a friendly smart contract language for Tezos', taglineSub: 'Michelson was never so easy', url: 'https://ligolang.org', // Your website URL baseUrl: '/', // Base URL for your project */ @@ -29,7 +29,7 @@ const siteConfig = { label: 'Tutorials' }, { blog: true, label: 'Blog' }, - // TODO: { href: "/odoc", label: "Api" }, + // TODO: { href: "/odoc", label: "API" }, // { doc: 'contributors/origin', label: 'Contribute' }, { href: '/contact', label: 'Ask Questions' }, { search: true } @@ -40,14 +40,24 @@ const siteConfig = { { doc: 'intro/installation', label: 'Install' }, { doc: 'api/cli-commands', label: 'CLI Commands' }, { doc: 'contributors/origin', label: 'Contribute' }, - { href: '/odoc', label: 'Api Documentation' } + { href: '/odoc', label: 'API Documentation' } ], community: [ + { + href: 'https://forum.tezosagora.org/tag/ligo', + label: 'Tezos Agora Forum', + blankTarget: true + }, { href: 'https://tezos.stackexchange.com/questions/tagged/ligo', label: 'Tezos Stack Exchange', blankTarget: true }, + { + href: 'https://t.me/LigoLang', + label: 'Telegram', + blankTarget: true + }, { href: 'https://discord.gg/9rhYaEt', label: 'Discord', @@ -59,7 +69,7 @@ const siteConfig = { doc: 'tutorials/get-started/tezos-taco-shop-smart-contract', label: 'Tutorials' }, - { href: repoUrl, label: 'Gitlab' } + { href: repoUrl, label: 'GitLab' } ] }, diff --git a/gitlab-pages/website/static/img/telegram.svg b/gitlab-pages/website/static/img/telegram.svg new file mode 100644 index 000000000..cd4c3a0de --- /dev/null +++ b/gitlab-pages/website/static/img/telegram.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md b/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md index 3b3820ef0..72b6002ac 100644 --- a/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md +++ b/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md @@ -4,8 +4,8 @@ title: Origin original_id: origin --- -LIGO is a programming language that aims to provide developers with an uncomplicated and safer way to implement smart-contracts. LIGO is currently being implemented for the Tezos blockchain and as a result, it compiles down to Michelson - the native smart-contract language of Tezos. +LIGO is a programming language that aims to provide developers with an uncomplicated and safe way to implement smart contracts. Since it is being implemented for the Tezos blockchain LIGO compiles to Michelson—the native smart contract language of Tezos. -> Smart-contracts are programs that run within a blockchain network. +> Smart contracts are programs that run within a blockchain network. -LIGO was initially meant to be a language for developing Marigold, on top of a hacky framework called Meta-Michelson. However, due to the attention received by the Tezos community, a decision has been put into action to develop LIGO as a standalone language that will support Tezos directly as well. \ No newline at end of file +LIGO was meant to be a language for developing Marigold on top of a hacky framework called Meta-Michelson. However, due to the attention received by the Tezos community, LIGO is now a standalone language being developed to support Tezos directly. \ No newline at end of file diff --git a/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md b/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md index 349c6d131..99c4d7c00 100644 --- a/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md +++ b/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md @@ -4,23 +4,22 @@ title: Philosophy original_id: philosophy --- -To understand LIGO’s design choices, it’s important to get its philosophy. There are two main concerns that we have in mind when building LIGO. - - +To understand LIGO’s design choices it’s important to understand its philosophy. We have two main concerns in mind while building LIGO. ## Safety -Once a smart-contract is deployed, it will likely be impossible to change it. You must get it right on the first try, and LIGO should help as much as possible. There are multiple ways to make LIGO a safer language for smart-contracts. +Once a smart contract is deployed, it will likely be impossible to change it. You must get it right on the first try, and LIGO should help as much as possible. There are multiple ways to make LIGO a safer language for smart contracts. ### Automated Testing -Automated Testing is the process through which a program will run some other program, and check that this other program behaves correctly. +Automated Testing is the process through which a program runs another program, and checks that this other program behaves correctly. + There already is a testing library for LIGO programs written in OCaml that is used to test LIGO itself. Making it accessible to users will greatly improve safety. A way to do so would be to make it accessible from within LIGO. ### Static Analysis Static analysis is the process of having a program analyze another one. -For instance, type systems are a kind of static analysis through which it is possible to find lots of bugs. There is already a fairly simple type system in LIGO, and we plan to make it much stronger. +For instance, type systems are a kind of static analysis through which it is possible to find lots of bugs. LIGO already has a simple type system, and we plan to make it much stronger. ### Conciseness -Writing less code gives you less room to introduce errors and that's why LIGO encourages writing lean rather than chunky smart-contracts. +Writing less code gives you less room to introduce errors. That's why LIGO encourages writing lean rather than chunky smart contracts. --- diff --git a/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json b/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json index e74ff6d36..07fc287dd 100644 --- a/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json +++ b/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json @@ -6,15 +6,27 @@ "version-next-intro/editor-support" ], "Language Basics": [ - "version-next-language-basics/cheat-sheet", "version-next-language-basics/types", - "version-next-language-basics/variables", + "version-next-language-basics/constants-and-variables", + "version-next-language-basics/math-numbers-tez", + "version-next-language-basics/strings", "version-next-language-basics/functions", - "version-next-language-basics/entrypoints", - "version-next-language-basics/operators" + "version-next-language-basics/boolean-if-else", + "version-next-language-basics/loops", + "version-next-language-basics/unit-option-pattern-matching", + "version-next-language-basics/maps-records", + "version-next-language-basics/sets-lists-tuples", + "version-next-language-basics/tezos-specific" + ], + "Advanced": [ + "version-next-advanced/timestamps-addresses", + "version-next-advanced/entrypoints-contracts", + "version-next-advanced/include", + "version-next-advanced/first-contract" ], "API": [ - "version-next-api-cli-commands" + "version-next-api/cli-commands", + "version-next-api/cheat-sheet" ] }, "version-next-contributors-docs": { diff --git a/scripts/distribution/generic/parameters.sh b/scripts/distribution/generic/parameters.sh index 436b48bf0..3899711d8 100644 --- a/scripts/distribution/generic/parameters.sh +++ b/scripts/distribution/generic/parameters.sh @@ -1,4 +1,4 @@ -# This script accepts three arguments, os family, os and it's version, +# This script accepts three arguments, os family, os and its version, # which are subsequently used to fetch the respective docker # image from the ocaml/infrastructure project. # diff --git a/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml b/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml index c887e319b..87b3615d0 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml @@ -330,7 +330,7 @@ let storage_error err = fail (Storage_error err) (* Initialization *********************************************************) (* This key should always be populated for every version of the - protocol. It's absence meaning that the context is empty. *) + protocol. Its absence meaning that the context is empty. *) let version_key = ["version"] let version_value = "babylon_005" From 3a320c26c81a5f841050d245bad0c342a0e0d7f6 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 24 Jan 2020 03:29:00 -0800 Subject: [PATCH 004/119] Modify hashlock to use commit-reveal and add non-working commit test --- src/stages/ast_simplified/combinators.ml | 1 + src/stages/ast_simplified/combinators.mli | 1 + src/test/contracts/hashlock.mligo | 45 ++++++++++-- src/test/hash_lock_tests.ml | 89 +++++++++++++++++++++++ src/test/test.ml | 1 + 5 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 src/test/hash_lock_tests.ml diff --git a/src/stages/ast_simplified/combinators.ml b/src/stages/ast_simplified/combinators.ml index a082e2fa9..851d27d1f 100644 --- a/src/stages/ast_simplified/combinators.ml +++ b/src/stages/ast_simplified/combinators.ml @@ -33,6 +33,7 @@ let t_address : type_expression = make_t @@ T_constant (TC_address) let t_signature : type_expression = make_t @@ T_constant (TC_signature) let t_key : type_expression = make_t @@ T_constant (TC_key) let t_key_hash : type_expression = make_t @@ T_constant (TC_key_hash) +let t_timestamp : type_expression = make_t @@ T_constant (TC_timestamp) let t_option o : type_expression = make_t @@ T_operator (TC_option o) let t_list t : type_expression = make_t @@ T_operator (TC_list t) let t_variable n : type_expression = make_t @@ T_variable (Var.of_name n) diff --git a/src/stages/ast_simplified/combinators.mli b/src/stages/ast_simplified/combinators.mli index 2bc534748..b783e6c43 100644 --- a/src/stages/ast_simplified/combinators.mli +++ b/src/stages/ast_simplified/combinators.mli @@ -21,6 +21,7 @@ val t_unit : type_expression val t_address : type_expression val t_key : type_expression val t_key_hash : type_expression +val t_timestamp : type_expression val t_signature : type_expression (* val t_option : type_expression -> type_expression diff --git a/src/test/contracts/hashlock.mligo b/src/test/contracts/hashlock.mligo index acd7fcf9b..1f9dbb3a4 100644 --- a/src/test/contracts/hashlock.mligo +++ b/src/test/contracts/hashlock.mligo @@ -1,19 +1,50 @@ +type commit = { + date: timestamp; + hashed: bytes; +} + +type commit_set = (address, commit) big_map + type storage = { hashed: bytes; unused: bool; + commits: commit_set; } -type parameter = { +type reveal = { hashable: bytes; message: unit -> operation list; } -let main ((p,s): parameter * storage) : operation list * storage = - (* We have to use a hash salted with the solvers address, otherwise a baker - could steal *) - let salted: bytes = Bytes.concat p.hashable (Bytes.pack sender) in - if ((Crypto.sha256 p.hashable) = s.hashed) && s.unused +type parameter = +| Commit of unit +| Reveal of reveal + +(* We use hash-commit so that a baker can't steal *) +let commit ((p,s): unit * storage) : operation list * storage = + let salted: bytes = Bytes.concat s.hashed (Bytes.pack sender) in + let commit: commit = {date = Current.time + 86400; hashed = salted;} in + let updated_map: commit_set = Big_map.update sender (Some commit) s.commits in + let s = {hashed = s.hashed; unused = s.unused; commits = updated_map} in + (([]: operation list), s) + +let reveal ((p,s): reveal * storage) : operation list * storage = + let commit: commit = + match (Big_map.find_opt sender s.commits) with + | Some c -> c + | None -> (failwith "You haven't made a commitment to hash against yet.": commit) + in + if Current.time < commit.date + then (failwith "It hasn't been 24 hours since your commit yet.": operation list * storage) + else + let salted = Bytes.concat (Crypto.sha256 p.hashable) (Bytes.pack sender) in + if ((Crypto.sha256 salted) = commit.hashed) && s.unused then - let s: storage = {hashed = s.hashed; unused = false} in + let s: storage = {hashed = s.hashed; unused = false; commits = s.commits} in ((p.message ()), s) else (([]: operation list), s) + +let main ((p,s): parameter * storage) : operation list * storage = + match p with + | Commit -> commit ((), s) + | Reveal r -> reveal (r, s) diff --git a/src/test/hash_lock_tests.ml b/src/test/hash_lock_tests.ml new file mode 100644 index 000000000..b14e13cfe --- /dev/null +++ b/src/test/hash_lock_tests.ml @@ -0,0 +1,89 @@ +open Trace +open Test_helpers +open Ast_simplified + +let type_file f = + let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in + let%bind typed,state = Ligo.Compile.Of_simplified.compile simplified in + ok @@ (typed,state) + +let get_program = + let s = ref None in + fun () -> match !s with + | Some s -> ok s + | None -> ( + let%bind program = type_file "./contracts/hashlock.mligo" in + s := Some program ; + ok program + ) + +let compile_main () = + let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/hashlock.mligo" (Syntax_name "cameligo") in + let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile simplified in + let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in + let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in + let%bind (_contract: Tezos_utils.Michelson.michelson) = + (* fails if the given entry point is not a valid contract *) + Ligo.Compile.Of_michelson.build_contract michelson_prg in + ok () + +let empty_op_list = + (e_typed_list [] t_operation) +let empty_message = e_lambda (Var.of_name "arguments") + (Some t_unit) (Some (t_list t_operation)) + empty_op_list + +let call msg = e_constructor "Call" msg +let mk_time st = + match Memory_proto_alpha.Protocol.Alpha_context.Timestamp.of_notation st with + | Some s -> ok s + | None -> simple_fail "bad timestamp notation" +let to_sec t = Tezos_utils.Time.Protocol.to_seconds t +let storage hashed commits = + e_ez_record [("hashed", hashed); + ("unused", e_bool false); + ("commits", commits)] + +let (first_committer , first_contract) = + let open Proto_alpha_utils.Memory_proto_alpha in + let id = List.nth dummy_environment.identities 0 in + let kt = id.implicit_contract in + Protocol.Alpha_context.Contract.to_b58check kt , kt + +let commit () = + let%bind program,_ = get_program () in + let%bind predecessor_timestamp = mk_time "2000-01-01T00:10:10Z" in + let%bind lock_time = mk_time "2000-01-02T00:10:11Z" in + let test_hash = e_bytes_raw (sha_256_hash (Bytes.of_string "hello world")) in + let salted_hash = e_bytes_raw (sha_256_hash + (Bytes.concat + Bytes.empty + [Bytes.of_string first_committer; + (sha_256_hash (Bytes.of_string "hello world"))] + )) + in + let pre_commits = e_typed_big_map [] t_address (t_record_ez [("date", t_timestamp); + ("hashed", t_bytes)]) + in + let init_storage = storage test_hash pre_commits in + let commit = + e_ez_record [("date", e_timestamp + (Int64.to_int (to_sec lock_time))); + ("hashed", salted_hash)] + in + let post_commits = e_big_map [((e_address first_committer), commit)] + in + let post_storage = storage salted_hash post_commits in + let options = + Proto_alpha_utils.Memory_proto_alpha.make_options + ~predecessor_timestamp + ~payer:first_contract + () + in + expect_eq ~options program "commit" + (e_pair (e_unit ()) init_storage) (e_pair empty_op_list post_storage) + +let main = test_suite "Hashlock" [ + test "compile" compile_main ; + test "commit" commit ; +] diff --git a/src/test/test.ml b/src/test/test.ml index b63e1ad5f..99ba02674 100644 --- a/src/test/test.ml +++ b/src/test/test.ml @@ -14,5 +14,6 @@ let () = Multisig_v2_tests.main ; Replaceable_id_tests.main ; Time_lock_tests.main ; + Hash_lock_tests.main ; ] ; () From 62a4482ff3034427ad3b8541a7767d10c30473a3 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 24 Jan 2020 13:28:02 -0800 Subject: [PATCH 005/119] Change commit.salted_hash to be hash, reorder salt in tests, still failing --- src/test/contracts/hashlock.mligo | 6 +++--- src/test/hash_lock_tests.ml | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/test/contracts/hashlock.mligo b/src/test/contracts/hashlock.mligo index 1f9dbb3a4..028f0baec 100644 --- a/src/test/contracts/hashlock.mligo +++ b/src/test/contracts/hashlock.mligo @@ -1,6 +1,6 @@ type commit = { date: timestamp; - hashed: bytes; + salted_hash: bytes; } type commit_set = (address, commit) big_map @@ -23,7 +23,7 @@ type parameter = (* We use hash-commit so that a baker can't steal *) let commit ((p,s): unit * storage) : operation list * storage = let salted: bytes = Bytes.concat s.hashed (Bytes.pack sender) in - let commit: commit = {date = Current.time + 86400; hashed = salted;} in + let commit: commit = {date = Current.time + 86400; salted_hash = Crypto.sha256 salted;} in let updated_map: commit_set = Big_map.update sender (Some commit) s.commits in let s = {hashed = s.hashed; unused = s.unused; commits = updated_map} in (([]: operation list), s) @@ -38,7 +38,7 @@ let reveal ((p,s): reveal * storage) : operation list * storage = then (failwith "It hasn't been 24 hours since your commit yet.": operation list * storage) else let salted = Bytes.concat (Crypto.sha256 p.hashable) (Bytes.pack sender) in - if ((Crypto.sha256 salted) = commit.hashed) && s.unused + if ((Crypto.sha256 salted) = commit.salted_hash) && s.unused then let s: storage = {hashed = s.hashed; unused = false; commits = s.commits} in ((p.message ()), s) diff --git a/src/test/hash_lock_tests.ml b/src/test/hash_lock_tests.ml index b14e13cfe..b82fa5af2 100644 --- a/src/test/hash_lock_tests.ml +++ b/src/test/hash_lock_tests.ml @@ -39,9 +39,9 @@ let mk_time st = | Some s -> ok s | None -> simple_fail "bad timestamp notation" let to_sec t = Tezos_utils.Time.Protocol.to_seconds t -let storage hashed commits = +let storage hashed used commits = e_ez_record [("hashed", hashed); - ("unused", e_bool false); + ("unused", e_bool used); ("commits", commits)] let (first_committer , first_contract) = @@ -54,26 +54,25 @@ let commit () = let%bind program,_ = get_program () in let%bind predecessor_timestamp = mk_time "2000-01-01T00:10:10Z" in let%bind lock_time = mk_time "2000-01-02T00:10:11Z" in - let test_hash = e_bytes_raw (sha_256_hash (Bytes.of_string "hello world")) in + let test_hash_raw = sha_256_hash (Bytes.of_string "hello world") in + let test_hash = e_bytes_raw test_hash_raw in + let%bind packed_sender = pack_payload program (e_bytes_string first_committer) in let salted_hash = e_bytes_raw (sha_256_hash - (Bytes.concat - Bytes.empty - [Bytes.of_string first_committer; - (sha_256_hash (Bytes.of_string "hello world"))] - )) + (Bytes.concat Bytes.empty [test_hash_raw; + packed_sender])) in let pre_commits = e_typed_big_map [] t_address (t_record_ez [("date", t_timestamp); - ("hashed", t_bytes)]) + ("salted_hash", t_bytes)]) in - let init_storage = storage test_hash pre_commits in + let init_storage = storage test_hash true pre_commits in let commit = e_ez_record [("date", e_timestamp (Int64.to_int (to_sec lock_time))); - ("hashed", salted_hash)] + ("salted_hash", salted_hash)] in let post_commits = e_big_map [((e_address first_committer), commit)] in - let post_storage = storage salted_hash post_commits in + let post_storage = storage salted_hash true post_commits in let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp From 729575af112f87b4623623a00a4e254cf6a71c01 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Tue, 28 Jan 2020 15:13:50 +0100 Subject: [PATCH 006/119] Updates. --- .../docs/language-basics/functions.md | 97 +++++----- .../docs/language-basics/maps-records.md | 180 ++++++++++-------- .../docs/language-basics/sets-lists-tuples.md | 36 ++-- 3 files changed, 172 insertions(+), 141 deletions(-) diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index 5cf99f761..b8a839817 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -15,10 +15,10 @@ Each `block` needs to include at least one `instruction`, or a *placeholder* ins ```pascaligo skip // shorthand syntax -block { skip } +block { a := a + 1 } // verbose syntax begin - skip + a := a + 1 end ``` @@ -29,16 +29,17 @@ end -Functions in PascaLIGO are defined using the `function` keyword followed by their `name`, `parameters` and `return` type definitions. - -Here's how you define a basic function that accepts two `ints` and returns a single `int`: +Functions in PascaLIGO are defined using the `function` keyword +followed by their `name`, `parameters` and `return` type definitions. +Here's how you define a basic function that accepts two `int`s and +returns a single `int`: ```pascaligo group=a -function add(const a: int; const b: int): int is - begin - const result: int = a + b; - end with result; +function add(const a: int; const b: int): int is + begin + const result: int = a + b; + end with result; ``` The function body consists of two parts: @@ -48,8 +49,10 @@ The function body consists of two parts: #### Blockless functions -Functions that can contain all of their logic into a single instruction/expression, can be defined without the surrounding `block`. -Instead, you can inline the necessary logic directly, like this: +Functions that can contain all of their logic into a single +instruction/expression, can be defined without the surrounding +`block`. Instead, you can inline the necessary logic directly, like +this: ```pascaligo group=b function add(const a: int; const b: int): int is a + b @@ -57,72 +60,78 @@ function add(const a: int; const b: int): int is a + b -Functions in CameLIGO are defined using the `let` keyword, like value bindings. -The difference is that after the value name a list of function parameters is provided, -along with a return type. +Functions in CameLIGO are defined using the `let` keyword, like value +bindings. The difference is that after the value name a list of +function parameters is provided, along with a return type. -CameLIGO is a little different from other syntaxes when it comes to function -parameters. In OCaml, functions can only take one parameter. To get functions -with multiple arguments like we're used to in traditional programming languages, -a technique called [currying](https://en.wikipedia.org/wiki/Currying) is used. -Currying essentially translates a function with multiple arguments into a series -of single argument functions, each returning a new function accepting the next -argument until every parameter is filled. This is useful because it means that -CameLIGO can support [partial application](https://en.wikipedia.org/wiki/Partial_application). +CameLIGO is a little different from other syntaxes when it comes to +function parameters. In OCaml, functions can only take one +parameter. To get functions with multiple arguments like we are used +to in traditional programming languages, a technique called +[currying](https://en.wikipedia.org/wiki/Currying) is used. Currying +essentially translates a function with multiple arguments into a +series of single argument functions, each returning a new function +accepting the next argument until every parameter is filled. This is +useful because it means that CameLIGO can support +[partial application](https://en.wikipedia.org/wiki/Partial_application). -Currying is however *not* the preferred way to pass function arguments in CameLIGO. -While this approach is faithful to the original OCaml, it's costlier in Michelson -than naive function execution accepting multiple arguments. Instead for most -functions with more than one parameter we should place the arguments in a -[tuple](language-basics/sets-lists-tuples.md) and pass the tuple in as a single -parameter. +Currying is however *not* the preferred way to pass function arguments +in CameLIGO. While this approach is faithful to the original OCaml, +it's costlier in Michelson than naive function execution accepting +multiple arguments. Instead for most functions with more than one +parameter we should place the arguments in a +[tuple](language-basics/sets-lists-tuples.md) and pass the tuple in as +a single parameter. -Here's how you define a basic function that accepts two `ints` and returns an `int` as well: +Here is how you define a basic function that accepts two `ints` and +returns an `int` as well: ```cameligo group=b - let add (a,b: int * int) : int = a + b let add_curry (a: int) (b: int) : int = a + b ``` -The function body is a series of expressions, which are evaluated to give the return -value. - +The function body is a series of expressions, which are evaluated to +give the return value. -Functions in ReasonLIGO are defined using the `let` keyword, like value bindings. -The difference is that after the value name a list of function parameters is provided, -along with a return type. +Functions in ReasonLIGO are defined using the `let` keyword, like +value bindings. The difference is that after the value name a list of +function parameters is provided, along with a return type. -Here's how you define a basic function that accepts two `ints` and returns an `int` as well: +Here is how you define a basic function that accepts two `int`s and +returns an `int` as well: ```reasonligo group=b let add = ((a,b): (int, int)) : int => a + b; ``` -The function body is a series of expressions, which are evaluated to give the return -value. +The function body is a series of expressions, which are evaluated to +give the return value. ## Anonymous functions -Functions without a name, also known as anonymous functions are useful in cases when you want to pass the function as an argument or assign it to a key in a record/map. +Functions without a name, also known as anonymous functions are useful +in cases when you want to pass the function as an argument or assign +it to a key in a record or a map. -Here's how to define an anonymous function assigned to a variable `increment`, with it's appropriate function type signature. +Here's how to define an anonymous function assigned to a variable +`increment`, with it is appropriate function type signature. ```pascaligo group=c -const increment : (int -> int) = (function (const i : int) : int is i + 1); +const increment : int -> int = function (const i : int) : int is i + 1; // a = 2 -const a: int = increment(1); +const a: int = increment (1); ``` ```cameligo group=c -let increment : (int -> int) = fun (i: int) -> i + 1 +let increment : int -> int = fun (i: int) -> i + 1 ``` diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index 5f51de96c..3d05d41da 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -3,19 +3,22 @@ id: maps-records title: Maps, Records --- -So far we've seen pretty basic data types. LIGO also offers more complex built-in constructs, such as Maps and Records. +So far we have seen pretty basic data types. LIGO also offers more +complex built-in constructs, such as maps and records. ## Maps -Maps are natively available in Michelson, and LIGO builds on top of them. A requirement for a Map is that its keys be of the same type, and that type must be comparable. +Maps are natively available in Michelson, and LIGO builds on top of +them. A requirement for a map is that its keys be of the same type, +and that type must be comparable. -Here's how a custom map type is defined: +Here is how a custom map type is defined: ```pascaligo -type move is (int * int); -type moveset is map(address, move); +type move is int * int +type moveset is map(address, move) ``` @@ -32,7 +35,7 @@ type moveset = map(address, move); -And here's how a map value is populated: +And here is how a map value is populated: @@ -77,7 +80,10 @@ let moves : moveset = ### Accessing map values by key -If we want to access a move from our moveset above, we can use the `[]` operator/accessor to read the associated `move` value. However, the value we'll get will be wrapped as an optional; in our case `option(move)`. Here's an example: +If we want to access a move from our moveset above, we can use the +`[]` operator/accessor to read the associated `move` value. However, +the value we will get will be wrapped as an optional; in our case +`option(move)`. Here is an example: @@ -175,8 +181,8 @@ otherwise. function iter_op (const m : moveset) : unit is block { function aggregate (const i : address ; const j : move) : unit is block - { if (j.1 > 1) then skip else failwith("fail") } with unit ; - } with map_iter(aggregate, m) ; + { if j.1 > 1 then skip else failwith("fail") } with unit + } with map_iter(aggregate, m); ``` @@ -189,7 +195,7 @@ let iter_op (m : moveset) : unit = ```reasonligo let iter_op = (m: moveset): unit => { - let assert_eq = ((i,j): (address, move)) => assert(j[0] > 1); + let assert_eq = ((i,j): (address, move)) => assert (j[0] > 1); Map.iter(assert_eq, m); }; ``` @@ -202,8 +208,8 @@ let iter_op = (m: moveset): unit => { ```pascaligo function map_op (const m : moveset) : moveset is block { - function increment (const i : address ; const j : move) : move is block { skip } with (j.0, j.1 + 1) ; - } with map_map(increment, m) ; + function increment (const i : address ; const j : move) : move is (j.0, j.1 + 1); + } with map_map (increment, m); ``` @@ -222,29 +228,30 @@ let map_op = (m: moveset): moveset => { ``` -`fold` is an aggregation function that return the combination of a maps contents. +`fold` is an aggregation function that return the combination of a +maps contents. -The fold is a loop which extracts an element of the map on each iteration. It then -provides this element and an existing value to a folding function which combines them. -On the first iteration, the existing value is an initial expression given by the -programmer. On each subsequent iteration it is the result of the previous iteration. +The fold is a loop which extracts an element of the map on each +iteration. It then provides this element and an existing value to a +folding function which combines them. On the first iteration, the +existing value is an initial expression given by the programmer. On +each subsequent iteration it is the result of the previous iteration. It eventually returns the result of combining all the elements. - ```pascaligo function fold_op (const m : moveset) : int is block { - function aggregate (const j : int ; const cur : (address * (int * int))) : int is j + cur.1.1 ; - } with map_fold(aggregate, m , 5) + function aggregate (const j : int; const cur : address * (int * int)) : int is j + cur.1.1 + } with map_fold(aggregate, m, 5) ``` ```cameligo let fold_op (m : moveset) : moveset = - let aggregate = fun (i,j: int * (address * (int * int))) -> i + j.1.1 in - Map.fold aggregate m 5 + let aggregate = fun (i,j: int * (address * (int * int))) -> i + j.1.1 + in Map.fold aggregate m 5 ``` @@ -268,13 +275,13 @@ too expensive were it not for big maps. Big maps are a data structure offered by Tezos which handles the scaling concerns for us. In LIGO, the interface for big maps is analogous to the one used for ordinary maps. -Here's how we define a big map: +Here is how we define a big map: ```pascaligo -type move is (int * int); -type moveset is big_map(address, move); +type move is (int * int) +type moveset is big_map (address, move) ``` @@ -291,16 +298,17 @@ type moveset = big_map(address, move); -And here's how a map value is populated: +And here is how a map value is populated: ```pascaligo -const moves: moveset = big_map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1, 2); - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0, 3); -end +const moves: moveset = + big_map + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1,2); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0,3); + end ``` > Notice the `->` between the key and its value and `;` to separate individual map entries. > @@ -309,45 +317,51 @@ end ```cameligo -let moves: moveset = Big_map.literal - [ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1, 2)) ; - (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0, 3)) ; +let moves: moveset = + Big_map.literal [ + (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1,2)); + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0,3)); ] ``` > Big_map.literal constructs the map from a list of key-value pair tuples, `(, )`. > Note also the `;` to separate individual map entries. > -> `("": address)` means that we type-cast a string into an address. +> `("": address)` means that we cast a string into an address. ```reasonligo let moves: moveset = - Big_map.literal([ - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1, 2)), - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0, 3)), + Big_map.literal ([ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1,2)), + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0,3)), ]); ``` > Big_map.literal constructs the map from a list of key-value pair tuples, `(, )`. > -> `("": address)` means that we type-cast a string into an address. +> `("": address)` means that we cast a string into an address. ### Accessing map values by key -If we want to access a move from our moveset above, we can use the `[]` operator/accessor to read the associated `move` value. However, the value we'll get will be wrapped as an optional; in our case `option(move)`. Here's an example: +If we want to access a move from our moveset above, we can use the +`[]` operator/accessor to read the associated `move` value. However, +the value we will get will be wrapped as an optional; in our case +`option(move)`. Here is an example: ```pascaligo -const my_balance : option(move) = moves[("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)]; +const my_balance : option(move) = + moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] ``` ```cameligo -let my_balance : move option = Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves +let my_balance : move option = + Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves ``` @@ -360,24 +374,28 @@ let my_balance : option(move) = #### Obtaining a map value forcefully -Accessing a value in a map yields an option, however you can also get the value directly: +Accessing a value in a map yields an option, however you can also get +the value directly: ```pascaligo -const my_balance : move = get_force(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves); +const my_balance : move = + get_force (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves); ``` ```cameligo -let my_balance : move = Big_map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves +let my_balance : move = + Big_map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves ``` ```reasonligo -let my_balance : move = Big_map.find("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); +let my_balance : move = + Big_map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); ``` @@ -388,19 +406,21 @@ let my_balance : move = Big_map.find("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": add -The values of a PascaLIGO big map can be updated using the ordinary assignment syntax: +The values of a PascaLIGO big map can be updated using the ordinary +assignment syntax: ```pascaligo function set_ (var m : moveset) : moveset is block { - m[("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9); + m [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9); } with m ``` -We can update a big map in CameLIGO using the `Big_map.update` built-in: +We can update a big map in CameLIGO using the `Big_map.update` +built-in: ```cameligo @@ -410,10 +430,11 @@ let updated_map : moveset = -We can update a big map in ReasonLIGO using the `Big_map.update` built-in: +We can update a big map in ReasonLIGO using the `Big_map.update` +built-in: ```reasonligo -let updated_map: moveset = +let updated_map : moveset = Big_map.update(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some((4,9)), moves); ``` @@ -421,75 +442,79 @@ let updated_map: moveset = ## Records -Records are a construct introduced in LIGO, and are not natively available in Michelson. The LIGO compiler translates records into Michelson `Pairs`. +Records are a construct introduced in LIGO, and are not natively +available in Michelson. The LIGO compiler translates records into +Michelson `Pairs`. -Here's how a custom record type is defined: +Here is how a custom record type is defined: ```pascaligo -type user is record - id: nat; - is_admin: bool; - name: string; -end +type user is + record + id : nat; + is_admin : bool; + name : string + end ``` ```cameligo type user = { - id: nat; - is_admin: bool; - name: string; + id : nat; + is_admin : bool; + name : string } ``` ```reasonligo type user = { - id: nat, - is_admin: bool, - name: string + id : nat, + is_admin : bool, + name : string }; ``` -And here's how a record value is populated: +And here is how a record value is populated: ```pascaligo -const user: user = record - id = 1n; +const user : user = + record + id = 1n; is_admin = True; - name = "Alice"; -end + name = "Alice" + end ``` ```cameligo -let user: user = { - id = 1n; +let user : user = { + id = 1n; is_admin = true; - name = "Alice"; + name = "Alice" } ``` ```reasonligo -let user: user = { - id: 1n, - is_admin: true, - name: "Alice" +let user : user = { + id : 1n, + is_admin : true, + name : "Alice" }; ``` - ### Accessing record keys by name -If we want to obtain a value from a record for a given key, we can do the following: +If we want to obtain a value from a record for a given key, we can do +the following: @@ -506,5 +531,4 @@ let is_admin : bool = user.is_admin ```reasonligo let is_admin: bool = user.is_admin; ``` - diff --git a/gitlab-pages/docs/language-basics/sets-lists-tuples.md b/gitlab-pages/docs/language-basics/sets-lists-tuples.md index f423caf7d..bc05f0ce3 100644 --- a/gitlab-pages/docs/language-basics/sets-lists-tuples.md +++ b/gitlab-pages/docs/language-basics/sets-lists-tuples.md @@ -3,39 +3,37 @@ id: sets-lists-tuples title: Sets, Lists, Tuples --- -Apart from complex data types such as `maps` and `records`, ligo also exposes `sets`, `lists` and `tuples`. +Apart from complex data types such as `maps` and `records`, ligo also +exposes `sets`, `lists` and `tuples`. > ⚠️ Make sure to pick the appropriate data type for your use case; it carries not only semantic but also gas related costs. ## Sets -Sets are similar to lists. The main difference is that elements of a `set` must be *unique*. +Sets are similar to lists. The main difference is that elements of a +`set` must be *unique*. ### Defining a set ```pascaligo group=a -type int_set is set(int); -const my_set: int_set = set - 1; - 2; - 3; -end +type int_set is set (int); +const my_set : int_set = set 1; 2; 3 end ``` ```cameligo group=a type int_set = int set -let my_set: int_set = +let my_set : int_set = Set.add 3 (Set.add 2 (Set.add 1 (Set.empty: int set))) ``` ```reasonligo group=a -type int_set = set(int); -let my_set: int_set = - Set.add(3, Set.add(2, Set.add(1, Set.empty: set(int)))); +type int_set = set (int); +let my_set : int_set = + Set.add (3, Set.add (2, Set.add (1, Set.empty: set (int)))); ``` @@ -45,8 +43,8 @@ let my_set: int_set = ```pascaligo group=a -const my_set: int_set = set end; -const my_set_2: int_set = set_empty; +const my_set: int_set = set end +const my_set_2: int_set = set_empty ``` ```cameligo group=a @@ -54,7 +52,7 @@ let my_set: int_set = (Set.empty: int set) ``` ```reasonligo group=a -let my_set: int_set = (Set.empty: set(int)); +let my_set: int_set = (Set.empty: set (int)); ``` @@ -63,9 +61,9 @@ let my_set: int_set = (Set.empty: set(int)); ```pascaligo group=a -const contains_three: bool = my_set contains 3; +const contains_three : bool = my_set contains 3 // or alternatively -const contains_three_fn: bool = set_mem(3, my_set); +const contains_three_fn: bool = set_mem (3, my_set); ``` @@ -84,7 +82,7 @@ let contains_three: bool = Set.mem(3, my_set); ```pascaligo group=a -const set_size: nat = size(my_set); +const set_size: nat = size (my_set) ``` @@ -94,7 +92,7 @@ let set_size: nat = Set.size my_set ```reasonligo group=a -let set_size: nat = Set.size(my_set); +let set_size: nat = Set.size (my_set); ``` From fa9372c595618bd8fd50ce109874806f60ef8d5b Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Fri, 31 Jan 2020 12:24:25 +0100 Subject: [PATCH 007/119] Updated ParErr.ml for ReasonLIGO (may have caused Not_found). --- src/passes/1-parser/reasonligo/ParErr.ml | 270 ++++++++++++----------- 1 file changed, 143 insertions(+), 127 deletions(-) diff --git a/src/passes/1-parser/reasonligo/ParErr.ml b/src/passes/1-parser/reasonligo/ParErr.ml index 18b32b373..693c26a37 100644 --- a/src/passes/1-parser/reasonligo/ParErr.ml +++ b/src/passes/1-parser/reasonligo/ParErr.ml @@ -46,7 +46,7 @@ let message = "\n" | 11 -> "\n" - | 528 -> + | 544 -> "\n" | 61 -> "\n" @@ -72,7 +72,7 @@ let message = "\n" | 70 -> "\n" - | 524 -> + | 540 -> "\n" | 185 -> "\n" @@ -162,11 +162,11 @@ let message = "\n" | 59 -> "\n" - | 531 -> + | 547 -> "\n" | 225 -> "\n" - | 533 -> + | 549 -> "\n" | 223 -> "\n" @@ -232,11 +232,11 @@ let message = "\n" | 72 -> "\n" - | 483 -> + | 499 -> "\n" - | 484 -> + | 500 -> "\n" - | 423 -> + | 427 -> "\n" | 161 -> "\n" @@ -244,61 +244,61 @@ let message = "\n" | 160 -> "\n" - | 486 -> + | 502 -> "\n" - | 487 -> + | 503 -> "\n" - | 504 -> + | 520 -> + "\n" + | 529 -> + "\n" + | 514 -> + "\n" + | 515 -> "\n" | 513 -> "\n" - | 498 -> + | 504 -> "\n" - | 499 -> + | 505 -> "\n" - | 497 -> + | 506 -> "\n" - | 488 -> - "\n" - | 489 -> - "\n" - | 490 -> - "\n" - | 492 -> - "\n" - | 493 -> - "\n" - | 494 -> - "\n" - | 495 -> + | 508 -> "\n" | 509 -> "\n" | 510 -> "\n" - | 491 -> + | 511 -> "\n" - | 520 -> + | 525 -> "\n" - | 518 -> + | 526 -> "\n" - | 485 -> + | 507 -> + "\n" + | 536 -> + "\n" + | 534 -> + "\n" + | 501 -> + "\n" + | 376 -> + "\n" + | 370 -> + "\n" + | 371 -> + "\n" + | 373 -> "\n" | 372 -> "\n" - | 366 -> - "\n" - | 367 -> - "\n" | 369 -> "\n" - | 368 -> - "\n" - | 365 -> - "\n" | 76 -> "\n" - | 446 -> + | 450 -> "\n" | 326 -> "\n" @@ -328,61 +328,61 @@ let message = "\n" | 82 -> "\n" - | 448 -> - "\n" - | 449 -> - "\n" - | 451 -> - "\n" | 452 -> "\n" + | 453 -> + "\n" + | 455 -> + "\n" + | 456 -> + "\n" | 200 -> "\n" | 236 -> "\n" | 79 -> "\n" - | 467 -> + | 483 -> "\n" - | 468 -> + | 484 -> + "\n" + | 492 -> + "\n" + | 493 -> + "\n" + | 495 -> + "\n" + | 496 -> + "\n" + | 485 -> + "\n" + | 486 -> + "\n" + | 81 -> "\n" | 476 -> "\n" | 477 -> "\n" - | 479 -> - "\n" - | 480 -> - "\n" - | 469 -> - "\n" - | 470 -> - "\n" - | 81 -> - "\n" - | 460 -> - "\n" | 461 -> "\n" - | 455 -> - "\n" - | 454 -> - "\n" | 458 -> "\n" - | 348 -> + | 464 -> "\n" - | 356 -> + | 465 -> "\n" - | 360 -> + | 470 -> "\n" - | 359 -> + | 474 -> "\n" - | 355 -> + | 473 -> "\n" - | 349 -> + | 469 -> "\n" - | 457 -> + | 459 -> + "\n" + | 463 -> "\n" | 340 -> "\n" @@ -392,6 +392,22 @@ let message = "\n" | 347 -> "\n" + | 348 -> + "\n" + | 349 -> + "\n" + | 350 -> + "\n" + | 360 -> + "\n" + | 364 -> + "\n" + | 363 -> + "\n" + | 357 -> + "\n" + | 359 -> + "\n" | 342 -> "\n" | 343 -> @@ -408,93 +424,93 @@ let message = "\n" | 324 -> "\n" - | 389 -> - "\n" - | 436 -> - "\n" - | 437 -> - "\n" - | 438 -> - "\n" - | 439 -> + | 393 -> "\n" | 440 -> "\n" | 441 -> "\n" - | 435 -> + | 442 -> + "\n" + | 443 -> + "\n" + | 444 -> + "\n" + | 445 -> + "\n" + | 439 -> "\n" | 325 -> "\n" - | 362 -> + | 366 -> "\n" - | 363 -> - "\n" - | 373 -> - "\n" - | 374 -> - "\n" - | 413 -> - "\n" - | 420 -> - "\n" - | 408 -> - "\n" - | 409 -> - "\n" - | 407 -> - "\n" - | 375 -> - "\n" - | 376 -> + | 367 -> "\n" | 377 -> "\n" - | 402 -> - "\n" - | 403 -> - "\n" - | 404 -> - "\n" - | 405 -> + | 378 -> "\n" | 417 -> "\n" - | 418 -> + | 424 -> "\n" - | 401 -> + | 412 -> "\n" - | 429 -> + | 413 -> "\n" - | 427 -> - "\n" - | 364 -> - "\n" - | 384 -> - "\n" - | 385 -> - "\n" - | 383 -> - "\n" - | 378 -> + | 411 -> "\n" | 379 -> "\n" | 380 -> "\n" - | 394 -> + | 381 -> "\n" - | 395 -> + | 406 -> "\n" - | 396 -> + | 407 -> "\n" - | 397 -> + | 408 -> "\n" - | 399 -> + | 409 -> + "\n" + | 421 -> + "\n" + | 422 -> + "\n" + | 405 -> + "\n" + | 433 -> + "\n" + | 431 -> + "\n" + | 368 -> + "\n" + | 388 -> + "\n" + | 389 -> + "\n" + | 387 -> + "\n" + | 382 -> + "\n" + | 383 -> + "\n" + | 384 -> "\n" | 398 -> "\n" - | 393 -> + | 399 -> + "\n" + | 400 -> + "\n" + | 401 -> + "\n" + | 403 -> + "\n" + | 402 -> + "\n" + | 397 -> "\n" | 320 -> "\n" From a9b3d295fd60f258a00cb197524361dac9b8db9a Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Fri, 31 Jan 2020 12:31:25 +0100 Subject: [PATCH 008/119] Fixes to the lexer and the parser API. * The parameter for logging the lexer is now mandatory. * The ParserAPI now thread the logging of the lexer. * LexerMain.ml now call the logging of the lexers (CameLIGO, ReasonLIGO). * Fixed bug in lexer when a line comment ends with EOF. --- src/passes/1-parser/cameligo/LexerMain.ml | 5 ++++ src/passes/1-parser/pascaligo/LexerMain.ml | 4 +-- src/passes/1-parser/reasonligo/LexerMain.ml | 5 ++++ src/passes/1-parser/shared/Lexer.mli | 2 +- src/passes/1-parser/shared/Lexer.mll | 15 +++++----- src/passes/1-parser/shared/ParserAPI.ml | 32 ++++++++++++++------- src/passes/1-parser/shared/ParserAPI.mli | 9 +++++- src/passes/1-parser/shared/ParserUnit.ml | 2 +- 8 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/passes/1-parser/cameligo/LexerMain.ml b/src/passes/1-parser/cameligo/LexerMain.ml index e9775b803..6c0729851 100644 --- a/src/passes/1-parser/cameligo/LexerMain.ml +++ b/src/passes/1-parser/cameligo/LexerMain.ml @@ -7,3 +7,8 @@ module IO = end module M = LexerUnit.Make (IO) (Lexer.Make (LexToken)) + +let () = + match M.trace () with + Stdlib.Ok () -> () + | Error msg -> Utils.highlight msg diff --git a/src/passes/1-parser/pascaligo/LexerMain.ml b/src/passes/1-parser/pascaligo/LexerMain.ml index 042b0930a..ba2925172 100644 --- a/src/passes/1-parser/pascaligo/LexerMain.ml +++ b/src/passes/1-parser/pascaligo/LexerMain.ml @@ -10,5 +10,5 @@ module M = LexerUnit.Make (IO) (Lexer.Make (LexToken)) let () = match M.trace () with - Stdlib.Ok _ -> () - | Error msg -> Printf.eprintf "\027[31m%s\027[0m%!" msg + Stdlib.Ok () -> () + | Error msg -> Utils.highlight msg diff --git a/src/passes/1-parser/reasonligo/LexerMain.ml b/src/passes/1-parser/reasonligo/LexerMain.ml index 756a2f103..8681f49e8 100644 --- a/src/passes/1-parser/reasonligo/LexerMain.ml +++ b/src/passes/1-parser/reasonligo/LexerMain.ml @@ -7,3 +7,8 @@ module IO = end module M = LexerUnit.Make (IO) (Lexer.Make (LexToken)) + +let () = + match M.trace () with + Stdlib.Ok () -> () + | Error msg -> Utils.highlight msg diff --git a/src/passes/1-parser/shared/Lexer.mli b/src/passes/1-parser/shared/Lexer.mli index 1d338d719..034f8b252 100644 --- a/src/passes/1-parser/shared/Lexer.mli +++ b/src/passes/1-parser/shared/Lexer.mli @@ -136,7 +136,7 @@ module type S = val slide : token -> window -> window type instance = { - read : ?log:logger -> Lexing.lexbuf -> token; + read : log:logger -> Lexing.lexbuf -> token; buffer : Lexing.lexbuf; get_win : unit -> window; get_pos : unit -> Pos.t; diff --git a/src/passes/1-parser/shared/Lexer.mll b/src/passes/1-parser/shared/Lexer.mll index 73b33b804..97d864d52 100644 --- a/src/passes/1-parser/shared/Lexer.mll +++ b/src/passes/1-parser/shared/Lexer.mll @@ -158,7 +158,7 @@ module type S = val slide : token -> window -> window type instance = { - read : ?log:logger -> Lexing.lexbuf -> token; + read : log:logger -> Lexing.lexbuf -> token; buffer : Lexing.lexbuf; get_win : unit -> window; get_pos : unit -> Pos.t; @@ -424,13 +424,14 @@ module Make (Token: TOKEN) : (S with module Token = Token) = Hint: Remove the leading minus sign.\n" | Broken_string -> "The string starting here is interrupted by a line break.\n\ - Hint: Remove the break, close the string before or insert a backslash.\n" + Hint: Remove the break, close the string before or insert a \ + backslash.\n" | Invalid_character_in_string -> "Invalid character in string.\n\ Hint: Remove or replace the character.\n" | Reserved_name s -> - "Reserved name: " ^ s ^ ".\n\ - Hint: Change the name.\n" + sprintf "Reserved name: \"%s\".\n\ + Hint: Change the name.\n" s | Invalid_symbol -> "Invalid symbol.\n\ Hint: Check the LIGO syntax you use.\n" @@ -779,7 +780,7 @@ and scan_line thread state = parse and thread = push_string nl thread and state = {state with pos = state.pos#new_line nl} in thread, state } -| eof { fail thread.opening Unterminated_comment } +| eof { thread, state } | _ { let () = rollback lexbuf in let len = thread.len in let thread, @@ -855,7 +856,7 @@ and scan_utf8 thread state = parse type logger = Markup.t list -> token -> unit type instance = { - read : ?log:logger -> Lexing.lexbuf -> token; + read : log:logger -> Lexing.lexbuf -> token; buffer : Lexing.lexbuf; get_win : unit -> window; get_pos : unit -> Pos.t; @@ -934,7 +935,7 @@ let open_token_stream file_path_opt = in fail region Missing_break | _ -> () in - let rec read_token ?(log=fun _ _ -> ()) buffer = + let rec read_token ~log buffer = match FQueue.deq !state.units with None -> scan buffer; diff --git a/src/passes/1-parser/shared/ParserAPI.ml b/src/passes/1-parser/shared/ParserAPI.ml index aabb1efef..2f0ed7598 100644 --- a/src/passes/1-parser/shared/ParserAPI.ml +++ b/src/passes/1-parser/shared/ParserAPI.ml @@ -2,6 +2,12 @@ module Region = Simple_utils.Region +module type IO = + sig + val ext : string (* LIGO file extension *) + val options : EvalOpt.options (* CLI options *) + end + module type PARSER = sig (* The type of tokens, abstract syntax trees and expressions *) @@ -42,7 +48,8 @@ module type PARSER = (* Main functor *) -module Make (Lexer: Lexer.S) +module Make (IO : IO) + (Lexer: Lexer.S) (Parser: PARSER with type token = Lexer.Token.token) (ParErr: sig val message : int -> string end) = struct @@ -116,18 +123,21 @@ module Make (Lexer: Lexer.S) module Incr = Parser.Incremental + module Log = LexerLog.Make (Lexer) + let log = Log.output_token ~offsets:IO.options#offsets + IO.options#mode IO.options#cmd stdout + let incr_contract Lexer.{read; buffer; get_win; close; _} = - let supplier = I.lexer_lexbuf_to_supplier read buffer - and failure = failure get_win in - let parser = Incr.contract buffer.Lexing.lex_curr_p in - let ast = I.loop_handle success failure supplier parser + let supplier = I.lexer_lexbuf_to_supplier (read ~log) buffer + and failure = failure get_win in + let parser = Incr.contract buffer.Lexing.lex_curr_p in + let ast = I.loop_handle success failure supplier parser in close (); ast - let incr_expr Lexer.{read; buffer; get_win; close; _} = - let supplier = I.lexer_lexbuf_to_supplier read buffer - and failure = failure get_win in - let parser = Incr.interactive_expr buffer.Lexing.lex_curr_p in - let expr = I.loop_handle success failure supplier parser + let incr_expr Lexer.{read; buffer; get_win; close; _} = + let supplier = I.lexer_lexbuf_to_supplier (read ~log) buffer + and failure = failure get_win in + let parser = Incr.interactive_expr buffer.Lexing.lex_curr_p in + let expr = I.loop_handle success failure supplier parser in close (); expr - end diff --git a/src/passes/1-parser/shared/ParserAPI.mli b/src/passes/1-parser/shared/ParserAPI.mli index 396a8698c..6fce46381 100644 --- a/src/passes/1-parser/shared/ParserAPI.mli +++ b/src/passes/1-parser/shared/ParserAPI.mli @@ -2,6 +2,12 @@ module Region = Simple_utils.Region +module type IO = + sig + val ext : string (* LIGO file extension *) + val options : EvalOpt.options (* CLI options *) + end + (* The signature generated by Menhir with additional type definitions for [ast] and [expr]. *) @@ -43,7 +49,8 @@ module type PARSER = end end -module Make (Lexer: Lexer.S) +module Make (IO: IO) + (Lexer: Lexer.S) (Parser: PARSER with type token = Lexer.Token.token) (ParErr: sig val message : int -> string end) : sig diff --git a/src/passes/1-parser/shared/ParserUnit.ml b/src/passes/1-parser/shared/ParserUnit.ml index dff827a56..eb4eb61d1 100644 --- a/src/passes/1-parser/shared/ParserUnit.ml +++ b/src/passes/1-parser/shared/ParserUnit.ml @@ -85,7 +85,7 @@ module Make (Lexer: Lexer.S) (* Instantiating the parser *) - module Front = ParserAPI.Make (Lexer)(Parser)(ParErr) + module Front = ParserAPI.Make (IO)(Lexer)(Parser)(ParErr) let format_error = Front.format_error From e25bb009619cfb8aa8885683b02716ad053e7b99 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Fri, 31 Jan 2020 14:11:56 +0100 Subject: [PATCH 009/119] Forgot to add those fixes to the previous commit. --- src/passes/1-parser/cameligo/LexerMain.ml | 4 ++-- src/passes/1-parser/pascaligo/LexerMain.ml | 2 +- src/passes/1-parser/reasonligo/LexerMain.ml | 4 ++-- src/passes/1-parser/shared/Lexer.mll | 22 ++++++++++----------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/passes/1-parser/cameligo/LexerMain.ml b/src/passes/1-parser/cameligo/LexerMain.ml index 6c0729851..5ef471c37 100644 --- a/src/passes/1-parser/cameligo/LexerMain.ml +++ b/src/passes/1-parser/cameligo/LexerMain.ml @@ -1,4 +1,4 @@ -(** Driver for the CameLIGO lexer *) +(* Driver for the CameLIGO lexer *) module IO = struct @@ -11,4 +11,4 @@ module M = LexerUnit.Make (IO) (Lexer.Make (LexToken)) let () = match M.trace () with Stdlib.Ok () -> () - | Error msg -> Utils.highlight msg + | Error Region.{value; _} -> Utils.highlight value diff --git a/src/passes/1-parser/pascaligo/LexerMain.ml b/src/passes/1-parser/pascaligo/LexerMain.ml index f02b06642..32606118a 100644 --- a/src/passes/1-parser/pascaligo/LexerMain.ml +++ b/src/passes/1-parser/pascaligo/LexerMain.ml @@ -13,4 +13,4 @@ module M = LexerUnit.Make (IO) (Lexer.Make (LexToken)) let () = match M.trace () with Stdlib.Ok () -> () - | Error msg -> Utils.highlight msg + | Error Region.{value; _} -> Utils.highlight value diff --git a/src/passes/1-parser/reasonligo/LexerMain.ml b/src/passes/1-parser/reasonligo/LexerMain.ml index 8681f49e8..f0589990c 100644 --- a/src/passes/1-parser/reasonligo/LexerMain.ml +++ b/src/passes/1-parser/reasonligo/LexerMain.ml @@ -1,4 +1,4 @@ -(** Driver for the ReasonLIGO lexer *) +(* Driver for the ReasonLIGO lexer *) module IO = struct @@ -11,4 +11,4 @@ module M = LexerUnit.Make (IO) (Lexer.Make (LexToken)) let () = match M.trace () with Stdlib.Ok () -> () - | Error msg -> Utils.highlight msg + | Error Region.{value; _} -> Utils.highlight value diff --git a/src/passes/1-parser/shared/Lexer.mll b/src/passes/1-parser/shared/Lexer.mll index ca85a124e..2821acc85 100644 --- a/src/passes/1-parser/shared/Lexer.mll +++ b/src/passes/1-parser/shared/Lexer.mll @@ -823,17 +823,17 @@ and scan_utf8 thread state = parse context of a recognised lexeme (to enforce stylistic constraints or report special error patterns), we need to keep a hidden reference to a queue of recognised lexical units (that is, tokens and markup) - that acts as a mutable state between the calls to - [read_token]. When [read_token] is called, that queue is examined - first and, if it contains at least one token, that token is - returned; otherwise, the lexing buffer is scanned for at least one - more new token. That is the general principle: we put a high-level - buffer (our queue) on top of the low-level lexing buffer. + that acts as a mutable state between the calls to [read]. When + [read] is called, that queue is examined first and, if it contains + at least one token, that token is returned; otherwise, the lexing + buffer is scanned for at least one more new token. That is the + general principle: we put a high-level buffer (our queue) on top of + the low-level lexing buffer. One tricky and important detail is that we must make any parser - generated by Menhir (and calling [read_token]) believe that the - last region of the input source that was matched indeed corresponds - to the returned token, despite that many tokens and markup may have + generated by Menhir (and calling [read]) believe that the last + region of the input source that was matched indeed corresponds to + the returned token, despite that many tokens and markup may have been matched since it was actually read from the input. In other words, the parser requests a token that is taken from the high-level buffer, but the parser requests the source regions from @@ -858,7 +858,7 @@ and scan_utf8 thread state = parse distinguish the first call to the function [scan], as the first scanning rule is actually [init] (which can handle the BOM), not [scan]. -*) + *) type logger = Markup.t list -> token -> unit @@ -952,7 +952,7 @@ let open_token_stream input = in fail region Missing_break | _ -> () in - let rec read_token ~log buffer = + let rec read ~log buffer = match FQueue.deq !state.units with None -> scan buffer; From 6d421ab4b13e037ab5fb1d184a8df11cac97d4b0 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 31 Jan 2020 17:13:22 -0800 Subject: [PATCH 010/119] Add Map.add to test suite --- src/test/contracts/map.ligo | 1 + src/test/contracts/map.mligo | 4 +++- src/test/contracts/map.religo | 2 ++ src/test/integration_tests.ml | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/contracts/map.ligo b/src/test/contracts/map.ligo index 797bb1a8b..f6c63598b 100644 --- a/src/test/contracts/map.ligo +++ b/src/test/contracts/map.ligo @@ -20,6 +20,7 @@ function set_ (var n : int ; var m : foobar) : foobar is block { m[23] := n ; } with m +function add (var n : int ; var m : foobar) : foobar is set_(n,m) function rm (var m : foobar) : foobar is block { remove 42 from map m diff --git a/src/test/contracts/map.mligo b/src/test/contracts/map.mligo index 15f45ead1..7b13f406c 100644 --- a/src/test/contracts/map.mligo +++ b/src/test/contracts/map.mligo @@ -11,6 +11,8 @@ let set_2 (n: int) (m: foobar) : foobar = Map.update 23 (Some n) m let set_ (t: int * foobar) : foobar = set_2 t.0 t.1 +let add (n,m: int * foobar) : foobar = Map.add 23 n m + let rm (m: foobar) : foobar = Map.remove 42 m (* Dummy test so that we can add the same test for PascaLIGO *) @@ -30,7 +32,7 @@ let gf (m: foobar) : int = Map.find 23 m let get (m: foobar) : int option = Map.find_opt 42 m let get_ (m: foobar) : int option = Map.find_opt 42 m -let mem (km: int * foobar) : bool = Map.mem km.0 km.1 +let mem (k,m: int * foobar) : bool = Map.mem k m let iter_op (m : foobar) : unit = let assert_eq = fun (i: int * int) -> assert (i.0 = i.1) diff --git a/src/test/contracts/map.religo b/src/test/contracts/map.religo index 6faacb700..74ec39dcf 100644 --- a/src/test/contracts/map.religo +++ b/src/test/contracts/map.religo @@ -10,6 +10,8 @@ let map2: foobar = Map.literal([(23, 0), (42, 0)]); let set_ = (n: int, m: foobar): foobar => Map.update(23, Some(n), m); +let add = (n: int, m: foobar) : foobar => Map.add(23, n, m); + let rm = (m: foobar): foobar => Map.remove(42, m); /* Dummy test so that we can add the same test for PascaLIGO */ diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 58b492fc2..e944b7c91 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -974,6 +974,11 @@ let map_ type_f path : unit result = let make_expected = fun n -> ez [(23 , n) ; (42 , 0)] in expect_eq_n_pos_small program "set_" make_input make_expected in + let%bind () = + let input = (e_pair (e_int 23) (ez [(42, 42)])) in + let expected = ez [(23, 23) ; (42, 42)] in + expect_eq program "add" input expected + in let%bind () = let input = ez [(23, 23) ; (42, 42)] in let expected = ez [23, 23] in From 477d2e1b12f5d4d7f37134ce1886c4a29712b870 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 31 Jan 2020 17:22:51 -0800 Subject: [PATCH 011/119] Add map reference page to docs --- gitlab-pages/docs/reference/map.md | 334 +++++++++++++++++++++++++++++ 1 file changed, 334 insertions(+) create mode 100644 gitlab-pages/docs/reference/map.md diff --git a/gitlab-pages/docs/reference/map.md b/gitlab-pages/docs/reference/map.md new file mode 100644 index 000000000..9d764b824 --- /dev/null +++ b/gitlab-pages/docs/reference/map.md @@ -0,0 +1,334 @@ +--- +id: map-reference +title: Map +--- + +## Map.find_opt(k: a', m: (a',b') map) : b' option + +Retrieve the value associated with a particular key. This version returns an option +which can either shift logic in response to a missing value or throw an error. + + + +```pascaligo +const my_balance : option(move) = moves[("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)]; +``` + + + +```cameligo +let my_balance : move option = Map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves +``` + + + +```reasonligo +let my_balance : option(move) = + Map.find_opt("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); +``` + + +## Map.find(k: a', m: (a', b') map) : b' + +Forcefully retrieve the value associated with a particular key. If that value +doesn't exist, this function throws an error. + + + +```pascaligo +const my_balance : move = get_force(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves); +``` + + + +```cameligo +let my_balance : move = Map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves +``` + + + +```reasonligo +let my_balance : move = + Map.find("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); +``` + + + +## Map.update(k: a', v: b', m: (a', b') map) : (a', b') map + +Change the value associated with a particular key, if that value doesn't already +exist add it. + + + + + +The values of a PascaLIGO map can be updated using the ordinary assignment syntax: + +```pascaligo + +function set_ (var m: moveset) : moveset is + block { + m[("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9); + } with m +``` + + + +We can update a map in CameLIGO using the `Map.update` built-in: + +```cameligo + +let updated_map: moveset = Map.update ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) (Some (4,9)) moves +``` + + + +We can update a map in ReasonLIGO using the `Map.update` built-in: + +```reasonligo + +let updated_map: moveset = Map.update(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some((4,9)), moves); +``` + + + +## Map.add(k: a', v: b', m: (a', b') map) : (a', b') map + + + + +```pascaligo +function patch_ (var m: foobar) : foobar is block { + patch m with map [0 -> 5; 1 -> 6; 2 -> 7] +} with m +``` + + +```cameligo + +``` + + + + + +## Map.remove(k: a', m: (a', b') map) : (a', b') map + +Remove a key and its associated value from the map. + + + + +```pascaligo +function rm (var m : foobar) : foobar is block { + remove 42 from map m +} with m +``` + + +```cameligo +let rm (m: foobar) : foobar = Map.remove 42 m +``` + + +```reasonligo +let rm = (m: foobar): foobar => Map.remove(42, m); +``` + + + +## Map.iter(iterator_function: (a', b') -> unit, m: (a', b') map) : unit + +Run a function returning unit over the contents of a map's key-value pairs. +For example an assertion. + + + +```pascaligo +function iter_op (const m : moveset) : unit is + block { + function aggregate (const i : address ; const j : move) : unit is block + { if j.1 > 1 then skip else failwith("fail") } with unit + } with map_iter(aggregate, m); +``` + + +```cameligo +let iter_op (m : moveset) : unit = + let assert_eq = fun (i,j: address * move) -> assert (j.0 > 1) + in Map.iter assert_eq m +``` + + +```reasonligo +let iter_op = (m: moveset): unit => { + let assert_eq = ((i,j): (address, move)) => assert (j[0] > 1); + Map.iter(assert_eq, m); +}; +``` + + + +## Map.map(mapping_function: (a', b') -> b', m: (a', b') map) : (a', b') map + +Update the values associated with every key in the map according to some update +rule `mapping_function`. + + + +```pascaligo +function map_op (const m : moveset) : moveset is + block { + function increment (const i : address ; const j : move) : move is (j.0, j.1 + 1); + } with map_map (increment, m); +``` + + +```cameligo +let map_op (m : moveset) : moveset = + let increment = fun (i,j: address * move) -> (j.0, j.1 + 1) + in Map.map increment m +``` + + +```reasonligo +let map_op = (m: moveset): moveset => { + let increment = ((i,j): (address, move)) => (j[0], j[1] + 1); + Map.map(increment, m); +}; +``` + + +## Map.fold(folding_function: (b', (a', b')) -> b', m: (a', b') map, initial: b') : b' + +Combine every value in the map together according to a fold rule `folding_function`. + + + +```pascaligo +function fold_op (const m : moveset) : int is + block { + function aggregate (const j : int; const cur : address * (int * int)) : int is j + cur.1.1 + } with map_fold(aggregate, m, 5) +``` + + +```cameligo +let fold_op (m : moveset) : moveset = + let aggregate = fun (i,j: int * (address * (int * int))) -> i + j.1.1 + in Map.fold aggregate m 5 +``` + + +```reasonligo +let fold_op = (m: moveset): moveset => { + let aggregate = ((i,j): (int, (address, (int,int)))) => i + j[1][1]; + Map.fold(aggregate, m, 5); +}; + +``` + + + + +## Map.mem(k: a', m: (a', b') map) : bool + +Test whether a particular key `k` exists in a given map `m`. + + + + +```pascaligo +function mem (const k: int; const m: foobar) : bool is map_mem(k, m) +``` + +```cameligo +let mem (k,m: int * foobar) : bool = Map.mem k m +``` + + +```reasonligo +let mem = (km: (int, foobar)): bool => Map.mem(km[0], km[1]); +``` + + + +## Map.empty() : (a', b') map + +Create an empty map. + + + + +```pascaligo +const empty_map : foobar = map end +``` + +```cameligo +let empty_map : foobar = Map.empty +``` + + +```reasonligo +let empty_map: foobar = Map.empty; +``` + + + +## Map.literal(key_value_pair_list: (a', b') list) : (a', b') map + +Constructs a map from a list of key-value pair tuples. + + + + + +```pascaligo +const moves: moveset = map + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1, 2); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0, 3); +end +``` + + + +```cameligo +let moves: moveset = Map.literal + [ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1, 2)) ; + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0, 3)) ; + ] +``` + + + +```reasonligo +let moves : moveset = + Map.literal([ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1, 2)), + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0, 3)), + ]); +``` + + +## Map.size(m: (a', b') map) : nat + +Get the size of a given map `m`. + + + + +```pascaligo +function size_ (const m : foobar) : nat is + block {skip} with (size(m)) +``` + +```cameligo +let size_ (m: foobar) : nat = Map.size m +``` + +```reasonligo +let size_ = (m: foobar): nat => Map.size(m); +``` + + From 0297b6033b93925bed156658d2b7ebb3dd353827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 3 Feb 2020 19:14:33 +0000 Subject: [PATCH 012/119] New typer: constants: use a tuple of arguments, + typechecking rules for constants --- src/passes/4-typer-new/solver.ml | 129 +++++++++++++++++++--------- src/passes/4-typer-new/typer.ml | 14 ++- src/passes/operators/operators.ml | 87 +++++++++---------- src/stages/typesystem/shorthands.ml | 7 ++ 4 files changed, 151 insertions(+), 86 deletions(-) diff --git a/src/passes/4-typer-new/solver.ml b/src/passes/4-typer-new/solver.ml index 7175fab54..a81f04f3c 100644 --- a/src/passes/4-typer-new/solver.ml +++ b/src/passes/4-typer-new/solver.ml @@ -346,6 +346,16 @@ module Wrap = struct P_variable unification_body])) ] @ arg' @ body' , whole_expr + (* This is pretty much a wrapper for an n-ary function. *) + let constant : O.type_value -> T.type_value list -> (constraints * T.type_variable) = + fun f args -> + let whole_expr = Core.fresh_type_variable () in + let args' = List.map type_expression_to_type_value args in + let args_tuple = O.P_constant (C_tuple , args') in + O.[ + C_equation (f , P_constant (C_arrow , [args_tuple ; P_variable whole_expr])) + ] , whole_expr + end (* begin unionfind *) @@ -727,47 +737,7 @@ let selector_break_ctor : (type_constraint_simpl, output_break_ctor) selector = | SC_Poly _ -> WasNotSelected (* TODO: ??? (beware: symmetry) *) | SC_Typeclass _ -> WasNotSelected -let propagator_break_ctor : output_break_ctor propagator = - fun selected dbs -> - let () = ignore (dbs) in (* this propagator doesn't need to use the dbs *) - let a = selected.a_k_var in - let b = selected.a_k'_var' in - (* produce constraints: *) - - (* a.tv = b.tv *) - let eq1 = C_equation (P_variable a.tv, P_variable b.tv) in - (* a.c_tag = b.c_tag *) - if a.c_tag <> b.c_tag then - failwith "type error: incompatible types, not same ctor" - else - (* a.tv_list = b.tv_list *) - if List.length a.tv_list <> List.length b.tv_list then - failwith "type error: incompatible types, not same length" - else - let eqs3 = List.map2 (fun aa bb -> C_equation (P_variable aa, P_variable bb)) a.tv_list b.tv_list in - let eqs = eq1 :: eqs3 in - (eqs , []) (* no new assignments *) - -(* TODO : with our selectors, the selection depends on the order in which the constraints are added :-( :-( :-( :-( - We need to return a lazy stream of constraints. *) - -type output_specialize1 = { poly : c_poly_simpl ; a_k_var : c_constructor_simpl } - - -let ( (function - [] -> 1 - | hd2::tl2 -> - f hd1 hd2 - compare_list f tl1 tl2) - | [] -> (function [] -> 0 | _::_ -> -1) (* This follows the behaviour of Pervasives.compare for lists of different length *) -let compare_type_variable a b = - Var.compare a b -let compare_label = function - | L_int a -> (function L_int b -> Int.compare a b | L_string _ -> -1) - | L_string a -> (function L_int _ -> 1 | L_string b -> String.compare a b) +(* TODO: move this to a more appropriate place and/or auto-generate it. *) let compare_simple_c_constant = function | C_arrow -> (function (* N/A -> 1 *) @@ -866,6 +836,83 @@ let compare_simple_c_constant = function | C_chain_id -> 0 (* N/A -> -1 *) ) + +(* Using a pretty-printer from the PP.ml module creates a dependency + loop, so the one that we need temporarily for debugging purposes + has been copied here. *) +let debug_pp_constant : _ -> constant_tag -> unit = fun ppf c_tag -> + let ct = match c_tag with + | Core.C_arrow -> "arrow" + | Core.C_option -> "option" + | Core.C_tuple -> "tuple" + | Core.C_record -> failwith "record" + | Core.C_variant -> failwith "variant" + | Core.C_map -> "map" + | Core.C_big_map -> "big_map" + | Core.C_list -> "list" + | Core.C_set -> "set" + | Core.C_unit -> "unit" + | Core.C_bool -> "bool" + | Core.C_string -> "string" + | Core.C_nat -> "nat" + | Core.C_mutez -> "mutez" + | Core.C_timestamp -> "timestamp" + | Core.C_int -> "int" + | Core.C_address -> "address" + | Core.C_bytes -> "bytes" + | Core.C_key_hash -> "key_hash" + | Core.C_key -> "key" + | Core.C_signature -> "signature" + | Core.C_operation -> "operation" + | Core.C_contract -> "contract" + | Core.C_chain_id -> "chain_id" + in + Format.fprintf ppf "%s" ct + +let debug_pp_c_constructor_simpl ppf { tv; c_tag; tv_list } = + Format.fprintf ppf "CTOR %a %a(%a)" Var.pp tv debug_pp_constant c_tag PP_helpers.(list_sep Var.pp (const " , ")) tv_list + +let propagator_break_ctor : output_break_ctor propagator = + fun selected dbs -> + let () = ignore (dbs) in (* this propagator doesn't need to use the dbs *) + let a = selected.a_k_var in + let b = selected.a_k'_var' in + (* produce constraints: *) + + (* a.tv = b.tv *) + let eq1 = C_equation (P_variable a.tv, P_variable b.tv) in + (* a.c_tag = b.c_tag *) + if (compare_simple_c_constant a.c_tag b.c_tag) <> 0 then + failwith (Format.asprintf "type error: incompatible types, not same ctor %a vs. %a (compare returns %d)" debug_pp_c_constructor_simpl a debug_pp_c_constructor_simpl b (compare_simple_c_constant a.c_tag b.c_tag)) + else + (* a.tv_list = b.tv_list *) + if List.length a.tv_list <> List.length b.tv_list then + failwith "type error: incompatible types, not same length" + else + let eqs3 = List.map2 (fun aa bb -> C_equation (P_variable aa, P_variable bb)) a.tv_list b.tv_list in + let eqs = eq1 :: eqs3 in + (eqs , []) (* no new assignments *) + +(* TODO : with our selectors, the selection depends on the order in which the constraints are added :-( :-( :-( :-( + We need to return a lazy stream of constraints. *) + +type output_specialize1 = { poly : c_poly_simpl ; a_k_var : c_constructor_simpl } + + +let ( (function + [] -> 1 + | hd2::tl2 -> + f hd1 hd2 + compare_list f tl1 tl2) + | [] -> (function [] -> 0 | _::_ -> -1) (* This follows the behaviour of Pervasives.compare for lists of different length *) +let compare_type_variable a b = + Var.compare a b +let compare_label = function + | L_int a -> (function L_int b -> Int.compare a b | L_string _ -> -1) + | L_string a -> (function L_int _ -> 1 | L_string b -> String.compare a b) let rec compare_typeclass a b = compare_list (compare_list compare_type_value) a b and compare_type_value = function | P_forall { binder=a1; constraints=a2; body=a3 } -> (function diff --git a/src/passes/4-typer-new/typer.ml b/src/passes/4-typer-new/typer.ml index 7eb46e26e..0f75c8bb6 100644 --- a/src/passes/4-typer-new/typer.ml +++ b/src/passes/4-typer-new/typer.ml @@ -889,6 +889,7 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e let e' = Environment.add_ez_binder (fst binder) fresh e in let%bind (result , state') = type_expression e' state result in + let () = Printf.printf "this does not make use of the typed body, this code sounds buggy." in let wrapped = Wrap.lambda fresh input_type' output_type' in return_wrapped (E_lambda {binder = fst binder; body=result}) (* TODO: is the type of the entire lambda enough to access the input_type=fresh; ? *) @@ -897,8 +898,17 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e | E_constant (name, lst) -> let () = ignore (name , lst) in - let _t = Operators.Typer.Operators_types.constant_type name in - Pervasives.failwith (Format.asprintf "TODO: E_constant (%a(%a))" Stage_common.PP.constant name (Format.pp_print_list Ast_simplified.PP.expression) lst) + let%bind t = Operators.Typer.Operators_types.constant_type name in + let aux acc expr = + let (lst , state) = acc in + let%bind (expr, state') = type_expression e state expr in + ok (expr::lst , state') in + let%bind (lst , state') = bind_fold_list aux ([], state) lst in + let lst_annot = List.map (fun (x : O.value) -> x.type_annotation) lst in + let wrapped = Wrap.constant t lst_annot in + return_wrapped + (E_constant (name, lst)) + state' wrapped (* let%bind lst' = bind_list @@ List.map (type_expression e) lst in let tv_lst = List.map get_type_annotation lst' in diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 3c2c91910..b61abbffe 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -320,51 +320,52 @@ module Typer = struct let tc_addargs a b c = tc [a;b;c] [ (*TODO…*) ] let t_none = forall "a" @@ fun a -> option a - let t_sub = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_subarg a b c] => a --> b --> c (* TYPECLASS *) + let t_sub = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_subarg a b c] => tuple2 a b --> c (* TYPECLASS *) let t_some = forall "a" @@ fun a -> a --> option a - let t_map_remove = forall2 "src" "dst" @@ fun src dst -> src --> map src dst --> map src dst - let t_map_add = forall2 "src" "dst" @@ fun src dst -> src --> dst --> map src dst --> map src dst - let t_map_update = forall2 "src" "dst" @@ fun src dst -> src --> option dst --> map src dst --> map src dst - let t_map_mem = forall2 "src" "dst" @@ fun src dst -> src --> map src dst --> bool - let t_map_find = forall2 "src" "dst" @@ fun src dst -> src --> map src dst --> dst - let t_map_find_opt = forall2 "src" "dst" @@ fun src dst -> src --> map src dst --> option dst - let t_map_fold = forall3 "src" "dst" "acc" @@ fun src dst acc -> ( ( (src * dst) * acc ) --> acc ) --> map src dst --> acc --> acc - let t_map_map = forall3 "k" "v" "result" @@ fun k v result -> ((k * v) --> result) --> map k v --> map k result + let t_map_remove = forall2 "src" "dst" @@ fun src dst -> tuple2 src (map src dst) --> map src dst + let t_map_add = forall2 "src" "dst" @@ fun src dst -> tuple3 src dst (map src dst) --> map src dst + let t_map_update = forall2 "src" "dst" @@ fun src dst -> tuple3 src (option dst) (map src dst) --> map src dst + let t_map_mem = forall2 "src" "dst" @@ fun src dst -> tuple2 src (map src dst) --> bool + let t_map_find = forall2 "src" "dst" @@ fun src dst -> tuple2 src (map src dst) --> dst + let t_map_find_opt = forall2 "src" "dst" @@ fun src dst -> tuple2 src (map src dst) --> option dst + let t_map_fold = forall3 "src" "dst" "acc" @@ fun src dst acc -> tuple3 ( ( (src * dst) * acc ) --> acc ) (map src dst) acc --> acc + let t_map_map = forall3 "k" "v" "result" @@ fun k v result -> tuple2 ((k * v) --> result) (map k v) --> map k result (* TODO: the type of map_map_fold might be wrong, check it. *) - let t_map_map_fold = forall4 "k" "v" "acc" "dst" @@ fun k v acc dst -> ( ((k * v) * acc) --> acc * dst ) --> map k v --> (k * v) --> (map k dst * acc) - let t_map_iter = forall2 "k" "v" @@ fun k v -> ( (k * v) --> unit ) --> map k v --> unit - let t_size = forall_tc "c" @@ fun c -> [tc_sizearg c] => c --> nat (* TYPECLASS *) - let t_slice = nat --> nat --> string --> string - let t_failwith = string --> unit - let t_get_force = forall2 "src" "dst" @@ fun src dst -> src --> map src dst --> dst - let t_int = nat --> int - let t_bytes_pack = forall_tc "a" @@ fun a -> [tc_packable a] => a --> bytes (* TYPECLASS *) - let t_bytes_unpack = forall_tc "a" @@ fun a -> [tc_packable a] => bytes --> a (* TYPECLASS *) - let t_hash256 = bytes --> bytes - let t_hash512 = bytes --> bytes - let t_blake2b = bytes --> bytes - let t_hash_key = key --> key_hash - let t_check_signature = key --> signature --> bytes --> bool - let t_sender = address - let t_source = address - let t_unit = unit - let t_amount = mutez - let t_address = address - let t_now = timestamp - let t_transaction = forall "a" @@ fun a -> a --> mutez --> contract a --> operation - let t_get_contract = forall "a" @@ fun a -> contract a - let t_abs = int --> nat - let t_cons = forall "a" @@ fun a -> a --> list a --> list a - let t_assertion = bool --> unit - let t_times = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_timargs a b c] => a --> b --> c (* TYPECLASS *) - let t_div = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_divargs a b c] => a --> b --> c (* TYPECLASS *) - let t_mod = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_modargs a b c] => a --> b --> c (* TYPECLASS *) - let t_add = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_addargs a b c] => a --> b --> c (* TYPECLASS *) - let t_set_mem = forall "a" @@ fun a -> a --> set a --> bool - let t_set_add = forall "a" @@ fun a -> a --> set a --> set a - let t_set_remove = forall "a" @@ fun a -> a --> set a --> set a - let t_not = bool --> bool + let t_map_map_fold = forall4 "k" "v" "acc" "dst" @@ fun k v acc dst -> tuple3 ( ((k * v) * acc) --> acc * dst ) (map k v) (k * v) --> (map k dst * acc) + let t_map_iter = forall2 "k" "v" @@ fun k v -> tuple2 ( (k * v) --> unit ) (map k v) --> unit + let t_size = forall_tc "c" @@ fun c -> [tc_sizearg c] => tuple1 c --> nat (* TYPECLASS *) + let t_slice = tuple3 nat nat string --> string + let t_failwith = tuple1 string --> unit + let t_get_force = forall2 "src" "dst" @@ fun src dst -> tuple2 src (map src dst) --> dst + let t_int = tuple1 nat --> int + let t_bytes_pack = forall_tc "a" @@ fun a -> [tc_packable a] => tuple1 a --> bytes (* TYPECLASS *) + let t_bytes_unpack = forall_tc "a" @@ fun a -> [tc_packable a] => tuple1 bytes --> a (* TYPECLASS *) + let t_hash256 = tuple1 bytes --> bytes + let t_hash512 = tuple1 bytes --> bytes + let t_blake2b = tuple1 bytes --> bytes + let t_hash_key = tuple1 key --> key_hash + let t_check_signature = tuple3 key signature bytes --> bool + let t_chain_id = tuple0 --> chain_id + let t_sender = tuple0 --> address + let t_source = tuple0 --> address + let t_unit = tuple0 --> unit + let t_amount = tuple0 --> mutez + let t_address = tuple0 --> address + let t_now = tuple0 --> timestamp + let t_transaction = forall "a" @@ fun a -> tuple3 a mutez (contract a) --> operation + let t_get_contract = forall "a" @@ fun a -> tuple0 --> contract a + let t_abs = tuple1 int --> nat + let t_cons = forall "a" @@ fun a -> a --> tuple1 (list a) --> list a + let t_assertion = tuple1 bool --> unit + let t_times = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_timargs a b c] => tuple2 a b --> c (* TYPECLASS *) + let t_div = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_divargs a b c] => tuple2 a b --> c (* TYPECLASS *) + let t_mod = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_modargs a b c] => tuple2 a b --> c (* TYPECLASS *) + let t_add = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_addargs a b c] => tuple2 a b --> c (* TYPECLASS *) + let t_set_mem = forall "a" @@ fun a -> tuple2 a (set a) --> bool + let t_set_add = forall "a" @@ fun a -> tuple2 a (set a) --> set a + let t_set_remove = forall "a" @@ fun a -> tuple2 a (set a) --> set a + let t_not = tuple1 bool --> bool let constant_type : constant -> Typesystem.Core.type_value result = function | C_INT -> ok @@ t_int ; @@ -438,7 +439,7 @@ module Typer = struct | C_BLAKE2b -> ok @@ t_blake2b ; | C_HASH_KEY -> ok @@ t_hash_key ; | C_CHECK_SIGNATURE -> ok @@ t_check_signature ; - | C_CHAIN_ID -> ok @@ failwith "t_chain_id" ; + | C_CHAIN_ID -> ok @@ t_chain_id ; (*BLOCKCHAIN *) | C_CONTRACT -> ok @@ t_get_contract ; | C_CONTRACT_ENTRYPOINT -> ok @@ failwith "t_get_entrypoint" ; diff --git a/src/stages/typesystem/shorthands.ml b/src/stages/typesystem/shorthands.ml index 44af59ad9..109b7b15b 100644 --- a/src/stages/typesystem/shorthands.ml +++ b/src/stages/typesystem/shorthands.ml @@ -54,6 +54,7 @@ let mutez = P_constant (C_mutez , []) let timestamp = P_constant (C_timestamp , []) let int = P_constant (C_int , []) let address = P_constant (C_address , []) +let chain_id = P_constant (C_chain_id , []) let bytes = P_constant (C_bytes , []) let key = P_constant (C_key , []) let key_hash = P_constant (C_key_hash , []) @@ -61,3 +62,9 @@ let signature = P_constant (C_signature , []) let operation = P_constant (C_operation , []) let contract t = P_constant (C_contract , [t]) let ( * ) a b = pair a b + +(* These are used temporarily to de-curry functions that correspond to Michelson operators *) +let tuple0 = P_constant (C_tuple , []) +let tuple1 a = P_constant (C_tuple , [a]) +let tuple2 a b = P_constant (C_tuple , [a; b]) +let tuple3 a b c = P_constant (C_tuple , [a; b; c]) From 795f0d40568e1db1ee5f0ee335e3fd63a58fcee9 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Tue, 4 Feb 2020 13:31:41 +0100 Subject: [PATCH 013/119] ReasonLIGO: missing ')' error message. --- src/bin/expect_tests/error_messages_tests.ml | 16 ++++++++++++++++ .../reasonligo/error.messages.checked-in | 2 +- src/test/contracts/negative/missing_rpar.religo | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/test/contracts/negative/missing_rpar.religo diff --git a/src/bin/expect_tests/error_messages_tests.ml b/src/bin/expect_tests/error_messages_tests.ml index cf800a6ac..190afda5d 100644 --- a/src/bin/expect_tests/error_messages_tests.ml +++ b/src/bin/expect_tests/error_messages_tests.ml @@ -21,3 +21,19 @@ let%expect_test _ = * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new * Check the changelog by running 'ligo changelog' |} ] ; +let%expect_test _ = + run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/missing_rpar.religo" ; "main" ] ; + [%expect {| + ligo: : Parse error in file "missing_rpar.religo", line 5, characters 0-3, after "m" and before "let": + Missing `)`. + {} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ; + diff --git a/src/passes/1-parser/reasonligo/error.messages.checked-in b/src/passes/1-parser/reasonligo/error.messages.checked-in index 06d8635c9..43720b2f3 100644 --- a/src/passes/1-parser/reasonligo/error.messages.checked-in +++ b/src/passes/1-parser/reasonligo/error.messages.checked-in @@ -2619,7 +2619,7 @@ interactive_expr: True LPAR True VBAR ## In state 219, spurious reduction of production expr -> base_cond__open(expr) ## - +Missing `)`. interactive_expr: True LPAR WILD ## diff --git a/src/test/contracts/negative/missing_rpar.religo b/src/test/contracts/negative/missing_rpar.religo new file mode 100644 index 000000000..452c0ad1c --- /dev/null +++ b/src/test/contracts/negative/missing_rpar.religo @@ -0,0 +1,5 @@ +type foo = big_map(int, int); + +let test_case = (n: int, m: foo): foo => Big_map.update(23, Some(n), m + +let z = 4; \ No newline at end of file From 0f9b92b83fcb01030e2f9d017ab081bb81584110 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Tue, 4 Feb 2020 14:02:57 +0100 Subject: [PATCH 014/119] Oops. --- src/bin/expect_tests/error_messages_tests.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bin/expect_tests/error_messages_tests.ml b/src/bin/expect_tests/error_messages_tests.ml index 190afda5d..284b21e89 100644 --- a/src/bin/expect_tests/error_messages_tests.ml +++ b/src/bin/expect_tests/error_messages_tests.ml @@ -21,7 +21,6 @@ let%expect_test _ = * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new * Check the changelog by running 'ligo changelog' |} ] ; -let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/missing_rpar.religo" ; "main" ] ; [%expect {| ligo: : Parse error in file "missing_rpar.religo", line 5, characters 0-3, after "m" and before "let": From 04daf776d3f84105cbc0c23bf5cb04736edc0e9d Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Tue, 4 Feb 2020 23:08:47 -0800 Subject: [PATCH 015/119] Add rough draft of big map reference page to docs --- gitlab-pages/docs/reference/big_map.md | 184 +++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 gitlab-pages/docs/reference/big_map.md diff --git a/gitlab-pages/docs/reference/big_map.md b/gitlab-pages/docs/reference/big_map.md new file mode 100644 index 000000000..861429c34 --- /dev/null +++ b/gitlab-pages/docs/reference/big_map.md @@ -0,0 +1,184 @@ +--- +id: big-map-reference +title: Big Map +--- + +## Big_map.find_opt(k: a', m: (a',b') big_map) : b' option + +Retrieve the value associated with a particular key. This version returns an option +which can either shift logic in response to a missing value or throw an error. + + + +```pascaligo +const my_balance : option(move) = + moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] +``` + + + +```cameligo +let my_balance : move option = + Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves +``` + + + +```reasonligo +let my_balance : option(move) = + Big_map.find_opt("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); +``` + + +## Big_map.find(k: a', m: (a', b') big_map) : b' + +Forcefully retrieve the value associated with a particular key. If that value +doesn't exist, this function throws an error. + + + +```pascaligo +const my_balance : move = + get_force (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves); +``` + + + +```cameligo +let my_balance : move = + Big_map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves +``` + + + +```reasonligo +let my_balance : move = + Big_map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); +``` + + + +## Big_map.update(k: a', v: b', m: (a', b') big_map) : (a', b') big_map + +Change the value associated with a particular key, if that value doesn't already +exist add it. + + + + + +The values of a PascaLIGO big map can be updated using the ordinary +assignment syntax: + +```pascaligo + +function set_ (var m : moveset) : moveset is + block { + m [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9); + } with m +``` + + + +```cameligo +let updated_map : moveset = + Big_map.update ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) (Some (4,9)) moves +``` + + + +```reasonligo +let updated_map : moveset = + Big_map.update(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some((4,9)), moves); +``` + + + +## Big_map.add(k: a', v: b', m: (a', b') big_map) : (a', b') big_map + +## Big_map.remove(k: a', m: (a', b') big_map) : (a', b') big_map + +Remove a key and its associated value from the big map. + + + + +```pascaligo +function rm (var m : foo) : foo is block { + remove 42 from map m; +} with m +``` + + +```cameligo +let rm (m : foo) : foo = Big_map.remove 42 m +``` + + +```reasonligo +let rm = (m: foo): foo => Big_map.remove(42, m); +``` + + + +## Big_map.literal(key_value_pair_list: (a', b') list) : (a', b') big_map + +Constructs a big map from a list of key-value pair tuples. + + + + +```pascaligo +const moves: moveset = + big_map + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1,2); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0,3); + end +``` + + + +```cameligo +let moves: moveset = + Big_map.literal [ + (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1,2)); + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0,3)); + ] +``` + + + +```reasonligo +let moves: moveset = + Big_map.literal ([ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1,2)), + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0,3)), + ]); +``` + + + + +## Big_map.empty() : (a', b') big_map + +Create an empty big map. + + + + +```pascaligo +const empty_big_map : big_map(int,int) = big_map end +``` + + +```cameligo +let empty_map : foo = Big_map.empty +``` + + +```reasonligo +let empty_map: foo = Big_map.empty; +``` + + + From 410bbb0723a73adca2df3a3040098901d72d4062 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Wed, 5 Feb 2020 16:28:40 +0100 Subject: [PATCH 016/119] Complete rewrite of the documentation. --- .../docs/advanced/entrypoints-contracts.md | 497 ++++++---- .../src/entrypoints-contracts/amount.ligo | 4 - .../src/entrypoints-contracts/owner.ligo | 5 - .../transaction/counter.ligo | 9 - .../transaction/counter.types.ligo | 4 - .../transaction/proxy.ligo | 14 - .../advanced/src/timestamps/timestamp.ligo | 9 - .../docs/advanced/timestamps-addresses.md | 141 +-- .../docs/language-basics/boolean-if-else.md | 202 ++-- .../docs/language-basics/functions.md | 171 +++- gitlab-pages/docs/language-basics/loops.md | 245 +++-- .../docs/language-basics/maps-records.md | 932 +++++++++++------- .../docs/language-basics/math-numbers-tez.md | 256 +++-- .../docs/language-basics/sets-lists-tuples.md | 738 ++++++++------ .../src/boolean-if-else/cond.ligo | 4 + .../src/boolean-if-else/cond.mligo | 4 + .../src/boolean-if-else/cond.religo | 4 + .../src/boolean-if-else/if-else.ligo | 4 - .../language-basics/src/functions/add.ligo | 4 - .../language-basics/src/functions/anon.ligo | 7 +- .../language-basics/src/functions/anon.mligo | 2 + .../language-basics/src/functions/anon.religo | 2 + .../src/functions/blockless.ligo | 2 +- .../src/functions/blockless.mligo | 1 + .../src/functions/blockless.religo | 1 + .../language-basics/src/functions/curry.mligo | 3 + .../language-basics/src/loops/collection.ligo | 22 + .../docs/language-basics/src/loops/gcd.ligo | 14 + .../docs/language-basics/src/loops/gcd.mligo | 7 + .../docs/language-basics/src/loops/gcd.religo | 7 + .../docs/language-basics/src/loops/sum.ligo | 6 + .../src/maps-records/record_patch.ligo | 10 + .../src/maps-records/record_patch2.ligo | 9 + .../src/maps-records/record_simu.ligo | 8 + .../src/maps-records/record_update.ligo | 7 + .../src/maps-records/record_update.mligo | 7 + .../src/maps-records/record_update.religo | 7 + .../src/math-numbers-tez/addition.ligo | 13 - .../src/math-numbers-tez/casting.ligo | 2 - .../src/math-numbers-tez/division.ligo | 5 - .../src/math-numbers-tez/isnat.ligo | 1 - .../src/math-numbers-tez/multiplication.ligo | 3 - .../src/math-numbers-tez/substraction.ligo | 6 - .../empty-set.ligo | 0 .../src/sets-lists-tuples/lists.ligo | 12 + .../src/sets-lists-tuples/sets.ligo | 28 + .../src/sets-lists-tuples/sets.mligo | 16 + .../src/sets-lists-tuples/sets.religo | 16 + .../language-basics/src/strings/concat.ligo | 1 - .../docs/language-basics/src/types/alias.ligo | 2 - .../language-basics/src/types/annotation.ligo | 4 - .../src/types/composed-types.ligo | 19 - .../src/types/simple-type.ligo | 11 +- .../unit-option-pattern-matching/flip.ligo | 7 + .../src/variables-and-constants/add.ligo | 11 +- .../src/variables-and-constants/add.mligo | 2 + .../src/variables-and-constants/add.religo | 4 +- .../src/variables-and-constants/const.mligo | 1 + gitlab-pages/docs/language-basics/strings.md | 61 +- .../docs/language-basics/tezos-specific.md | 133 +-- gitlab-pages/docs/language-basics/types.md | 196 ++-- .../unit-option-pattern-matching.md | 248 +++-- .../variables-and-constants.md | 111 ++- src/bin/expect_tests/lexer_tests.ml | 6 +- 64 files changed, 2633 insertions(+), 1655 deletions(-) delete mode 100644 gitlab-pages/docs/advanced/src/entrypoints-contracts/amount.ligo delete mode 100644 gitlab-pages/docs/advanced/src/entrypoints-contracts/owner.ligo delete mode 100644 gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.ligo delete mode 100644 gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.types.ligo delete mode 100644 gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/proxy.ligo delete mode 100644 gitlab-pages/docs/advanced/src/timestamps/timestamp.ligo create mode 100644 gitlab-pages/docs/language-basics/src/boolean-if-else/cond.ligo create mode 100644 gitlab-pages/docs/language-basics/src/boolean-if-else/cond.mligo create mode 100644 gitlab-pages/docs/language-basics/src/boolean-if-else/cond.religo delete mode 100644 gitlab-pages/docs/language-basics/src/boolean-if-else/if-else.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/functions/add.ligo create mode 100644 gitlab-pages/docs/language-basics/src/functions/anon.mligo create mode 100644 gitlab-pages/docs/language-basics/src/functions/anon.religo create mode 100644 gitlab-pages/docs/language-basics/src/functions/blockless.mligo create mode 100644 gitlab-pages/docs/language-basics/src/functions/blockless.religo create mode 100644 gitlab-pages/docs/language-basics/src/functions/curry.mligo create mode 100644 gitlab-pages/docs/language-basics/src/loops/collection.ligo create mode 100644 gitlab-pages/docs/language-basics/src/loops/gcd.ligo create mode 100644 gitlab-pages/docs/language-basics/src/loops/gcd.mligo create mode 100644 gitlab-pages/docs/language-basics/src/loops/gcd.religo create mode 100644 gitlab-pages/docs/language-basics/src/loops/sum.ligo create mode 100644 gitlab-pages/docs/language-basics/src/maps-records/record_patch.ligo create mode 100644 gitlab-pages/docs/language-basics/src/maps-records/record_patch2.ligo create mode 100644 gitlab-pages/docs/language-basics/src/maps-records/record_simu.ligo create mode 100644 gitlab-pages/docs/language-basics/src/maps-records/record_update.ligo create mode 100644 gitlab-pages/docs/language-basics/src/maps-records/record_update.mligo create mode 100644 gitlab-pages/docs/language-basics/src/maps-records/record_update.religo delete mode 100644 gitlab-pages/docs/language-basics/src/math-numbers-tez/addition.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/math-numbers-tez/casting.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/math-numbers-tez/division.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/math-numbers-tez/isnat.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/math-numbers-tez/multiplication.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/math-numbers-tez/substraction.ligo rename gitlab-pages/docs/language-basics/src/{sets-lists-touples => sets-lists-tuples}/empty-set.ligo (100%) create mode 100644 gitlab-pages/docs/language-basics/src/sets-lists-tuples/lists.ligo create mode 100644 gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo create mode 100644 gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo create mode 100644 gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo delete mode 100644 gitlab-pages/docs/language-basics/src/strings/concat.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/types/alias.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/types/annotation.ligo delete mode 100644 gitlab-pages/docs/language-basics/src/types/composed-types.ligo create mode 100644 gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.ligo create mode 100644 gitlab-pages/docs/language-basics/src/variables-and-constants/add.mligo create mode 100644 gitlab-pages/docs/language-basics/src/variables-and-constants/const.mligo diff --git a/gitlab-pages/docs/advanced/entrypoints-contracts.md b/gitlab-pages/docs/advanced/entrypoints-contracts.md index dff0a535a..c105d08f6 100644 --- a/gitlab-pages/docs/advanced/entrypoints-contracts.md +++ b/gitlab-pages/docs/advanced/entrypoints-contracts.md @@ -1,173 +1,227 @@ --- id: entrypoints-contracts -title: Entrypoints, Contracts +title: Entrypoints to Contracts --- ## Entrypoints -Each LIGO smart contract is essentially a single main function, referring to the following types: +A LIGO contract is made of a series of constant and function +declarations. Only functions having a special type can be called when +the contract is activated: they are called *entrypoints*. An +entrypoint need to take two parameters, the *contract parameter* and +the *on-chain storage*, and return a pair made of a *list of +operations* and a (new) storage. + +When the contract is originated, the initial value of the storage is +provided. When and entrypoint is later called, only the parameter is +provided, but the type of an entrypoint contains both. + +The type of the contract parameter and the storage are up to the +contract designer, but the type for list operations is not. The return +type of an entrypoint is as follows, assuming that the type `storage` +has been defined elsewhere. (Note that you can use any type with any +name for the storage.) +```pascaligo skip +type storage is ... // Any name, any type +type return is list (operation) * storage +``` + + +```cameligo skip +type storage = ... // Any name, any type +type return = operation list * storage +``` + + +```reasonligo skip +type storage = ...; // Any name, any type +type return = (list (operation), storage); +``` + + +The contract storage can only be modified by activating an +entrypoint. It is important to understand what that means. What it +does *not* mean is that some global variable holding the storage is +modified by the entrypoint. Instead, what it *does* mean is that, +given the state of the storage *on-chain*, an entrypoint specifies how +to create another state for it, depending on a parameter. + +Here is an example where the storage is a single natural number that +is updated by the parameter. + + + + + ```pascaligo group=a -type parameter_t is unit -type storage_t is unit -type return_t is (list(operation) * storage_t) +type storage is nat +type return is list (operation) * storage + +function save (const parameter : nat; const store : storage) : return is + ((nil : list (operation)), parameter) ``` ```cameligo group=a -type parameter_t = unit -type storage_t = unit -type return_t = (operation list * storage_t) +type storage = nat + +let save (parameter, store: nat * storage) : return = + (([] : operation list), parameter) ``` ```reasonligo group=a -type parameter_t = unit; -type storage_t = unit; -type return_t = (list(operation) , storage_t); -``` - +type storage = nat; -Each main function receives two arguments: -- `parameter` - this is the parameter received in the invocation operation -- `storage` - this is the current (real) on-chain storage value - -Storage can only be modified by running the smart contract entrypoint, which is responsible for returning a pair holding a list of operations, and a new storage. - -Here is an example of a smart contract main function: - -> 💡 The contract below literally does *nothing* - - - -```pascaligo group=a -function main(const parameter: parameter_t; const store: storage_t): return_t is - ((nil : list(operation)), store) -``` - - -```cameligo group=a -let main (parameter, store: parameter_t * storage_t) : return_t = - (([]: operation list), store) -``` - - -```reasonligo group=a -let main = ((parameter, store): (parameter_t, storage_t)) : return_t => { - (([]: list(operation)), store); +let main = ((parameter, store): (nat, storage)) : return => { + (([] : list (operation)), parameter); }; ``` -A contract entrypoints are the constructors of the parameter type (variant) and you must use pattern matching (`case`, `match`, `switch`) on the parameter in order to associate each entrypoint to its corresponding handler. +In LIGO, the design pattern for entrypoints consists in actually +having exactly *one entrypoint*, like the `main` function in C. The +parameter of the contract is then a variant type, and, depending on +the constructors of that type, different functions in the contract are +called. In other terms, the unique entrypoint dispatches the control +flow depending on a *pattern matching* on the contract parameter. -To access the 'entrypoints' of a contract, we define a main function whose parameter is a variant type with constructors for each entrypoint. This allows us to satisfy the requirement that LIGO contracts always begin execution from the same function. The main function simply takes this variant, pattern matches it to determine which entrypoint to dispatch the call to, then returns the result of executing that entrypoint with the projected arguments. - -> The LIGO variant's are compiled to a Michelson annotated tree of union type. +In the following example, the storage contains a counter (of type +`nat`) and a name (of type `string`). Depending on the parameter of +the contract, either the counter or the name is updated. - -```pascaligo group=recordentry -type parameter_t is - | Entrypoint_a of int - | Entrypoint_b of string -type storage_t is unit -type return_t is (list(operation) * storage_t) -function handle_a (const p : int; const store : storage_t) : return_t is - ((nil : list(operation)), store) - -function handle_b (const p : string; const store : storage_t) : return_t is - ((nil : list(operation)), store) - -function main(const parameter: parameter_t; const store: storage_t): return_t is - case parameter of - | Entrypoint_a (p) -> handle_a(p,store) - | Entrypoint_b (p) -> handle_b(p,store) -end -``` - - -```cameligo group=recordentry -type parameter_t = - | Entrypoint_a of int - | Entrypoint_b of string -type storage_t = unit -type return_t = (operation list * storage_t) - -let handle_a (parameter, store: int * storage_t) : return_t = - (([]: operation list), store) - -let handle_b (parameter, store: string * storage_t) : return_t = - (([]: operation list), store) - -let main (parameter, store: parameter_t * storage_t) : return_t = - match parameter with - | Entrypoint_a p -> handle_a (p,store) - | Entrypoint_b p -> handle_b (p,store) -``` - - -```reasonligo group=recordentry -type parameter_t = - | Entrypoint_a(int) - | Entrypoint_b(string); -type storage_t = unit; -type return_t = (list(operation) , storage_t); - -let handle_a = ((parameter, store): (int, storage_t)) : return_t => { - (([]: list(operation)), store); }; - -let handle_b = ((parameter, store): (string, storage_t)) : return_t => { - (([]: list(operation)), store); }; - -let main = ((parameter, store): (parameter_t, storage_t)) : return_t => { - switch (parameter) { - | Entrypoint_a(p) => handle_a((p,store)) - | Entrypoint_b(p) => handle_b((p,store)) - } -}; -``` - - - -## Built-in contract variables - -Each LIGO smart contract deployed on the Tezos blockchain, has access to certain built-in variables/constants that can be used to determine a range -of useful things. In this section you'll find how those built-ins can be utilized. - -### Accepting/declining money in a smart contract - -This example shows how `amount` and `failwith` can be used to decline a transaction that sends more tez than `0mutez`. - - ```pascaligo group=b -function main (const p : unit ; const s : unit) : (list(operation) * unit) is - block { - if amount > 0mutez then failwith("This contract does not accept tez") else skip - } with ((nil : list(operation)), unit); +type parameter is + Entrypoint_A of nat +| Entrypoint_B of string + +type storage is record [ + counter : nat; + name : string +] + +type return is list (operation) * storage + +function handle_A (const n : nat; const store : storage) : return is + ((nil : list (operation)), store with record [counter = n]) + +function handle_B (const s : string; const store : storage) : return is + ((nil : list (operation)), store with record [name = s]) + +function main (const param : parameter; const store : storage): return is + case param of + Entrypoint_A (n) -> handle_A (n, store) + | Entrypoint_B (s) -> handle_B (s, store) + end ``` ```cameligo group=b -let main (p, s: unit * unit) : operation list * unit = - if amount > 0mutez - then (failwith "This contract does not accept tez": operation list * unit) - else (([]: operation list), unit) +type parameter = + Entrypoint_A of nat +| Entrypoint_B of string + +type storage = { + counter : nat; + name : string +} + +type return = operation list * storage + +let handle_A (n, store : nat * storage) : return = + ([] : operation list), {store with counter = n} + +let handle_B (s, store : string * storage) : return = + ([] : operation list), {store with name = s} + +let main (param, store: parameter * storage) : return = + match param with + Entrypoint_A n -> handle_A (n, store) + | Entrypoint_B s -> handle_B (s, store) ``` ```reasonligo group=b -let main = ((p,s): (unit, unit)) : (list(operation), unit) => { - if (amount > 0mutez) { - (failwith("This contract does not accept tez"): (list(operation), unit)); +type parameter = +| Entrypoint_A (nat) +| Entrypoint_B (string); + +type storage = { + counter : nat, + name : string +}; + +type return = (list (operation), storage); + +let handle_A = ((n, store): (nat, storage)) : return => { + (([] : list (operation)), {...store, counter : n}); }; + +let handle_B = ((s, store): (string, storage)) : return => { + (([] : list (operation)), {...store, name : s}); }; + +let main = ((param, store): (parameter, storage)) : return => { + switch (param) { + | Entrypoint_A (n) => handle_A ((n, store)) + | Entrypoint_B (s) => handle_B ((s, store)) } - else { - (([]: list(operation)), ()); - }; +}; +``` + + + +## Tezos-specific Built-ins + +A LIGO smart contract can query part of the state of the Tezos +blockchain by means of built-in values. In this section you will find +how those built-ins can be utilized. + +### Accepting or Declining Tokens in a Smart Contract + +This example shows how `amount` and `failwith` can be used to decline +any transaction that sends more tez than `0mutez`, that is, no +incoming tokens are accepted. + + + +```pascaligo group=c +type parameter is unit +type storage is unit +type return is list (operation) * storage + +function deny (const param : parameter; const store : storage) : return is + if amount > 0mutez then + (failwith ("This contract does not accept tokens.") : return) + else ((nil : list (operation)), store) +``` + + +```cameligo group=c +type parameter = unit +type storage = unit +type return = operation list * storage + +let deny (param, store : parameter * storage) : return = + if amount > 0mutez then + (failwith "This contract does not accept tokens.": return) + else (([] : operation list), store) +``` + + +```reasonligo group=c +type parameter = unit; +type storage = unit; +type return = (list (operation), storage); + +let deny = ((param, store): (parameter, storage)) : return => { + if (amount > 0mutez) { + (failwith("This contract does not accept tokens."): return); } + else { (([] : list (operation)), store); }; }; ``` @@ -180,128 +234,165 @@ This example shows how `sender` or `source` can be used to deny access to an ent ```pascaligo group=c -const owner: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); -function main (const p : unit ; const s : unit) : (list(operation) * unit) is - block { - if source =/= owner then failwith("This address can't call the contract") else skip - } with ((nil : list(operation)), unit); +const owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); + +function filter (const param : parameter; const store : storage) : return is + if source =/= owner then (failwith ("Access denied.") : return) + else ((nil : list(operation)), store) ``` ```cameligo group=c -let owner: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -let main (p,s: unit * unit) : operation list * unit = - if source <> owner - then (failwith "This address can't call the contract": operation list * unit) - else (([]: operation list), ()) +let owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) + +let filter (param, store: parameter * storage) : return = + if source <> owner then (failwith "Access denied." : return) + else (([] : operation list), store) ``` ```reasonligo group=c -let owner: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); -let main = ((p,s): (unit, unit)) : (list(operation), unit) => { - if (source != owner) { - (failwith("This address can't call the contract"): (list(operation), unit)); - } - else { - (([]: list(operation)), ()); - }; +let owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); + +let main = ((param, store): (parameter, storage)) : storage => { + if (source != owner) { (failwith ("Access denied.") : return); } + else { (([] : list (operation)), store); }; }; ``` -### Cross contract calls +### Inter-Contract Invocations -This example shows how a contract can invoke another contract by emiting a transaction operation at the end of an entrypoint. +It would be somewhat misleading to speak of "contract calls", as this +wording may wrongly suggest an analogy between contract "calls" and +function "calls". Indeed, the control flow returns to the site of a +function call, and composed function calls therefore are *stacked*, +that is, they follow a last in, first out ordering. This is not what +happens when a contract invokes another: the invocation is *queued*, +that is, follows a first in, first our ordering, and the dequeuing +only starts at the normal end of a contract (no failure). That is why +we speak of "contract invocations" instead of "calls". -> The same technique can be used to transfer tez to an implicit account (tz1, ...), all you have to do is use `unit` instead of a parameter for a smart contract. +The following example shows how a contract can invoke another by +emiting a transaction operation at the end of an entrypoint. -In our case, we have a `counter.ligo` contract that accepts a parameter of type `action`, and we have a `proxy.ligo` contract that accepts the same parameter type, and forwards the call to the deployed counter contract. +> The same technique can be used to transfer tokens to an implicit +> account (tz1, ...): all you have to do is use a unit value as the +> parameter of the smart contract. + +In our case, we have a `counter.ligo` contract that accepts a +parameter of type `action`, and we have a `proxy.ligo` contract that +accepts the same parameter type, and forwards the call to the deployed +counter contract. + ```pascaligo skip // counter.ligo -type action is -| Increment of int -| Decrement of int -| Reset of unit +type parameter is + Increment of nat +| Decrement of nat +| Reset +type storage is unit + +type return is list (operation) * storage ``` -```pascaligo skip +```pascaligo group=d // proxy.ligo -type action is -| Increment of int -| Decrement of int -| Reset of unit +type parameter is + Increment of nat +| Decrement of nat +| Reset -const dest: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address); +type storage is unit -function proxy(const param: action; const store: unit): (list(operation) * unit) - is block { - const counter: contract(action) = get_contract(dest); - // re-use the param passed to the proxy in the subsequent transaction - // e.g.: - // const mockParam: action = Increment(5); - const op: operation = transaction(param, 0mutez, counter); - const opList: list(operation) = list op; end; - } with (opList, store) +type return is list (operation) * storage + +const dest : address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3" : address) + +function proxy (const param : parameter; const store : storage): return is + block { + const counter : contract (parameter) = get_contract (dest); + (* Reuse the parameter in the subsequent + transaction or use another one, `mock_param`. *) + const mock_param : parameter = Increment (5n); + const op : operation = transaction (param, 0mutez, counter); + const ops : list (operation) = list [op] + } with (ops, store) ``` + -```cameligo +```cameligo skip // counter.mligo -type action = -| Increment of int -| Decrement of int -| Reset of unit + +type paramater = + Increment of nat +| Decrement of nat +| Reset // ... ``` -```cameligo +```cameligo group=d // proxy.mligo -type action = -| Increment of int -| Decrement of int -| Reset of unit +type parameter = + Increment of nat +| Decrement of nat +| Reset -let dest: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address) +type storage = unit -let proxy (param, storage: action * unit): operation list * unit = - let counter: action contract = Operation.get_contract dest in - let op: operation = Operation.transaction param 0mutez counter in - [op], storage +type return = operation list * storage + +let dest : address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3" : address) + +let proxy (param, store : parameter * storage) : return = + let counter : parameter contract = Operation.get_contract dest in + (* Reuse the parameter in the subsequent + transaction or use another one, `mock_param`. *) + let mock_param : parameter = Increment (5n) in + let op : operation = Operation.transaction param 0mutez counter + in [op], store ``` -```reasonligo +```reasonligo skip // counter.religo -type action = - | Increment(int) - | Decrement(int) - | Reset(unit); +type parameter = +| Increment (nat) +| Decrement (nat) +| Reset // ... ``` -```reasonligo +```reasonligo group=d // proxy.religo -type action = - | Increment(int) - | Decrement(int) - | Reset(unit); +type parameter = +| Increment (nat) +| Decrement (nat) +| Reset; -let dest: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address); +type storage = unit; -let proxy = ((param, s): (action, unit)): (list(operation), unit) => - let counter: contract(action) = Operation.get_contract(dest); - let op: operation = Operation.transaction(param, 0mutez, counter); - ([op], s); +type return = (list (operation), storage); + +let dest : address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3" : address); + +let proxy = ((param, store): (parameter, storage)) : return => + let counter : contract (parameter) = Operation.get_contract (dest); + (* Reuse the parameter in the subsequent + transaction or use another one, `mock_param`. *) + let mock_param : parameter = Increment (5n); + let op : operation = Operation.transaction (param, 0mutez, counter); + ([op], store); ``` diff --git a/gitlab-pages/docs/advanced/src/entrypoints-contracts/amount.ligo b/gitlab-pages/docs/advanced/src/entrypoints-contracts/amount.ligo deleted file mode 100644 index fce71cde2..000000000 --- a/gitlab-pages/docs/advanced/src/entrypoints-contracts/amount.ligo +++ /dev/null @@ -1,4 +0,0 @@ -function main (const p : unit ; const s : unit) : (list(operation) * unit) is - block { - if amount > 0mutez then failwith("This contract does not accept tez") else skip - } with ((nil : list(operation)), unit); \ No newline at end of file diff --git a/gitlab-pages/docs/advanced/src/entrypoints-contracts/owner.ligo b/gitlab-pages/docs/advanced/src/entrypoints-contracts/owner.ligo deleted file mode 100644 index b35b7c9fc..000000000 --- a/gitlab-pages/docs/advanced/src/entrypoints-contracts/owner.ligo +++ /dev/null @@ -1,5 +0,0 @@ -const owner: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); -function main (const p : unit ; const s : unit) : (list(operation) * unit) is - block { - if source =/= owner then failwith("This address can't call the contract") else skip - } with ((nil : list(operation)), unit); \ No newline at end of file diff --git a/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.ligo b/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.ligo deleted file mode 100644 index 0c5f0c6d7..000000000 --- a/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.ligo +++ /dev/null @@ -1,9 +0,0 @@ -#include "counter.types.ligo" - -function counter (const p : action ; const s : int): (list(operation) * int) is - block { skip } with ((nil : list(operation)), - case p of - | Increment(n) -> s + n - | Decrement(n) -> s - n - | Reset(n) -> 0 - end) \ No newline at end of file diff --git a/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.types.ligo b/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.types.ligo deleted file mode 100644 index be37bbf30..000000000 --- a/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/counter.types.ligo +++ /dev/null @@ -1,4 +0,0 @@ -type action is -| Increment of int -| Decrement of int -| Reset of unit \ No newline at end of file diff --git a/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/proxy.ligo b/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/proxy.ligo deleted file mode 100644 index 47b7b1f64..000000000 --- a/gitlab-pages/docs/advanced/src/entrypoints-contracts/transaction/proxy.ligo +++ /dev/null @@ -1,14 +0,0 @@ -#include "counter.types.ligo" - -// Replace the following address with your deployed counter contract address -const address: address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3": address); - -function proxy(const param: action; const store: unit): (list(operation) * unit) - is block { - const counter: contract(action) = get_contract(address); - // re-use the param passed to the proxy in the subsequent transaction - // e.g.: - // const mockParam: action = Increment(5); - const op: operation = transaction(param, 0mutez, counter); - const opList: list(operation) = list op; end; - } with (opList, store) \ No newline at end of file diff --git a/gitlab-pages/docs/advanced/src/timestamps/timestamp.ligo b/gitlab-pages/docs/advanced/src/timestamps/timestamp.ligo deleted file mode 100644 index 5c46e43b6..000000000 --- a/gitlab-pages/docs/advanced/src/timestamps/timestamp.ligo +++ /dev/null @@ -1,9 +0,0 @@ -const today: timestamp = now; -const one_day: int = 86400; -const in_24_hrs: timestamp = today + one_day; - -const today: timestamp = now; -const one_day: int = 86400; -const a_24_hrs_ago: timestamp = today - one_day; - -const not_tommorow: bool = (now = in_24_hrs) \ No newline at end of file diff --git a/gitlab-pages/docs/advanced/timestamps-addresses.md b/gitlab-pages/docs/advanced/timestamps-addresses.md index e77ba76ee..dd7289e81 100644 --- a/gitlab-pages/docs/advanced/timestamps-addresses.md +++ b/gitlab-pages/docs/advanced/timestamps-addresses.md @@ -3,179 +3,204 @@ id: timestamps-addresses title: Timestamps, Addresses --- -## Timestamps +## Timestamps -Timestamps in LIGO, or in Michelson in general are available in smart contracts, while bakers baking the block (including the transaction in a block) are responsible for providing the given current timestamp for the contract. +LIGO features timestamps, as Michelson does, while bakers baking the +block (including the transaction in a block) are responsible for +providing the given current timestamp for the contract. -### Current time - -You can obtain the current time using the built-in syntax specific expression, please be aware that it's up to the baker to set the current timestamp value. +### Current Time +You can obtain the current time using the built-in syntax specific +expression, please be aware that it is up to the baker to set the +current timestamp value. ```pascaligo group=a -const today: timestamp = now; +const today : timestamp = now ``` ```cameligo group=a -let today: timestamp = Current.time +let today : timestamp = Current.time ``` ```reasonligo group=a -let today: timestamp = Current.time; +let today : timestamp = Current.time; ``` -> When running code with ligo CLI, the option `--predecessor-timestamp` allows you to control what `now` returns. +> When running code with ligo CLI, the option +> `--predecessor-timestamp` allows you to control what `now` returns. -### Timestamp arithmetic +### Timestamp Arithmetic -In LIGO, timestamps can be added with `int`(s), this enables you to set e.g. time constraints for your smart contracts like this: +In LIGO, timestamps can be added to integers, allowing you to set time +constraints on your smart contracts. Consider the following scenarios. #### In 24 hours + ```pascaligo group=b -const today: timestamp = now; -const one_day: int = 86400; -const in_24_hrs: timestamp = today + one_day; -const some_date: timestamp = ("2000-01-01T10:10:10Z" : timestamp); -const one_day_later: timestamp = some_date + one_day; +const today : timestamp = now +const one_day : int = 86400 +const in_24_hrs : timestamp = today + one_day +const some_date : timestamp = ("2000-01-01T10:10:10Z" : timestamp) +const one_day_later : timestamp = some_date + one_day ``` ```cameligo group=b -let today: timestamp = Current.time -let one_day: int = 86400 -let in_24_hrs: timestamp = today + one_day -let some_date: timestamp = ("2000-01-01t10:10:10Z" : timestamp) -let one_day_later: timestamp = some_date + one_day +let today : timestamp = Current.time +let one_day : int = 86400 +let in_24_hrs : timestamp = today + one_day +let some_date : timestamp = ("2000-01-01t10:10:10Z" : timestamp) +let one_day_later : timestamp = some_date + one_day ``` ```reasonligo group=b -let today: timestamp = Current.time; -let one_day: int = 86400; -let in_24_hrs: timestamp = today + one_day; -let some_date: timestamp = ("2000-01-01t10:10:10Z" : timestamp); -let one_day_later: timestamp = some_date + one_day; +let today : timestamp = Current.time; +let one_day : int = 86400; +let in_24_hrs : timestamp = today + one_day; +let some_date : timestamp = ("2000-01-01t10:10:10Z" : timestamp); +let one_day_later : timestamp = some_date + one_day; ``` -#### 24 hours ago +#### 24 hours Ago + ```pascaligo group=c -const today: timestamp = now; -const one_day: int = 86400; -const in_24_hrs: timestamp = today - one_day; +const today : timestamp = now +const one_day : int = 86400 +const in_24_hrs : timestamp = today - one_day ``` ```cameligo group=c -let today: timestamp = Current.time -let one_day: int = 86400 -let in_24_hrs: timestamp = today - one_day +let today : timestamp = Current.time +let one_day : int = 86400 +let in_24_hrs : timestamp = today - one_day ``` ```reasonligo group=c -let today: timestamp = Current.time; -let one_day: int = 86400; -let in_24_hrs: timestamp = today - one_day; +let today : timestamp = Current.time; +let one_day : int = 86400; +let in_24_hrs : timestamp = today - one_day; ``` -### Comparing timestamps +### Comparing Timestamps -You can also compare timestamps using the same comparison operators as for numbers: +You can also compare timestamps using the same comparison operators as +for numbers. ```pascaligo group=c -const not_tommorow: bool = (now = in_24_hrs) +const not_tommorow : bool = (now = in_24_hrs) ``` ```cameligo group=c -let not_tomorrow: bool = (Current.time = in_24_hrs) +let not_tomorrow : bool = (Current.time = in_24_hrs) ``` ```reasonligo group=c -let not_tomorrow: bool = (Current.time == in_24_hrs); +let not_tomorrow : bool = (Current.time == in_24_hrs); ``` ## Addresses -`address` is a LIGO datatype used for Tezos addresses (tz1, tz2, tz3, KT1, ...). - -Here's how you can define an address: +The type `address` in LIGO is used to denote Tezos addresses (tz1, +tz2, tz3, KT1, ...). Currently, addresses are created by casting a +string to the type `address`. Beware of failures if the address is +invalid. Consider the following examples. ```pascaligo group=d -const my_account: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); +const my_account : address = + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) ``` ```cameligo group=d -let my_account: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) +let my_account : address = + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) ``` ```reasonligo group=d -let my_account: address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); +let my_account : address = + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address); ``` ## Signatures -`signature` is a LIGO datatype used for Tezos signature (edsig, spsig). +The type `signature` in LIGO datatype is used for Tezos signature +(edsig, spsig). Signatures are created by casting a string. Beware of +failure if the signature is invalid. -Here's how you can define a signature: +Here is how you can define a signature: ```pascaligo group=e -const my_signature: signature = ("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7": signature); +const my_sig : signature = + ("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7" : + signature) ``` ```cameligo group=e -let my_signature: signature = ("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7": signature) +let my_sig : signature = + ("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7" : + signature) ``` ```reasonligo group=e -let my_signature: signature = ("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7": signature); +let my_sig : signature = +("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7" : +signature); ``` -## keys +## Keys -`key` is a LIGO datatype used for Tezos public key. +The type `key` in LIGO is used for Tezos public keys. Do not confuse +them with map keys. Keys are made by casting strings. Beware of +failure if the key is invalid. -Here's how you can define a key: +Here is how you can define a key. ```pascaligo group=f -const my_key: key = ("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav": key); +const my_key : key = +("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav" : key) ``` ```cameligo group=f -let my_key: key = ("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav": key) +let my_key : key = + ("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav" : key) ``` ```reasonligo group=f -let my_key: key = ("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav": key); +let my_key : key = + ("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav" : key); ``` diff --git a/gitlab-pages/docs/language-basics/boolean-if-else.md b/gitlab-pages/docs/language-basics/boolean-if-else.md index 07cb40d04..b6d3b0da3 100644 --- a/gitlab-pages/docs/language-basics/boolean-if-else.md +++ b/gitlab-pages/docs/language-basics/boolean-if-else.md @@ -1,61 +1,61 @@ --- id: boolean-if-else -title: Boolean, If, Else +title: Booleans and Conditionals --- -## Boolean +## Booleans -The type of a Boolean is `bool` and the possible values are `True` and `False`. - -Here's how to define a boolean: +The type of a boolean value is `bool`. Here is how to define a boolean +value: ```pascaligo group=a -const a: bool = True; -const b: bool = False; +const a : bool = True // Notice the capital letter +const b : bool = False // Same. ``` ```cameligo group=a -let a: bool = true -let b: bool = false +let a : bool = true +let b : bool = false ``` ```reasonligo group=a -let a: bool = true; -let b: bool = false; +let a : bool = true; +let b : bool = false; ``` -## Comparing two values +## Comparing two Values -In LIGO, only values of the same type can be compared. We call these "comparable types." Comparable types include e.g. `int`, `nat`, `string`, `tez`, `timestamp`, `address`, ... +In LIGO, only values of the same type can be compared. Moreover, not +all values of the same type can be compared, only those with +*comparable types*, which is a concept lifted from +Michelson. Comparable types include, for instance, `int`, `nat`, +`string`, `tez`, `timestamp`, `address`, etc. -### Comparing strings +### Comparing Strings ```pascaligo group=b -const a: string = "Alice"; -const b: string = "Alice"; -// True -const c: bool = (a = b); +const a : string = "Alice" +const b : string = "Alice" +const c : bool = (a = b) // True ``` ```cameligo group=b -let a: string = "Alice" -let b: string = "Alice" -// true -let c: bool = (a = b) +let a : string = "Alice" +let b : string = "Alice" +let c : bool = (a = b) // true ``` ```reasonligo group=b -let a: string = "Alice"; -let b: string = "Alice"; -(* true *) -let c: bool = (a == b); +let a : string = "Alice"; +let b : string = "Alice"; +let c : bool = (a == b); // true ``` @@ -65,128 +65,120 @@ let c: bool = (a == b); ```pascaligo group=c -const a: int = 5; -const b: int = 4; -const c: bool = (a = b); -const d: bool = (a > b); -const e: bool = (a < b); -const f: bool = (a <= b); -const g: bool = (a >= b); -const h: bool = (a =/= b); +const a : int = 5 +const b : int = 4 +const c : bool = (a = b) +const d : bool = (a > b) +const e : bool = (a < b) +const f : bool = (a <= b) +const g : bool = (a >= b) +const h : bool = (a =/= b) ``` ```cameligo group=c -let a: int = 5 -let b: int = 4 -let c: bool = (a = b) -let d: bool = (a > b) -let e: bool = (a < b) -let f: bool = (a <= b) -let g: bool = (a >= b) -let h: bool = (a <> b) +let a : int = 5 +let b : int = 4 +let c : bool = (a = b) +let d : bool = (a > b) +let e : bool = (a < b) +let f : bool = (a <= b) +let g : bool = (a >= b) +let h : bool = (a <> b) ``` ```reasonligo group=c -let a: int = 5; -let b: int = 4; -let c: bool = (a == b); -let d: bool = (a > b); -let e: bool = (a < b); -let f: bool = (a <= b); -let g: bool = (a >= b); -let h: bool = (a != b); +let a : int = 5; +let b : int = 4; +let c : bool = (a == b); +let d : bool = (a > b); +let e : bool = (a < b); +let f : bool = (a <= b); +let g : bool = (a >= b); +let h : bool = (a != b); ``` ### Comparing tez -> 💡 Comparing `tez` values is especially useful when dealing with an `amount` sent in a transaction. +> 💡 Comparing `tez` values is especially useful when dealing with an +> amount sent in a transaction. ```pascaligo group=d -const a: tez = 5mutez; -const b: tez = 10mutez; -const c: bool = (a = b); +const a : tez = 5mutez +const b : tez = 10mutez +const c : bool = (a = b) // false ``` ```cameligo group=d -let a: tez = 5mutez -let b: tez = 10mutez -// false -let c: bool = (a = b) +let a : tez = 5mutez +let b : tez = 10mutez +let c : bool = (a = b) // false ``` ```reasonligo group=d -let a: tez = 5mutez; -let b: tez = 10mutez; -(* false *) -let c: bool = (a == b); +let a : tez = 5mutez; +let b : tez = 10mutez; +let c : bool = (a == b); // false ``` -## Conditionals, if staments, and more +## Conditionals -Conditional logic is an important part of every real world program. - -### If/else statements +Conditional logic enables to fork the control flow depending on the +state. ```pascaligo group=e -const min_age: nat = 16n; +type magnitude is Small | Large // See variant types. -function is_adult(const age: nat): bool is - if (age > min_age) then True else False +function compare (const n : nat) : magnitude is + if n < 10n then Small (Unit) else Large (Unit) // Unit is needed for now. ``` -> You can run the function above with -> ``` -> ligo run-function -s pascaligo src/if-else.ligo is_adult 21n -> ``` +You can run the `compare` function defined above using the LIGO compiler +like this: +```shell +ligo run-function +gitlab-pages/docs/language-basics/boolean-if-else/cond.ligo compare 21n' +# Outputs: Large (Unit) +``` ```cameligo group=e -let min_age: nat = 16n +type magnitude = Small | Large // See variant types. -(** - - This function is really obnoxious, but it showcases - how the if statement and it's syntax can be used. - - Normally, you'd use `with (age > min_age)` instead. - -*) -let is_adult (age: nat) : bool = - if (age > min_age) then true else false +let compare (n : nat) : magnitude = + if n < 10n then Small else Large ``` + +You can run the `compare` function defined above using the LIGO compiler +like this: +```shell +ligo run-function +gitlab-pages/docs/language-basics/boolean-if-else/cond.mligo compare 21n' +# Outputs: Large +``` + ```reasonligo group=e -let min_age: nat = 16n; +type magnitude = | Small | Large; // See variant types. -(** - - This function is really obnoxious, but it showcases - how the if statement and it's syntax can be used. - - Normally, you'd use `with (age > min_age)` instead. - -*) - -let is_adult = (age: nat): bool => - if (age > min_age) { - true; - } else { - false; - }; +let compare = (n : nat) : magnitude => + if (n < 10n) { Small; } else { Large; }; ``` -> You can run the function above with -> ``` -> ligo run-function -s reasonligo src/if-else.religo is_adult 21n -> ``` +You can run the `compare` function defined above using the LIGO compiler +like this: +```shell +ligo run-function +gitlab-pages/docs/language-basics/boolean-if-else/cond.religo compare 21n' +# Outputs: Large +``` - \ No newline at end of file + diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index b8a839817..bcae8b468 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -3,24 +3,40 @@ id: functions title: Functions --- -Writing code is fun as long as it doesn't get out of hand. To make sure our code doesn't turn into spaghetti we can group some logic into functions. +Writing code is fun as long as it does not get out of hand. To make +sure our code does not turn into spaghetti, we can structure some +logic into functions. -## Instruction blocks +## Blocks -With `block`(s) you can wrap *instructions* and *expressions* into an isolated scope. -Each `block` needs to include at least one `instruction`, or a *placeholder* instruction called `skip`. +In PascaLIGO, *blocks* enable the sequential composition of +*instructions* into an isolated scope. Each `block` needs to include +at least one instruction. If we need a placeholder *placeholder*, we +use the instruction called `skip`, that leaves the state +invariant. The rationale for `skip` instead of a truly empty block is +that it prevents you from writing an empty block by mistake. ```pascaligo skip -// shorthand syntax +// terse style block { a := a + 1 } -// verbose syntax +// verbose style begin a := a + 1 end ``` +Blocks are more versatile than simply containing instructions: +they can also include *declarations* of values, like so: +```pascaligo skip +// terse style +block { const a : int = 1; } +// verbose style +begin + const a : int = 1; +end +``` @@ -32,54 +48,71 @@ end Functions in PascaLIGO are defined using the `function` keyword followed by their `name`, `parameters` and `return` type definitions. -Here's how you define a basic function that accepts two `int`s and -returns a single `int`: +Here is how you define a basic function that computes the sum of two +integers: ```pascaligo group=a -function add(const a: int; const b: int): int is - begin - const result: int = a + b; - end with result; +function add (const a : int; const b : int) : int is + block { + const sum : int = a + b + } with sum ``` The function body consists of two parts: -- `block {}` - logic of the function -- `with ` - the return value of the function +- `block { }` - logic of the function +- `with ` - the value returned by the function #### Blockless functions -Functions that can contain all of their logic into a single -instruction/expression, can be defined without the surrounding -`block`. Instead, you can inline the necessary logic directly, like -this: - +Functions that can contain all of their logic into a single expression +can be defined without a block. Instead of a block, you put an +expression, whose value is implicitly returned by the function, like +so: ```pascaligo group=b -function add(const a: int; const b: int): int is a + b +function add (const a: int; const b : int) : int is a + b +``` + +You can call the function `add` defined above using the LIGO compiler +like this: +```shell +ligo run-function gitlab-pages/docs/language-basics/src/functions/blockless.ligo add '(1,2)' +# Outputs: 3 ``` -Functions in CameLIGO are defined using the `let` keyword, like value -bindings. The difference is that after the value name a list of -function parameters is provided, along with a return type. +Functions in CameLIGO are defined using the `let` keyword, like other +values. The difference is that a succession of parameters is provided +after the value name, followed by the return type. This follows OCaml +syntax. For example: +```cameligo group=c +let add (a : int) (b : int) : int = a + b +``` + +You can call the function `add` defined above using the LIGO compiler +like this: +```shell +ligo run-function gitlab-pages/docs/language-basics/src/functions/blockless.mligo add '(1,2)' +# Outputs: 3 +``` CameLIGO is a little different from other syntaxes when it comes to function parameters. In OCaml, functions can only take one parameter. To get functions with multiple arguments like we are used -to in traditional programming languages, a technique called +to in imperative programming languages, a technique called [currying](https://en.wikipedia.org/wiki/Currying) is used. Currying essentially translates a function with multiple arguments into a series of single argument functions, each returning a new function accepting the next argument until every parameter is filled. This is -useful because it means that CameLIGO can support +useful because it means that CameLIGO supports [partial application](https://en.wikipedia.org/wiki/Partial_application). Currying is however *not* the preferred way to pass function arguments in CameLIGO. While this approach is faithful to the original OCaml, -it's costlier in Michelson than naive function execution accepting -multiple arguments. Instead for most functions with more than one -parameter we should place the arguments in a +it is costlier in Michelson than naive function execution accepting +multiple arguments. Instead, for most functions with more than one +parameter, we should gather the arguments in a [tuple](language-basics/sets-lists-tuples.md) and pass the tuple in as a single parameter. @@ -87,56 +120,88 @@ Here is how you define a basic function that accepts two `ints` and returns an `int` as well: ```cameligo group=b -let add (a,b: int * int) : int = a + b - -let add_curry (a: int) (b: int) : int = a + b +let add (a, b : int * int) : int = a + b // Uncurried +let add_curry (a : int) (b : int) : int = add (a, b) // Curried +let increment (b : int) : int = add_curry 1 // Partial application ``` -The function body is a series of expressions, which are evaluated to -give the return value. +You can run the `increment` function defined above using the LIGO +compiler like this: +```shell +ligo run-function gitlab-pages/docs/language-basics/src/functions/curry.mligo increment 5 +# Outputs: 6 +``` + +The function body is a single expression, whose value is returned. - Functions in ReasonLIGO are defined using the `let` keyword, like -value bindings. The difference is that after the value name a list of -function parameters is provided, along with a return type. - -Here is how you define a basic function that accepts two `int`s and -returns an `int` as well: +other values. The difference is that a succession of parameters is +provided after the value name, followed by the return type. +Here is how you define a basic function that sums two integers: ```reasonligo group=b -let add = ((a,b): (int, int)) : int => a + b; +let add = ((a, b): (int, int)) : int => a + b; ``` -The function body is a series of expressions, which are evaluated to -give the return value. +You can call the function `add` defined above using the LIGO compiler +like this: +```shell +ligo run-function gitlab-pages/docs/language-basics/src/functions/blockless.religo add '(1,2)' +# Outputs: 3 +``` +The function body is a single expression, whose value is returned. -## Anonymous functions +## Anonymous functions (a.k.a. lambdas) -Functions without a name, also known as anonymous functions are useful -in cases when you want to pass the function as an argument or assign -it to a key in a record or a map. +It is possible to define functions without assigning them a name. They +are useful when you want to pass them as arguments, or assign them to +a key in a record or a map. + +Here is how to define an anonymous function: -Here's how to define an anonymous function assigned to a variable -`increment`, with it is appropriate function type signature. ```pascaligo group=c -const increment : int -> int = function (const i : int) : int is i + 1; -// a = 2 -const a: int = increment (1); +function increment (const b : int) : int is + (function (const a : int) : int is a + 1) (b) + +const a : int = increment (1); // a = 2 +``` + +You can check the value of `a` defined above using the LIGO compiler +like this: +```shell +ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.ligo a +# Outputs: 2 ``` ```cameligo group=c -let increment : int -> int = fun (i: int) -> i + 1 +let increment (b : int) : int = (fun (a : int) -> a + 1) b +let a : int = increment 1 // a = 2 +``` + +You can check the value of `a` defined above using the LIGO compiler +like this: +```shell +ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.mligo a +# Outputs: 2 ``` ```reasonligo group=c -let increment: (int => int) = (i: int) => i + 1; +let increment = (b : int) : int => ((a : int) : int => a + 1)(b); +let a : int = increment (1); // a = 2 +``` + +You can check the value of `a` defined above using the LIGO compiler +like this: +```shell +ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.religo a +# Outputs: 2 ``` diff --git a/gitlab-pages/docs/language-basics/loops.md b/gitlab-pages/docs/language-basics/loops.md index 9fd26d024..9a5a4d47b 100644 --- a/gitlab-pages/docs/language-basics/loops.md +++ b/gitlab-pages/docs/language-basics/loops.md @@ -3,108 +3,229 @@ id: loops title: Loops --- - - -## While Loop +## General Iteration -The PascaLIGO while loop should look familiar to users of imperative languages. -While loops are of the form `while `, and evaluate -their associated block until the condition evaluates to false. +General iteration in PascaLIGO takes the shape of "while" loops, which +should be familiar to programmers of imperative languages. Those loops +are of the form `while `. Their associated block is +repeatedly evaluated until the condition becomes true, or never +evaluated if the condition is false at the start. The loop never +terminates if the condition never becomes true. Because we are writing +smart contracts on Tezos, when the condition of a "while" loops fails +to become true, the execution will run out of gas and stop with a +failure anyway. -> ⚠️ The current PascaLIGO while loop has semantics that have diverged from other LIGO syntaxes. The goal of LIGO is that the various syntaxes express the same semantics, so this will be corrected in future versions. For details on how loops will likely work after refactoring, see the CameLIGO tab of this example. +Here is how to compute the greatest common divisors of two natural +number by means of Euclid's algorithm: -```pascaligo -function while_sum (var n : nat) : nat is block { - var i : nat := 0n ; - var r : nat := 0n ; - while i < n block { - i := i + 1n; - r := r + i; +```pascaligo group=a +function gcd (var x : nat; var y : nat) : nat is block { + if x < y then + block { + const z : nat = x; + x := y; y := z + } + else skip; + var r : nat := 0n; + while y =/= 0n block { + r := x mod y; + x := y; + y := r } -} with r +} with x +``` + +You can call the function `gcd` defined above using the LIGO compiler +like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/loops/gcd.ligo gcd '(2n*2n*3n*11n, 2n*2n*2n*3n*3n*5n*7n)' +# Outputs: +12 ``` -`Loop.fold_while` is a fold operation that takes an initial value of a certain type -and then iterates on it until a condition is reached. The auxillary function -that does the fold returns either boolean true or boolean false to indicate -whether the fold should continue or not. The initial value must match the input -parameter of the auxillary function, and the auxillary should return type `(bool * input)`. +CameLIGO is a functional language where user-defined values are +constant, therefore it makes no sense in CameLIGO to feature loops, +which we understand as syntactic constructs where the state of a +stopping condition is mutated, as with "while" loops in PascaLIGO. -`continue` and `stop` are provided as syntactic sugar for the return values. +Instead, CameLIGO features a *fold operation* as a predefined function +named `Loop.fold_while`. It takes an initial value of a certain type, +called an *accumulator*, and repeatedly calls a given function, called +*iterated function*, that takes that accumulator and returns the next +value of the accumulator, until a condition is met and the fold stops +with the final value of the accumulator. The iterated function needs +to have a special type: if the type of the accumulator is `t`, then it +must have the type `bool * t` (not simply `t`). It is the boolean +value that denotes whether the stopping condition has been reached. -```cameligo -let aux (i: int) : bool * int = - if i < 100 then continue (i + 1) else stop i +```cameligo group=b +let iter (x,y : nat * nat) : bool * (nat * nat) = + if y = 0n then false, (x,y) else true, (y, x mod y) -let counter_simple (n: int) : int = - Loop.fold_while aux n +let gcd (x,y : nat * nat) : nat = + let x,y = if x < y then y,x else x,y in + let x,y = Loop.fold_while iter (x,y) + in x +``` + +To ease the writing and reading of the iterated functions (here, +`iter`), two predefined functions are provided: `continue` and `stop`: + +```cameligo group=c +let iter (x,y : nat * nat) : bool * (nat * nat) = + if y = 0n then stop (x,y) else continue (y, x mod y) + +let gcd (x,y : nat * nat) : nat = + let x,y = if x < y then y,x else x,y in + let x,y = Loop.fold_while iter (x,y) + in x +``` + +You can call the function `gcd` defined above using the LIGO compiler +like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/loops/gcd.mligo gcd (2n*2n*3n*11n, 2n*2n*2n*3n*3n*5n*7n)' +# Outputs: +12 ``` -`Loop.fold_while` is a fold operation that takes an initial value of a certain type -and then iterates on it until a condition is reached. The auxillary function -that does the fold returns either boolean true or boolean false to indicate -whether the fold should continue or not. The initial value must match the input -parameter of the auxillary function, and the auxillary should return type `(bool, input)`. +ReasonLIGO is a functional language where user-defined values are +constant, therefore it makes no sense in ReasonLIGO to feature loops, +which we understand as syntactic constructs where the state of a +stopping condition is mutated, as with "while" loops in PascaLIGO. -`continue` and `stop` are provided as syntactic sugar for the return values. +Instead, ReasonLIGO features a *fold operation* as a predefined +function named `Loop.fold_while`. It takes an initial value of a +certain type, called an *accumulator*, and repeatedly calls a given +function, called *iterated function*, that takes that accumulator and +returns the next value of the accumulator, until a condition is met +and the fold stops with the final value of the accumulator. The +iterated function needs to have a special type: if the type of the +accumulator is `t`, then it must have the type `bool * t` (not simply +`t`). It is the boolean value that denotes whether the stopping +condition has been reached. -```reasonligo -let aux = (i: int): (bool, int) => - if (i < 100) { - continue(i + 1); - } else { - stop(i); - }; +```reasonligo group=d +let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => + if (y == 0n) { (false, (x,y)); } else { (true, (y, x mod y)); }; -let counter_simple = (n: int): int => Loop.fold_while(aux, n); +let gcd = ((x,y) : (nat, nat)) : nat => + let (x,y) = if (x < y) { (y,x); } else { (x,y); }; + let (x,y) = Loop.fold_while (iter, (x,y)); + x; ``` +To ease the writing and reading of the iterated functions (here, +`iter`), two predefined functions are provided: `continue` and `stop`: + +```reasonligo group=e +let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => + if (y == 0n) { stop ((x,y)); } else { continue ((y, x mod y)); }; + +let gcd = ((x,y) : (nat, nat)) : nat => + let (x,y) = if (x < y) { (y,x); } else { (x,y); }; + let (x,y) = Loop.fold_while (iter, (x,y)); + x; +``` -## For Loop +## For Loops -To iterate over a range of integers you use a loop of the form `for to `. +To iterate over a range of integers you use a loop of the form `for + to `, which is +familiar for programmers of imperative languages. Note that, for the +sake of generality, the bounds are of type `int`, not `nat`. -```pascaligo -function for_sum (var n : nat) : int is block { - var acc : int := 0 ; - for i := 1 to int(n) - begin - acc := acc + i; - end +```pascaligo group=f +function sum (var n : nat) : int is block { + var acc : int := 0; + for i := 1 to int (n) block { + acc := acc + i + } } with acc ``` +You can call the function `sum` defined above using the LIGO compiler +like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/loops/sum.ligo sum 7n +# Outputs: 28 +``` + -PascaLIGO for loops can also iterate through the contents of a collection. This is -done with a loop of the form `for in `. +PascaLIGO "for" loops can also iterate through the contents of a +collection, that is, a list, a set or a map. This is done with a loop +of the form `for in +`, where ` value` (or any other +variables). Give a map from strings to integers, here is how to sum +all the integers and concatenate all the strings. + +You can call the function `sum_map` defined above using the LIGO compiler +like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/loops/collection.ligo sum_map +'map ["1"->1; "2"->2; "3"->3]' +# Outputs: ( "123", 6 ) +``` diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index 3d05d41da..6a6572c37 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -1,419 +1,761 @@ --- id: maps-records -title: Maps, Records +title: Records and Maps --- So far we have seen pretty basic data types. LIGO also offers more -complex built-in constructs, such as maps and records. +complex built-in constructs, such as *records* and *maps*. + +## Records + +Records are one way data of different types can be packed into a +single type. A record is made of a set of *fields*, which are made of +a *field name* and a *field type*. Given a value of a record type, the +value bound to a field can be accessed by giving its field name to a +special operator (`.`). + +Let us first consider and example of record type declaration. + + + +```pascaligo group=a +type user is + record [ + id : nat; + is_admin : bool; + name : string + ] +``` + + +```cameligo group=a +type user = { + id : nat; + is_admin : bool; + name : string +} +``` + + +```reasonligo group=a +type user = { + id : nat, + is_admin : bool, + name : string +}; +``` + + +And here is how a record value is defined: + + + +```pascaligo group=a +const alice : user = + record [ + id = 1n; + is_admin = True; + name = "Alice" + ] +``` + + +```cameligo group=a +let alice : user = { + id = 1n; + is_admin = true; + name = "Alice" +} +``` + + +```reasonligo group=a +let alice : user = { + id : 1n, + is_admin : true, + name : "Alice" +}; +``` + + +### Accessing Record Fields + +If we want the contents of a given field, we use the `.` infix +operator, like so: + + + +```pascaligo group=a +const alice_admin : bool = alice.is_admin +``` + + +```cameligo group=a +let alice_admin : bool = alice.is_admin +``` + + +```reasonligo group=a +let alice_admin: bool = alice.is_admin; +``` + + +### Functional Updates + +Given a record value, it is a common design pattern to update only a +small number of its fields. Instead of copying the fields that are +unchanged, LIGO offers a way to only update the fields that are +modified. + +One way to understand the update of record values is the *functional +update*. The idea is to have an *expression* whose value is the +updated record. The shape of that expression is ` +with `. The record variable is the record to update and +the record value is the update itself. + +Let us consider defining a function that translates three-dimensional +points on a plane. + + + + +```pascaligo group=b +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is + p with record [x = p.x + vec.dx; y = p.y + vec.dy] +``` + +You can call the function `xy_translate` defined above by running the +following command of the shell: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/maps-records/record_update.ligo +translate "(record [x=2;y=3;z=1], record [dx=3;dy=4])" +# Outputs: {z = 1 , y = 7 , x = 5} +``` + +You have to understand that `p` has not been changed by the functional +update: a namless new version of it has been created and returned by +the blockless function. + + + +The syntax for the functional updates of record in CameLIGO follows +that of OCaml: + +```cameligo group=b +type point = {x : int; y : int; z : int} +type vector = {dx : int; dy : int} + +let origin : point = {x = 0; y = 0; z = 0} + +let xy_translate (p, vec : point * vector) : point = + {p with x = p.x + vec.dx; y = p.y + vec.dy} +``` + + +You can call the function `xy_translate` defined above by running the +following command of the shell: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/maps-records/record_update.mligo +xy_translate "({x=2;y=3;z=1}, {dx=3;dy=4})" +# Outputs: {z = 1 , y = 7 , x = 5} +``` + +> You have to understand that `p` has not been changed by the +> functional update: a nameless new version of it has been created and +> returned. + + + +The syntax for the functional updates of record in ReasonLIGO follows +that of OCaml: + +```reasonligo group=b +type point = {x : int, y : int, z : int}; +type vector = {dx : int, dy : int}; + +let origin : point = {x : 0, y : 0, z : 0}; + +let xy_translate = ((p, vec) : (point, vector)) : point => + {...p, x : p.x + vec.dx, y : p.y + vec.dy}; +``` + + +You can call the function `x_translation` defined above by running the +following command of the shell: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/maps-records/record_update.religo +xy_translate "({x:2,y:3,z:1}, {dx:3,dy:4})" +# Outputs: {z = 1 , y = 7 , x = 5} +``` + +You have to understand that `p` has not been changed by the functional +update: a nameless new version of it has been created and returned. + +### Imperative Updates + +Another way to understand what it means to update a record value is to +make sure that any further reference to the value afterwards will +exhibit the modification. This is called a `patch` and this is only +possible in PascaLIGO, because a patch is an *instruction*, therefore +we can only use it in a block. Similarly to a *functional update*, a +patch takes a record to be updated and a record with a subset of the +fields to update, then applies the latter to the former (hence the +name "patch"). + +Let us consider defining a function that translates three-dimensional +points on a plane. + + + + +```pascaligo group=c +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is + block { + patch p with record [x = p.x + vec.dx]; + patch p with record [y = p.y + vec.dy] + } with p +``` + +You can call the function `xy_translate` defined above by running the +following command of the shell: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/maps-records/record_patch.ligo +xy_translate "(record [x=2;y=3;z=1], record [dx=3;dy=4])" +# Outputs: {z = 1 , y = 7 , x = 5} +``` + +Of course, we can actually translate the point with only one `patch`, +as the previous example was meant to show that, after the first patch, +the value of `p` indeed changed. So, a shorter version would be + +```pascaligo group=d +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is + block { + patch p with record [x = p.x + vec.dx; y = p.y + vec.dy] + } with p +``` + +You can call the new function `xy_translate` defined above by running the +following command of the shell: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/maps-records/record_patch2.ligo +xy_translate "(record [x=2;y=3;z=1], record [dx=3;dy=4])" +# Outputs: {z = 1 , y = 7 , x = 5} +``` + +Record patches can actually be simulated with functional updates. All +we have to do is *declare a new record value with the same name as the +one we want to update* and use a functional update, like so: + +```pascaligo group=e +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is block { + const p : point = p with record [x = p.x + vec.dx; y = p.y + vec.dy] +} with p +``` + +You can call the new function `xy_translate` defined above by running the +following command of the shell: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/maps-records/record_simu.ligo +xy_translate "(record [x=2;y=3;z=1], record [dx=3;dy=4])" +# Outputs: {z = 1 , y = 7 , x = 5} +``` + +The hiding of a variable by another (here `p`) is called `shadowing`. + + + ## Maps -Maps are natively available in Michelson, and LIGO builds on top of -them. A requirement for a map is that its keys be of the same type, -and that type must be comparable. +*Maps* are a data structure which associate values of the same type to +values of the same type. The former are called *key* and the latter +*values*. Together they make up a *binding*. An additional requirement +is that the type of the keys must be *comparable*, in the Michelson +sense. -Here is how a custom map type is defined: +Here is how a custom map from addresses to a pair of integers is +defined. -```pascaligo +```pascaligo group=f type move is int * int -type moveset is map(address, move) +type register is map (address, move) ``` - -```cameligo + +```cameligo group=f type move = int * int -type moveset = (address, move) map +type register = (address, move) map ``` - -```reasonligo + +```reasonligo group=f type move = (int, int); -type moveset = map(address, move); +type register = map (address, move); ``` - -And here is how a map value is populated: +And here is how a map value is defined: -```pascaligo -const moves: moveset = map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1, 2); - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0, 3); -end +```pascaligo group=f +const moves : register = + map [ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> (1,2); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) -> (0,3)] ``` -> Notice the `->` between the key and its value and `;` to separate individual map entries. -> -> `("": address)` means that we type-cast a string into an address. - +> Notice the `->` between the key and its value and `;` to separate +> individual map entries. The annotated value `("" : +> address)` means that we cast a string into an address. Also, `map` +> is a keyword. -```cameligo -let moves: moveset = Map.literal - [ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1, 2)) ; - (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0, 3)) ; - ] + +```cameligo group=f +let moves : register = + Map.literal [ + (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address), (1,2)); + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), (0,3))] ``` -> Map.literal constructs the map from a list of key-value pair tuples, `(, )`. -> Note also the `;` to separate individual map entries. -> -> `("": address)` means that we type-cast a string into an address. - +> The `Map.literal` predefined function builds a map from a list of +> key-value pair tuples, `(, )`. Note also the `;` to +> separate individual map entries. `("": address)` +> means that we type-cast a string into an address. -```reasonligo -let moves : moveset = - Map.literal([ - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1, 2)), - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0, 3)), - ]); + +```reasonligo group=f +let moves : register = + Map.literal ([ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, (1,2)), + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3)),]); ``` -> Map.literal constructs the map from a list of key-value pair tuples, `(, )`. -> -> `("": address)` means that we type-cast a string into an address. + +> The `Map.literal` predefined function builds a map from a list of +> key-value pair tuples, `(, )`. Note also the `;` to +> separate individual map entries. `("": address)` +> means that we type-cast a string into an address. -### Accessing map values by key +### Accessing Map Bindings -If we want to access a move from our moveset above, we can use the -`[]` operator/accessor to read the associated `move` value. However, -the value we will get will be wrapped as an optional; in our case -`option(move)`. Here is an example: +We can use the postfix `[]` operator to read the `move` value +associated to a given key (`address` here) in the register. Here is an +example: -```pascaligo -const my_balance : option(move) = moves[("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)]; +```pascaligo group=f +(*const my_balance : option (move) = + moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)] *) ``` - - -```cameligo -let my_balance : move option = Map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves + +```cameligo group=f +let my_balance : move option = + Map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves ``` - - -```reasonligo -let my_balance : option(move) = - Map.find_opt("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); + +```reasonligo group=f +let my_balance : option (move) = + Map.find_opt (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), moves); ``` -#### Obtaining a map value forcefully - -Accessing a value in a map yields an option, however you can also get the value directly: +Notice how the value we read is an optional value: this is to force +the reader to account for a missing key in the map. This requires +*pattern matching*. + -```pascaligo -const my_balance : move = get_force(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves); +```pascaligo group=f +function force_access (const key : address; const moves : register) : move is + case moves[key] of + Some (move) -> move + | None -> (failwith ("No move.") : move) + end ``` - - -```cameligo -let my_balance : move = Map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves + +```cameligo group=f +let force_access (key, moves : address * register) : move = + match Map.find_opt key moves with + Some move -> move + | None -> (failwith "No move." : move) ``` - - -```reasonligo -let my_balance : move = - Map.find("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); + +```reasonlig group=f +let force_access : ((key, moves) : address * register) : move => { + switch (Map.find_opt key moves) with + Some move -> move + | None -> (failwith "No move." : move) +}; ``` - -### Updating the contents of a map + +### Updating a Map + +Given a map, we may want to add a new binding, remove one, or modify +one by changing the value associated to an already existing key. We +may even want to retain the key but not the associated value. All +those operations are called *updates*. -The values of a PascaLIGO map can be updated using the ordinary assignment syntax: +The values of a PascaLIGO map can be updated using the usual +assignment syntax `[] := `. Let us +consider an example. -```pascaligo - -function set_ (var m: moveset) : moveset is +```pascaligo group=f +function assign (var m : register) : register is block { - m[("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9); + m [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9) + } with m +``` + +If multiple bindings need to be updated, PascaLIGO offers a *patch +instruction* for maps, similar to that for records. + +```pascaligo group=f +function assignments (var m : register) : register is + block { + patch m with map [ + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) -> (4,9); + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> (1,2) + ] } with m ``` -We can update a map in CameLIGO using the `Map.update` built-in: +We can update a binding in a map in CameLIGO by means of the +`Map.update` built-in function: -```cameligo - -let updated_map: moveset = Map.update ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) (Some (4,9)) moves +```cameligo group=f +let assign (m : register) : register = + Map.update + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) (Some (4,9)) m ``` +> Notice the optional value `Some (4,9)` instead of `(4,9)`. If we had +> use `None` instead, that would have meant that the binding is only +> defined on its key, but not its value. This encoding enables +> partially defined bindings. + -We can update a map in ReasonLIGO using the `Map.update` built-in: +We can update a binding in a map in ReasonLIGO by means of the +`Map.update` built-in function: -```reasonligo +```reasonligo group=f +let assign = (m : register) : register => { + Map.update + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), Some ((4,9)), m) +}; +``` -let updated_map: moveset = Map.update(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some((4,9)), moves); +> Notice the optional value `Some (4,9)` instead of `(4,9)`. If we had +> use `None` instead, that would have meant that the binding is only +> defined on its key, but not its value. This encoding enables +> partially defined bindings. + + + +To remove a binding from a map, we need its key. + + + + + +In PascaLIGO, there is a special instruction to remove a binding from +a map. +```pascaligo group=f +function delete (const key : address; var moves : register) : register is + block { + remove key from map moves + } with moves +``` + + +```cameligo group=f +let delete (key, moves : address * register) : register = + Map.remove key moves +``` + + +```reasonligo group=f +let delete = ((key, moves) : (address, register)) : register => { + Map.remove (key, moves); +}; ``` -### Iteration over the contents of a map +### Iterating Functionally over a Map -There are three kinds of iteration on LIGO maps, `iter`, `map` and `fold`. `iter` -is an iteration over the map with no return value, its only use is to -generate side effects. This can be useful if for example you would like to check -that each value inside of a map is within a certain range, with an error thrown -otherwise. +A *functional iterator* is a function that traverses a data structure +and calls in turn a given function over the elements of that structure +to compute some value. Another approach is possible in PascaLIGO: +*loops* (see the relevant section). + +There are three kinds of functional iteration over LIGO maps: `iter`, +`map` and `fold`. The first, `iter`, is an iteration over the map with +no return value: its only use is to produce side-effects. This can be +useful if for example you would like to check that each value inside +of a map is within a certain range, and fail with an error otherwise. -```pascaligo -function iter_op (const m : moveset) : unit is +```pascaligo group=f +function iter_op (const m : register) : unit is block { - function aggregate (const i : address ; const j : move) : unit is block - { if j.1 > 1 then skip else failwith("fail") } with unit - } with map_iter(aggregate, m); + function aggregate (const i : address; const j : move) : unit is block + { if j.1 > 1 then skip else failwith ("Below range.") } with unit + } with map_iter (aggregate, m) ``` - -```cameligo -let iter_op (m : moveset) : unit = - let assert_eq = fun (i,j: address * move) -> assert (j.0 > 1) + +```cameligo group=f +let iter_op (m : register) : unit = + let assert_eq = fun (i,j : address * move) -> assert (j.0 > 1) in Map.iter assert_eq m ``` - -```reasonligo -let iter_op = (m: moveset): unit => { - let assert_eq = ((i,j): (address, move)) => assert (j[0] > 1); - Map.iter(assert_eq, m); + +```reasonligo group=f +let iter_op = (m : register) : unit => { + let assert_eq = ((i,j) : (address, move)) => assert (j[0] > 1); + Map.iter (assert_eq, m); }; ``` -`map` is a way to create a new map by modifying the contents of an existing one. +We may want to change all the bindings of a map by applying to them a +function. This is also called a *map operation*, as opposed to the +*map data structure* we have been presenting. -```pascaligo -function map_op (const m : moveset) : moveset is +```pascaligo group=f +function map_op (const m : register) : register is block { - function increment (const i : address ; const j : move) : move is (j.0, j.1 + 1); - } with map_map (increment, m); + function increment (const i : address; const j : move) : move is + (j.0, j.1 + 1); + } with map_map (increment, m) ``` - -```cameligo -let map_op (m : moveset) : moveset = - let increment = fun (i,j: address * move) -> (j.0, j.1 + 1) + +```cameligo group=f +let map_op (m : register) : register = + let increment = fun (i,j : address * move) -> j.0, j.1 + 1 in Map.map increment m ``` - -```reasonligo -let map_op = (m: moveset): moveset => { + +```reasonligo group=f +let map_op = (m : register) : register => { let increment = ((i,j): (address, move)) => (j[0], j[1] + 1); Map.map(increment, m); }; ``` -`fold` is an aggregation function that return the combination of a -maps contents. - -The fold is a loop which extracts an element of the map on each -iteration. It then provides this element and an existing value to a -folding function which combines them. On the first iteration, the -existing value is an initial expression given by the programmer. On -each subsequent iteration it is the result of the previous iteration. -It eventually returns the result of combining all the elements. +A *fold operation* is the most general of iterations. The iterated +function takes two arguments: an *accumulator* and the structure +*element* at hand, with which it then produces a new accumulator. This +enables to have a partial result that becomes complete when the +traversal of the data structure is over. -```pascaligo -function fold_op (const m : moveset) : int is - block { - function aggregate (const j : int; const cur : address * (int * int)) : int is j + cur.1.1 - } with map_fold(aggregate, m, 5) +```pascaligo group=f +function fold_op (const m : register) : int is block { + function aggregate (const j : int; const cur : address * move) : int is + j + cur.1.1 + } with map_fold (aggregate, m, 5) ``` - -```cameligo -let fold_op (m : moveset) : moveset = - let aggregate = fun (i,j: int * (address * (int * int))) -> i + j.1.1 + +```cameligo group=f +let fold_op (m : register) : register = + let aggregate = fun (i,j : int * (address * move)) -> i + j.1.1 in Map.fold aggregate m 5 ``` - -```reasonligo -let fold_op = (m: moveset): moveset => { - let aggregate = ((i,j): (int, (address, (int,int)))) => i + j[1][1]; - Map.fold(aggregate, m, 5); + +```reasonligo group=f +let fold_op = (m: register): register => { + let aggregate = ((i,j): (int, (address, move))) => i + j[1][1]; + Map.fold (aggregate, m, 5); }; - ``` ## Big Maps -Ordinary maps are fine for contracts with a finite lifespan or a bounded number -of users. For many contracts however, the intention is to have a map hold *many* -entries, potentially millions or billions. The cost of loading these entries into -the environment each time a user executes the contract would eventually become -too expensive were it not for big maps. Big maps are a data structure offered by -Tezos which handles the scaling concerns for us. In LIGO, the interface for big -maps is analogous to the one used for ordinary maps. +Ordinary maps are fine for contracts with a finite lifespan or a +bounded number of users. For many contracts however, the intention is +to have a map holding *many* entries, potentially millions of +them. The cost of loading those entries into the environment each time +a user executes the contract would eventually become too expensive +were it not for *big maps*. Big maps are a data structure offered by +Michelson which handles the scaling concerns for us. In LIGO, the +interface for big maps is analogous to the one used for ordinary maps. Here is how we define a big map: -```pascaligo -type move is (int * int) -type moveset is big_map (address, move) +```pascaligo group=g +type move is int * int + +type register is big_map (address, move) ``` - -```cameligo + +```cameligo group=g type move = int * int -type moveset = (address, move) big_map + +type register = (address, move) big_map ``` - -```reasonligo + +```reasonligo group=g type move = (int, int); -type moveset = big_map(address, move); -``` +type register = big_map(address, move); +``` -And here is how a map value is populated: +And here is how a map value is created: -```pascaligo -const moves: moveset = - big_map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1,2); - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0,3); - end +```pascaligo group=g +const moves : register = + big_map [ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> (1,2); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) -> (0,3)] ``` -> Notice the `->` between the key and its value and `;` to separate individual map entries. -> -> `("": address)` means that we type-cast a string into an address. - +> Notice the right arrow `->` between the key and its value and the +> semicolon separating individual map entries. The value annotation +> `("" : address)` means that we cast a string into an +> address. -```cameligo -let moves: moveset = + + +```cameligo group=g +let moves : register = Big_map.literal [ - (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1,2)); - (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0,3)); - ] + (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address), (1,2)); + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), (0,3))] ``` -> Big_map.literal constructs the map from a list of key-value pair tuples, `(, )`. -> Note also the `;` to separate individual map entries. -> -> `("": address)` means that we cast a string into an address. - +> The predefind function `Big_map.literal` constructs a big map from a +> list of key-value pairs `(, )`. Note also the semicolon +> separating individual map entries. The annotated value `(" value>" : address)` means that we cast a string into an address. -```reasonligo -let moves: moveset = + + +```reasonligo group=g +let moves : register = Big_map.literal ([ - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1,2)), - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0,3)), - ]); + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, (1,2)), + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3)),]); ``` -> Big_map.literal constructs the map from a list of key-value pair tuples, `(, )`. -> -> `("": address)` means that we cast a string into an address. + +> The predefind function `Big_map.literal` constructs a big map from a +> list of key-value pairs `(, )`. Note also the semicolon +> separating individual map entries. The annotated value `(" value>" : address)` means that we cast a string into an address. + -### Accessing map values by key +### Accessing Values by Key -If we want to access a move from our moveset above, we can use the -`[]` operator/accessor to read the associated `move` value. However, -the value we will get will be wrapped as an optional; in our case -`option(move)`. Here is an example: +If we want to access a move from our `register` above, we can use the +postfix `[]` operator to read the associated `move` value. However, +the value we read is an optional value: in our case, of type `option +(move)`. Here is an example: -```pascaligo -const my_balance : option(move) = - moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] +```pascaligo group=g +const my_balance : option (move) = + moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)] ``` - + -```cameligo +```cameligo group=g let my_balance : move option = - Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves + Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves ``` - + -```reasonligo -let my_balance : option(move) = - Big_map.find_opt("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); +```reasonligo group=g +let my_balance : option (move) = + Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, moves); ``` -#### Obtaining a map value forcefully - -Accessing a value in a map yields an option, however you can also get -the value directly: - - - -```pascaligo -const my_balance : move = - get_force (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves); -``` - - - -```cameligo -let my_balance : move = - Big_map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves -``` - - - -```reasonligo -let my_balance : move = - Big_map.find ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, moves); -``` - - - -### Updating the contents of a big map +### Updating a Big Map -The values of a PascaLIGO big map can be updated using the ordinary -assignment syntax: +The values of a PascaLIGO big map can be updated using the +assignment syntax for ordinary maps -```pascaligo - -function set_ (var m : moveset) : moveset is +```pascaligo group=g +function assign (var m : register) : register is block { - m [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9); + m [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9) } with m ``` @@ -422,10 +764,10 @@ function set_ (var m : moveset) : moveset is We can update a big map in CameLIGO using the `Big_map.update` built-in: -```cameligo - -let updated_map : moveset = - Big_map.update ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) (Some (4,9)) moves +```cameligo group=g +let updated_map : register = + Big_map.update + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) (Some (4,9)) moves ``` @@ -433,102 +775,12 @@ let updated_map : moveset = We can update a big map in ReasonLIGO using the `Big_map.update` built-in: -```reasonligo -let updated_map : moveset = - Big_map.update(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some((4,9)), moves); +```reasonligo group=g +let updated_map : register = + Big_map.update + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some((4,9)), moves); ``` +### Removing Bindings from a Map + - -## Records - -Records are a construct introduced in LIGO, and are not natively -available in Michelson. The LIGO compiler translates records into -Michelson `Pairs`. - -Here is how a custom record type is defined: - - - -```pascaligo -type user is - record - id : nat; - is_admin : bool; - name : string - end -``` - - -```cameligo -type user = { - id : nat; - is_admin : bool; - name : string -} -``` - - -```reasonligo -type user = { - id : nat, - is_admin : bool, - name : string -}; -``` - - - -And here is how a record value is populated: - - - -```pascaligo -const user : user = - record - id = 1n; - is_admin = True; - name = "Alice" - end -``` - - -```cameligo -let user : user = { - id = 1n; - is_admin = true; - name = "Alice" -} -``` - - -```reasonligo -let user : user = { - id : 1n, - is_admin : true, - name : "Alice" -}; -``` - - -### Accessing record keys by name - -If we want to obtain a value from a record for a given key, we can do -the following: - - - -```pascaligo -const is_admin : bool = user.is_admin; -``` - - -```cameligo -let is_admin : bool = user.is_admin -``` - - -```reasonligo -let is_admin: bool = user.is_admin; -``` - diff --git a/gitlab-pages/docs/language-basics/math-numbers-tez.md b/gitlab-pages/docs/language-basics/math-numbers-tez.md index 91a4b923a..859c73097 100644 --- a/gitlab-pages/docs/language-basics/math-numbers-tez.md +++ b/gitlab-pages/docs/language-basics/math-numbers-tez.md @@ -7,120 +7,156 @@ LIGO offers three built-in numerical types: `int`, `nat` and `tez`. ## Addition -Addition in ligo is acomplished by using the `+` operator. Some type constraints apply; for example you can't add `tez + nat`. +Addition in LIGO is accomplished by means of the `+` infix +operator. Some type constraints apply, for example you ca not add a +value of type `tez` to a value of type `nat`. -In the following example you can find a series of arithmetic operations, including various numerical types. However, some bits of the example won't compile because adding an `int` to a `nat` produces an `int`, not a `nat`. Similiar rules apply for `tez`: +In the following example you can find a series of arithmetic +operations, including various numerical types. However, some bits +remain in comments because they would otherwise not compile because, +for example, adding a value of type `int` to a value of type `tez` is +invalid. Note that adding an integer to a natural number produces an +integer. ```pascaligo group=a -// int + int produces int -const a: int = 5 + 10; -// nat + int produces int -const b: int = 5n + 10; -// tez + tez produces tez -const c: tez = 5mutez + 10mutez; -// you can't add tez + int or tez + nat, this won't compile -// const d: tez = 5mutez + 10n; -// two nats produce a nat -const e: nat = 5n + 10n; -// nat + int produces an int, this won't compile -// const f: nat = 5n + 10; -const g: int = 1_000_000; +// int + int yields int +const a : int = 5 + 10 + +// nat + int yields int +const b : int = 5n + 10 + +// tez + tez yields tez +const c : tez = 5mutez + 10mutez + +//tez + int or tez + nat is invalid +// const d : tez = 5mutez + 10n + +// two nats yield a nat +const e : nat = 5n + 10n + +// nat + int yields an int: invalid +// const f : nat = 5n + 10; + +const g : int = 1_000_000 ``` -> Pro tip: you can use underscores for readability when defining large numbers +> Pro tip: you can use underscores for readability when defining large +> numbers: > >```pascaligo ->const g: int = 1_000_000; +> const sum : tez = 100_000mutez >``` ```cameligo group=a -// int + int produces int -let a: int = 5 + 10 -// nat + int produces int -let b: int = 5n + 10 -// tez + tez produces tez -let c: tez = 5mutez + 10mutez -// you can't add tez + int or tez + nat, this won't compile -// const d: tez = 5mutez + 10n -// two nats produce a nat -let e: nat = 5n + 10n -// nat + int produces an int, this won't compile -// const f: nat = 5n + 10 -let g: int = 1_000_000 +// int + int yields int +let a : int = 5 + 10 + +// nat + int yields int +let b : int = 5n + 10 + +// tez + tez yields tez +let c : tez = 5mutez + 10mutez + +// tez + int or tez + nat is invalid +// const d : tez = 5mutez + 10n + +// two nats yield a nat +let e : nat = 5n + 10n + +// nat + int yields an int: invalid +// const f : nat = 5n + 10 + +let g : int = 1_000_000 ``` -> Pro tip: you can use underscores for readability when defining large numbers +> Pro tip: you can use underscores for readability when defining large +> numbers: > >```cameligo ->let g: int = 1_000_000; +>let sum : tez = 100_000mutez >``` ```reasonligo group=a -(* int + int produces int *) -let a: int = 5 + 10; -(* nat + int produces int *) -let b: int = 5n + 10; -(* tez + tez produces tez *) -let c: tez = 5mutez + 10mutez; -(* you can't add tez + int or tez + nat, this won't compile: - let d: tez = 5mutez + 10n; *) -(* two nats produce a nat *) -let e: nat = 5n + 10n; -(* nat + int produces an int, this won't compile: -let f: nat = 5n + 10; *) -let g: int = 1_000_000; +// int + int yields int +let a : int = 5 + 10; + +// nat + int yields int +let b : int = 5n + 10; + +// tez + tez yields tez +let c : tez = 5mutez + 10mutez; + +// tez + int or tez + nat is invalid: +// let d : tez = 5mutez + 10n; + +// two nats yield a nat +let e : nat = 5n + 10n; + +// nat + int yields an int: invalid +//let f : nat = 5n + 10; + +let g : int = 1_000_000; ``` -> Pro tip: you can use underscores for readability when defining large numbers -> +> Pro tip: you can use underscores for readability when defining large +> numbers: >```reasonligo ->let g: int = 1_000_000; +>let sum : tex = 100_000mutez; >``` ## Subtraction -The simpliest substraction looks like this: +Subtraction looks like as follows. > ⚠️ Even when subtracting two `nats`, the result is an `int` ```pascaligo group=b -const a: int = 5 - 10; -// substraction of two nats, yields an int -const b: int = 5n - 2n; -// won't compile, result is an int, not a nat -// const c: nat = 5n - 2n; -const d: tez = 5mutez - 1mutez; +const a : int = 5 - 10 + +// Subtraction of two nats yields an int +const b : int = 5n - 2n + +// Therefore the following is invalid +// const c : nat = 5n - 2n + +const d : tez = 5mutez - 1mutez ``` ```cameligo group=b -let a: int = 5 - 10 -// substraction of two nats, yields an int -let b: int = 5n - 2n -// won't compile, result is an int, not a nat -// const c: nat = 5n - 2n -let d: tez = 5mutez - 1mutez +let a : int = 5 - 10 + +// Subtraction of two nats yields an int +let b : int = 5n - 2n + +// Therefore the following is invalid +// const c : nat = 5n - 2n + +let d : tez = 5mutez - 1mutez ``` ```reasonligo group=b -let a: int = 5 - 10; -(* substraction of two nats, yields an int *) -let b: int = 5n - 2n; -(* won't compile, result is an int, not a nat *) -(* let c: nat = 5n - 2n; *) -let d: tez = 5mutez - 1mutez; +let a : int = 5 - 10; + +// Subtraction of two nats yields an int +let b : int = 5n - 2n; + +// Therefore the following is invalid +// let c : nat = 5n - 2n; + +let d : tez = 5mutez - 1mutez; ``` @@ -134,88 +170,106 @@ You can multiply values of the same type, such as: ```pascaligo group=c -const a: int = 5 * 5; -const b: nat = 5n * 5n; -// you can also multiply `nat` and `tez` -const c: tez = 5n * 5mutez; +const a : int = 5 * 5 +const b : nat = 5n * 5n +// You can also multiply `nat` and `tez` in any order +const c : tez = 5n * 5mutez; ``` ```cameligo group=c -let a: int = 5 * 5 -let b: nat = 5n * 5n -// you can also multiply `nat` and `tez` -let c: tez = 5n * 5mutez +let a : int = 5 * 5 +let b : nat = 5n * 5n +// You can also multiply `nat` and `tez` in any order +let c : tez = 5n * 5mutez ``` ```reasonligo group=c -let a: int = 5 * 5; -let b: nat = 5n * 5n; -(* you can also multiply `nat` and `tez` *) -let c: tez = 5n * 5mutez; +let a : int = 5 * 5; +let b : nat = 5n * 5n; +// You can also multiply `nat` and `tez` in any order +let c : tez = 5n * 5mutez; ``` - ## Division -In LIGO you can divide `int`, `nat`, and `tez`. Here's how: +In LIGO you can divide `int`, `nat`, and `tez`. Here is how: > ⚠️ Division of two `tez` values results into a `nat` ```pascaligo group=d -const a: int = 10 / 3; -const b: nat = 10n / 3n; -const c: nat = 10mutez / 3mutez; +const a : int = 10 / 3 +const b : nat = 10n / 3n +const c : nat = 10mutez / 3mutez ``` ```cameligo group=d -let a: int = 10 / 3 -let b: nat = 10n / 3n -let c: nat = 10mutez / 3mutez +let a : int = 10 / 3 +let b : nat = 10n / 3n +let c : nat = 10mutez / 3mutez ``` ```reasonligo group=d -let a: int = 10 / 3; -let b: nat = 10n / 3n; -let c: nat = 10mutez / 3mutez; +let a : int = 10 / 3; +let b : nat = 10n / 3n; +let c : nat = 10mutez / 3mutez; ``` ## From `int` to `nat` and back -You can *cast* an `int` to a `nat` and vice versa, here's how: +You can *cast* an `int` to a `nat` and vice versa. Here is how: - + ```pascaligo group=e -const a: int = int(1n); -const b: nat = abs(1); +const a : int = int (1n) +const b : nat = abs (1) +``` + + +```cameligo group=e +let a : int = int (1n) +let b : nat = abs (1) +``` + + +```reasonligo group=e +let a : int = int (1n); +let b : nat = abs (1); ``` ## Check if a value is a `nat` -You can check if a value is a `nat`, by using a syntax specific built-in function, which accepts an `int` and returns an `option(nat)`, more specifically `Some(nat)` if the provided integer is a natural number, and `None` otherwise: +You can check if a value is a `nat` by using a syntax specific +built-in function, which accepts an `int` and returns an optional +`nat`: if `Some(nat)` then the provided integer was indeed a natural +number, and not otherwise. - -```pascaligo -const its_a_nat: option(nat) = is_nat(1) + +```pascaligo group=e +const is_a_nat : option (nat) = is_nat (1) +``` + + +```cameligo group=e +let is_a_nat : nat option = Michelson.is_nat (1) ``` ```reasonligo group=e -let a: int = int(1n); -let b: nat = abs(1); +let is_a_nat : option (nat) = Michelson.is_nat (1); ``` - \ No newline at end of file + diff --git a/gitlab-pages/docs/language-basics/sets-lists-tuples.md b/gitlab-pages/docs/language-basics/sets-lists-tuples.md index bc05f0ce3..330187ac3 100644 --- a/gitlab-pages/docs/language-basics/sets-lists-tuples.md +++ b/gitlab-pages/docs/language-basics/sets-lists-tuples.md @@ -1,329 +1,79 @@ --- id: sets-lists-tuples -title: Sets, Lists, Tuples +title: Tuples, Lists, Sets --- Apart from complex data types such as `maps` and `records`, ligo also -exposes `sets`, `lists` and `tuples`. - -> ⚠️ Make sure to pick the appropriate data type for your use case; it carries not only semantic but also gas related costs. - -## Sets - -Sets are similar to lists. The main difference is that elements of a -`set` must be *unique*. - -### Defining a set - - - -```pascaligo group=a -type int_set is set (int); -const my_set : int_set = set 1; 2; 3 end -``` - - -```cameligo group=a -type int_set = int set -let my_set : int_set = - Set.add 3 (Set.add 2 (Set.add 1 (Set.empty: int set))) -``` - - -```reasonligo group=a -type int_set = set (int); -let my_set : int_set = - Set.add (3, Set.add (2, Set.add (1, Set.empty: set (int)))); -``` - - - -### Empty sets - - - -```pascaligo group=a -const my_set: int_set = set end -const my_set_2: int_set = set_empty -``` - -```cameligo group=a -let my_set: int_set = (Set.empty: int set) -``` - -```reasonligo group=a -let my_set: int_set = (Set.empty: set (int)); -``` - - -### Checking if set contains an element - - - -```pascaligo group=a -const contains_three : bool = my_set contains 3 -// or alternatively -const contains_three_fn: bool = set_mem (3, my_set); -``` - - -```cameligo group=a -let contains_three: bool = Set.mem 3 my_set -``` - -```reasonligo group=a -let contains_three: bool = Set.mem(3, my_set); -``` - - - - -### Obtaining the size of a set - - -```pascaligo group=a -const set_size: nat = size (my_set) -``` - - -```cameligo group=a -let set_size: nat = Set.size my_set -``` - - -```reasonligo group=a -let set_size: nat = Set.size (my_set); -``` - - - - -### Modifying a set - - -```pascaligo group=a -const larger_set: int_set = set_add(4, my_set); -const smaller_set: int_set = set_remove(3, my_set); -``` - - - -```cameligo group=a -let larger_set: int_set = Set.add 4 my_set -let smaller_set: int_set = Set.remove 3 my_set -``` - - - -```reasonligo group=a -let larger_set: int_set = Set.add(4, my_set); -let smaller_set: int_set = Set.remove(3, my_set); -``` - - - - -### Folding a set - - -```pascaligo group=a -function sum(const result: int; const i: int): int is result + i; -// Outputs 6 -const sum_of_a_set: int = set_fold(sum, my_set, 0); -``` - - -```cameligo group=a -let sum (result, i: int * int) : int = result + i -let sum_of_a_set: int = Set.fold sum my_set 0 -``` - - -```reasonligo group=a -let sum = (result_i: (int, int)): int => result_i[0] + result_i[1]; -let sum_of_a_set: int = Set.fold(sum, my_set, 0); -``` - - -## Lists - -Lists are similar to sets, but their elements don't need to be unique and they don't offer the same range of built-in functions. - -> 💡 Lists are useful when returning operations from a smart contract's entrypoint. - -### Defining a list - - - -```pascaligo group=b -type int_list is list(int); -const my_list: int_list = list - 1; - 2; - 3; -end -``` - - -```cameligo group=b -type int_list = int list -let my_list: int_list = [1; 2; 3] -``` - - -```reasonligo group=b -type int_list = list(int); -let my_list: int_list = [1, 2, 3]; -``` - - - - -### Appending an element to a list - - - -```pascaligo group=b -const larger_list: int_list = cons(4, my_list); -const even_larger_list: int_list = 5 # larger_list; -``` - - -```cameligo group=b -let larger_list: int_list = 4 :: my_list -(* CameLIGO doesn't have a List.cons *) -``` - - -```reasonligo group=b -let larger_list: int_list = [4, ...my_list]; -(* ReasonLIGO doesn't have a List.cons *) -``` - - - -
-> 💡 Lists can be iterated, folded or mapped to different values. You can find additional examples [here](https://gitlab.com/ligolang/ligo/tree/dev/src/test/contracts) and other built-in operators [here](https://gitlab.com/ligolang/ligo/blob/dev/src/passes/operators/operators.ml#L59) - -### Mapping of a list - - - -```pascaligo group=b -function increment(const i: int): int is block { skip } with i + 1; -// Creates a new list with elements incremented by 1 -const incremented_list: int_list = list_map(increment, even_larger_list); -``` - - - -```cameligo group=b -let increment (i: int) : int = i + 1 -(* Creates a new list with elements incremented by 1 *) -let incremented_list: int_list = List.map increment larger_list -``` - - - - -```reasonligo group=b -let increment = (i: int): int => i + 1; -(* Creates a new list with elements incremented by 1 *) -let incremented_list: int_list = List.map(increment, larger_list); -``` - - - - -### Folding of a list: - - -```pascaligo group=b -function sum(const result: int; const i: int): int is block { skip } with result + i; -// Outputs 6 -const sum_of_a_list: int = list_fold(sum, my_list, 0); -``` - - - -```cameligo group=b -let sum (result, i: int * int) : int = result + i -// Outputs 6 -let sum_of_a_list: int = List.fold sum my_list 0 -``` - - - -```reasonligo group=b -let sum = ((result, i): (int, int)): int => result + i; -(* Outputs 6 *) -let sum_of_a_list: int = List.fold(sum, my_list, 0); -``` - - +exposes `tuples`, `lists` and `sets`. +> ⚠️ Make sure to pick the appropriate data type for your use case, and +> bear in mind the related gas costs. ## Tuples -Tuples are used to store related data that has a **specific order** and **defined -length** without the need for named fields or a dedicated type identity. Probably -the most common tuple is a pair of type `(a, b)`. For example, if we were storing -coordinates on a two dimensional grid we might use a pair tuple of type `int * int` -to store the coordinates x and y. There is a **specific order** because x and y must -always stay in the same location within the tuple for the data to make sense. There is -also a **defined length** because the tuple pair can only ever have two elements, -if we added a third dimension `z` its type would be incompatible with that of the -pair tuple. +Tuples gather a given number of values in a specific order and those +values, called *components*, can be retrieved by their index +(position). Probably the most common tuple is the *pair*. For +example, if we were storing coordinates on a two dimensional grid we +might use a pair of type `int * int` to store the coordinates `x` and +`y` as the pair value `(x,y)`. There is a *specific order*, so `(y,x)` +is not equal to `(x,y)`. The number of components is part of the type +of a tuple, so, for example, we cannot add an extra component to a +pair and obtain a triple of the same type: `(x,y)` has always a +different type from `(x,y,z)`, whereas `(y,x)` may have the same type. -Like records, tuples can have members of arbitrary types in the same structure. +Like records, tuple components can be of arbitrary types. ### Defining a tuple -Unlike [a record](language-basics/maps-records.md), tuple types do not have to be -defined before they can be used. However below we will give them names for the -sake of illustration. +Unlike [a record](language-basics/maps-records.md), tuple types do not +have to be defined before they can be used. However below we will give +them names by *type aliasing*. ```pascaligo group=c -type full_name is string * string; -const full_name: full_name = ("Alice", "Johnson"); +type full_name is string * string // Alias + +const full_name : full_name = ("Alice", "Johnson") ``` ```cameligo group=c -type full_name = string * string +type full_name = string * string // Alias + (* The parenthesis here are optional *) -let full_name: full_name = ("Alice", "Johnson") +let full_name : full_name = ("Alice", "Johnson") ``` ```reasonligo group=c -type full_name = (string, string); +type full_name = (string, string); // Alias + (* The parenthesis here are optional *) -let full_name: full_name = ("Alice", "Johnson"); +let full_name : full_name = ("Alice", "Johnson"); ``` -### Accessing an element in a tuple +### Accessing an Element in a Tuple -The traditional way to access the elements of a tuple in OCaml is through -[a pattern match](language-basics/unit-option-pattern-matching.md). LIGO **does -not** currently support tuple patterns in its syntaxes. - -However, it is possible to access LIGO tuples by their position. +Accessing the components of a tuple in OCaml is achieved by +[pattern matching](language-basics/unit-option-pattern-matching.md). LIGO +currently supports tuple patterns only in the parameters of functions, +not in pattern matching. In LIGO, however, we can access components by +their position in their tuple, which cannot be done in OCaml. -Tuple elements are one-indexed and accessed like so: +Tuple components are one-indexed like so: ```pascaligo group=c -const first_name: string = full_name.1; +const first_name : string = full_name.1; ``` @@ -331,12 +81,426 @@ const first_name: string = full_name.1; Tuple elements are zero-indexed and accessed like so: ```cameligo group=c -let first_name: string = full_name.0 +let first_name : string = full_name.0 ``` + +Tuple components are one-indexed like so: + ```reasonligo group=c -let first_name: string = full_name[1]; +let first_name : string = full_name[1]; +``` + +## Lists + +Lists are linear collections of elements of the same type. Linear +means that, in order to reach an element in a list, we must visit all +the elements before (sequential access). Elements can be repeated, as +only their order in the collection matters. The first element is +called the *head*, and the sub-list after the head is called the +*tail*. For those familiar with algorithmic data structure, you can +think of a list a *stack*, where the top is written on the left. + +> 💡 Lists are useful when returning operations from a smart +> contract's entrypoint. + +### Defining a List + + + +```pascaligo group=b +const my_list : list (int) = list [1; 2; 2] // The head is 1 +``` + + +```cameligo group=b +let my_list : int list = [1; 2; 2] // The head is 1 +``` + + +```reasonligo group=b +let my_list : list (int) = [1, 2, 2]; // The head is 1 ``` + + +### Adding to a List + + + +Lists can be augmented by adding an element before the head (or, in +terms of stack, by *pushing an element on top*). This operation is +usually called *consing* in functional languages. + + + +In PascaLIGO, the *cons operator* is infix and noted `#`. It is not +symmetric: on the left lies the element to cons, and, on the right, a +list on which to cons. (The symbol is helpfully asymmetric to remind +you of that.) + +```pascaligo group=b +const larger_list : list (int) = 5 # my_list +``` + + + +In CameLIGO, the *cons operator* is infix and noted `::`. It is not +symmetric: on the left lies the element to cons, and, on the right, a +list on which to cons. + +```cameligo group=b +let larger_list : int list = 5 :: my_list +``` + + + +In ReasonLIGO, the *cons operator* is infix and noted `, ...`. It is +not symmetric: on the left lies the element to cons, and, on the +right, a list on which to cons. + +```reasonligo group=b +let larger_list : list (int) = [5, ...my_list]; +``` + + + +
+ +> 💡 Lists can be iterated, folded or mapped to different values. You +> can find additional examples +> [here](https://gitlab.com/ligolang/ligo/tree/dev/src/test/contracts) +> and other built-in operators +> [here](https://gitlab.com/ligolang/ligo/blob/dev/src/passes/operators/operators.ml#L59) + +### Mapping of a List + +We may want to apply a function to all the elements of a list and +obtain the resulting list, in the same order. For example, we may want +to create a list that contains all the elements of another list +incremented by one. This is a special case of *fold operation* called +a *map operation*. Map operations (not to be confused by the +[map data structure](language-basics/maps-records.md)), are predefined +functions in LIGO. They take as a parameter the function to apply to +all the elements. Of course, that function must return a value of the +same type as the element. + + + + + +In PascaLIGO, the map function is called `list_map`. + +```pascaligo group=b +function increment (const i : int): int is i + 1 + +// Creates a new list with all elements incremented by 1 +const plus_one : list (int) = list_map (increment, larger_list) +``` + + + +In CameLIGO, the map function is called `List.map`. + +```cameligo group=b +let increment (i : int) : int = i + 1 + +// Creates a new list with all elements incremented by 1 +let plus_one : int list = List.map increment larger_list +``` + + + +In CameLIGO, the map function is called `List.map`. + +```reasonligo group=b +let increment = (i : int) : int => i + 1; + +// Creates a new list with all elements incremented by 1 +let plus_one : list (int) = List.map (increment, larger_list); +``` + + + + +### Folding of over a List + + + +```pascaligo group=b +function sum (const acc : int; const i : int): int is acc + i + +const sum_of_elements : int = list_fold (sum, my_list, 0) +``` + + + +```cameligo group=b +let sum (acc, i: int * int) : int = acc + i +let sum_of_elements : int = List.fold sum my_list 0 +``` + + + +```reasonligo group=b +let sum = ((result, i): (int, int)): int => result + i; +let sum_of_elements : int = List.fold (sum, my_list, 0); +``` + + + + +## Sets + +Sets are unordered collections of values of the same type, like lists +are ordered collections. Like the mathematical sets and lists, sets +can be empty and, if not, elements of sets in LIGO are *unique*, +whereas they can be repeated in a list. + +### Empty Sets + + + +```pascaligo group=a +const my_set : set (int) = set [] +``` + +```cameligo group=a +let my_set : int set = (Set.empty : int set) +``` + +```reasonligo group=a +let my_set : set (int) = (Set.empty : set (int)); +``` + + +### Non-empty Sets + + + + + +In PascaLIGO, the notation for sets is similar to that for lists, +except the keyword `set` is used before: + +```pascaligo group=a +const my_set : set (int) = set [3; 2; 2; 1] +``` + +You can check that `2` is not repeated in `my_set` by using the LIGO +compiler like this (the output will sort the elements of the set, but +that order is not significant for the compiler): + +```shell +ligo evaluate-value +gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo my_set +# Outputs: { 3 ; 2 ; 1 } +``` + + + +In CameLIGO, there is no predefined syntactic construct for sets: you +must build your set by adding to the empty set. (This is the way in +OCaml.) + +```cameligo group=a +let my_set : int set = + Set.add 3 (Set.add 2 (Set.add 2 (Set.add 1 (Set.empty : int set)))) +``` + +You can check that `2` is not repeated in `my_set` by using the LIGO +compiler like this (the output will sort the elements of the set, but +that order is not significant for the compiler): + +```shell +ligo evaluate-value +gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo my_set +# Outputs: { 3 ; 2 ; 1 } +``` + + + +In ReasonLIGO, there is no predefined syntactic construct for sets: +you must build your set by adding to the empty set. (This is the way +in OCaml.) + +```reasonligo group=a +let my_set : set (int) = + Set.add (3, Set.add (2, Set.add (2, Set.add (1, Set.empty : set (int))))); +``` + +You can check that `2` is not repeated in `my_set` by using the LIGO +compiler like this (the output will sort the elements of the set, but +that order is not significant for the compiler): + +```shell +ligo evaluate-value +gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo my_set +# Outputs: { 3 ; 2 ; 1 } +``` + + + +### Set Membership + + + + + +PascaLIGO features a special keyword `constains` that operates like an +infix operator checking membership in a set. + +```pascaligo group=a +const contains_3 : bool = my_set contains 3 +``` + + +```cameligo group=a +let contains_3 : bool = Set.mem 3 my_set +``` + + +```reasonligo group=a +let contains_3 : bool = Set.mem (3, my_set); +``` + + + + +### Cardinal + + + + +```pascaligo group=a +const set_size : nat = size (my_set) +``` + + +```cameligo group=a +let set_size : nat = Set.size my_set +``` + + +```reasonligo group=a +let set_size : nat = Set.size (my_set); +``` + + + + +### Adding or Removing from a Set + + + + + +In PascaLIGO, there are two ways to update a set. Either we create a +new set from the given one, or we modify it in-place. First, let us +consider the former: + +```pascaligo group=a +const larger_set : set (int) = set_add (4, my_set) + +const smaller_set : set (int) = set_remove (3, my_set) +``` + +If we are in a block, we can use an instruction to modify the set +bound to a given variable. This is called a *patch*. It is only +possible to add elements by means of a patch, not remove any: it is +the union of two sets. + +In the following example, the parameter set `s` of function `update` +is augmented (as the `with s` shows) to include `4` and `7`, that is, +this instruction is equivalent to perform the union of two sets, one +that is modified in-place, and the other given as a literal +(extensional definition). + +``pascaligo group=a +function update (var s : set (int)) : set (int) is block { + patch s with set [4; 7] +} with s + +const new_set : set (int) = update (my_set) +``` + + + +In CameLIGO, we update a given set by creating another one, with or +without some elements. + +```cameligo group=a +let larger_set : int set = Set.add 4 my_set + +let smaller_set : int set = Set.remove 3 my_set +``` + + + +In ReasonLIGO, we update a given set by creating another one, with or +without some elements. + +```reasonligo group=a +let larger_set : set (int) = Set.add (4, my_set); + +let smaller_set : set (int) = Set.remove (3, my_set); +``` + + + + +### Folding over a Set + + + +Given a set, we may want to apply a function in turn to all the +elements it contains, while accumulating some value which is returned +at the end. This is a *fold operation*. In the following example, we +sum up all the elements of the set `my_set` defined above. + + + +In PascaLIGO, the folded function takes the accumulator first and the +(current) set element second. The predefined fold is called `set_fold`. + +```pascaligo group=a +function sum (const acc : int; const i : int): int is acc + i + +const sum_of_elements : int = set_fold (sum, my_set, 0) +``` + +It is possible to use a *loop* over a set as well. + +```pascaligo group=a +function loop (const s : set (int)) : int is block { + var sum : int := 0; + for element in set s block { + sum := sum + element + } +} with sum +``` + + + +In CameLIGO, the predefined fold over sets is called `Set.fold`. + +```cameligo group=a +let sum (acc, i : int * int) : int = acc + i + +let sum_of_elements : int = Set.fold sum my_set 0 +``` + + +` +In ReasonLIGO, the predefined fold over sets is called `Set.fold`. + +``reasonligo group=a +let sum = ((acc, i) : (int, int)) : int => acc + i; + +let sum_of_elements : int = Set.fold (sum, my_set, 0); +``` + + + diff --git a/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.ligo b/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.ligo new file mode 100644 index 000000000..68f01d71b --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.ligo @@ -0,0 +1,4 @@ +type magnitude is Small | Large // See variant types + +function compare (const n : nat) : magnitude is + if n < 10n then Small (Unit) else Large (Unit) diff --git a/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.mligo b/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.mligo new file mode 100644 index 000000000..0a1f9d513 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.mligo @@ -0,0 +1,4 @@ +type magnitude = Small | Large // See variant types + +let compare (n : nat) : magnitude = + if n < 10n then Small else Large diff --git a/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.religo b/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.religo new file mode 100644 index 000000000..76bb0b7d2 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/boolean-if-else/cond.religo @@ -0,0 +1,4 @@ +type magnitude = | Small | Large; // See variant types + +let compare = (n : nat) : magnitude => + if (n < 10n) { Small; } else { Large; }; diff --git a/gitlab-pages/docs/language-basics/src/boolean-if-else/if-else.ligo b/gitlab-pages/docs/language-basics/src/boolean-if-else/if-else.ligo deleted file mode 100644 index cc2b84529..000000000 --- a/gitlab-pages/docs/language-basics/src/boolean-if-else/if-else.ligo +++ /dev/null @@ -1,4 +0,0 @@ -const min_age: nat = 16n; - -function is_adult(const age: nat): bool is - if (age > min_age) then True else False \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/functions/add.ligo b/gitlab-pages/docs/language-basics/src/functions/add.ligo deleted file mode 100644 index 9337b1668..000000000 --- a/gitlab-pages/docs/language-basics/src/functions/add.ligo +++ /dev/null @@ -1,4 +0,0 @@ -function add(const a: int; const b: int): int is - begin - const result: int = a + b; - end with result; \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/functions/anon.ligo b/gitlab-pages/docs/language-basics/src/functions/anon.ligo index b7f6f14f9..6018cf554 100644 --- a/gitlab-pages/docs/language-basics/src/functions/anon.ligo +++ b/gitlab-pages/docs/language-basics/src/functions/anon.ligo @@ -1,3 +1,4 @@ -const increment : (int -> int) = (function (const i : int) : int is i + 1); -// a = 2 -const a: int = increment(1); \ No newline at end of file +function increment (const b : int) : int is + (function (const a : int) : int is a + 1) (b) + +const a : int = increment (1); // a = 2 diff --git a/gitlab-pages/docs/language-basics/src/functions/anon.mligo b/gitlab-pages/docs/language-basics/src/functions/anon.mligo new file mode 100644 index 000000000..db47b030a --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/anon.mligo @@ -0,0 +1,2 @@ +let increment (b : int) : int = (fun (a : int) -> a + 1) b +let a : int = increment 1 // a = 2 diff --git a/gitlab-pages/docs/language-basics/src/functions/anon.religo b/gitlab-pages/docs/language-basics/src/functions/anon.religo new file mode 100644 index 000000000..939723d3b --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/anon.religo @@ -0,0 +1,2 @@ +let increment = (b : int) : int => ((a : int) : int => a + 1)(b); +let a : int = increment (1); // a = 2 diff --git a/gitlab-pages/docs/language-basics/src/functions/blockless.ligo b/gitlab-pages/docs/language-basics/src/functions/blockless.ligo index 6745c09e8..2ad367d58 100644 --- a/gitlab-pages/docs/language-basics/src/functions/blockless.ligo +++ b/gitlab-pages/docs/language-basics/src/functions/blockless.ligo @@ -1 +1 @@ -function add(const a: int; const b: int): int is a + b \ No newline at end of file +function add (const a: int; const b: int): int is a + b \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/functions/blockless.mligo b/gitlab-pages/docs/language-basics/src/functions/blockless.mligo new file mode 100644 index 000000000..f9f861c0f --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/blockless.mligo @@ -0,0 +1 @@ +let add (a : int) (b : int) : int = a + b diff --git a/gitlab-pages/docs/language-basics/src/functions/blockless.religo b/gitlab-pages/docs/language-basics/src/functions/blockless.religo new file mode 100644 index 000000000..dd9f8eb09 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/blockless.religo @@ -0,0 +1 @@ +let add = ((a, b): (int, int)) : int => a + b; diff --git a/gitlab-pages/docs/language-basics/src/functions/curry.mligo b/gitlab-pages/docs/language-basics/src/functions/curry.mligo new file mode 100644 index 000000000..3de7b4164 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/curry.mligo @@ -0,0 +1,3 @@ +let add (a, b : int * int) : int = a + b // Uncurried +let add_curry (a : int) (b : int) : int = add (a,b) // Curried +let increment (b : int) : int = add_curry 1 // Partial application diff --git a/gitlab-pages/docs/language-basics/src/loops/collection.ligo b/gitlab-pages/docs/language-basics/src/loops/collection.ligo new file mode 100644 index 000000000..cfca6d962 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/loops/collection.ligo @@ -0,0 +1,22 @@ +function sum_list (var l : list (int)) : int is block { + var total : int := 0; + for i in list l block { + total := total + i + } +} with total + +function sum_set (var s : set (int)) : int is block { + var total : int := 0; + for i in set s block { + total := total + i + } +} with total + +function sum_map (var m : map (string, int)) : string * int is block { + var string_total : string := ""; + var int_total : int := 0; + for key -> value in map m block { + string_total := string_total ^ key; + int_total := int_total + value + } +} with (string_total, int_total) diff --git a/gitlab-pages/docs/language-basics/src/loops/gcd.ligo b/gitlab-pages/docs/language-basics/src/loops/gcd.ligo new file mode 100644 index 000000000..176ab8def --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/loops/gcd.ligo @@ -0,0 +1,14 @@ +function gcd (var x : nat; var y : nat) : nat is block { + if x < y then + block { + const z : nat = x; + x := y; y := z + } + else skip; + var r : nat := 0n; + while y =/= 0n block { + r := x mod y; + x := y; + y := r + } +} with x diff --git a/gitlab-pages/docs/language-basics/src/loops/gcd.mligo b/gitlab-pages/docs/language-basics/src/loops/gcd.mligo new file mode 100644 index 000000000..4ec3924d1 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/loops/gcd.mligo @@ -0,0 +1,7 @@ +let iter (x,y : nat * nat) : bool * (nat * nat) = + if y = 0n then stop (x,y) else continue (y, x mod y) + +let gcd (x,y : nat * nat) : nat = + let x,y = if x < y then y,x else x,y in + let x,y = Loop.fold_while iter (x,y) + in x diff --git a/gitlab-pages/docs/language-basics/src/loops/gcd.religo b/gitlab-pages/docs/language-basics/src/loops/gcd.religo new file mode 100644 index 000000000..d201b8314 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/loops/gcd.religo @@ -0,0 +1,7 @@ +let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => + if (y == 0n) { stop ((x,y)); } else { continue ((y, x mod y)); }; + +let gcd = ((x,y) : (nat, nat)) : nat => + let (x,y) = if (x < y) { (y,x); } else { (x,y); }; + let (x,y) = Loop.fold_while (iter, (x,y)); + x; diff --git a/gitlab-pages/docs/language-basics/src/loops/sum.ligo b/gitlab-pages/docs/language-basics/src/loops/sum.ligo new file mode 100644 index 000000000..58292ae81 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/loops/sum.ligo @@ -0,0 +1,6 @@ +function sum (var n : nat) : int is block { + var acc : int := 0; + for i := 1 to int (n) block { + acc := acc + i + } +} with acc \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/maps-records/record_patch.ligo b/gitlab-pages/docs/language-basics/src/maps-records/record_patch.ligo new file mode 100644 index 000000000..5e673150d --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/maps-records/record_patch.ligo @@ -0,0 +1,10 @@ +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is + block { + patch p with record [x = p.x + vec.dx]; + patch p with record [y = p.y + vec.dy] + } with p diff --git a/gitlab-pages/docs/language-basics/src/maps-records/record_patch2.ligo b/gitlab-pages/docs/language-basics/src/maps-records/record_patch2.ligo new file mode 100644 index 000000000..c8666d95e --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/maps-records/record_patch2.ligo @@ -0,0 +1,9 @@ +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is + block { + patch p with record [x = p.x + vec.dx; y = p.y + vec.dy] + } with p diff --git a/gitlab-pages/docs/language-basics/src/maps-records/record_simu.ligo b/gitlab-pages/docs/language-basics/src/maps-records/record_simu.ligo new file mode 100644 index 000000000..0e7bb9f3d --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/maps-records/record_simu.ligo @@ -0,0 +1,8 @@ +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is block { + const p : point = p with record [x = p.x + vec.dx; y = p.y + vec.dy] +} with p diff --git a/gitlab-pages/docs/language-basics/src/maps-records/record_update.ligo b/gitlab-pages/docs/language-basics/src/maps-records/record_update.ligo new file mode 100644 index 000000000..ddfc32981 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/maps-records/record_update.ligo @@ -0,0 +1,7 @@ +type point is record [x : int; y : int; z : int] +type vector is record [dx : int; dy : int] + +const origin : point = record [x = 0; y = 0; z = 0] + +function xy_translate (var p : point; const vec : vector) : point is + p with record [x = p.x + vec.dx; y = p.y + vec.dy] diff --git a/gitlab-pages/docs/language-basics/src/maps-records/record_update.mligo b/gitlab-pages/docs/language-basics/src/maps-records/record_update.mligo new file mode 100644 index 000000000..9df753032 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/maps-records/record_update.mligo @@ -0,0 +1,7 @@ +type point = {x : int; y : int; z : int} +type vector = {dx : int; dy : int} + +let origin : point = {x = 0; y = 0; z = 0} + +let xy_translate (p, vec : point * vector) : point = + {p with x = p.x + vec.dx; y = p.y + vec.dy} diff --git a/gitlab-pages/docs/language-basics/src/maps-records/record_update.religo b/gitlab-pages/docs/language-basics/src/maps-records/record_update.religo new file mode 100644 index 000000000..d853367f9 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/maps-records/record_update.religo @@ -0,0 +1,7 @@ +type point = {x : int, y : int, z : int}; +type vector = {dx : int, dy : int}; + +let origin : point = {x : 0, y : 0, z : 0}; + +let xy_translate = ((p, vec) : (point, vector)) : point => + {...p, x : p.x + vec.dx, y : p.y + vec.dy}; diff --git a/gitlab-pages/docs/language-basics/src/math-numbers-tez/addition.ligo b/gitlab-pages/docs/language-basics/src/math-numbers-tez/addition.ligo deleted file mode 100644 index 690b22836..000000000 --- a/gitlab-pages/docs/language-basics/src/math-numbers-tez/addition.ligo +++ /dev/null @@ -1,13 +0,0 @@ -// int + int produces int -const a: int = 5 + 10; -// nat + int produces int -const b: int = 5n + 10; -// tez + tez produces tez -const c: tez = 5mutez + 10mutez; -// you can't add tez + int or tez + nat, this won't compile -// const d: tez = 5mutez + 10n; -// two nats produce a nat -const e: nat = 5n + 10n; -// nat + int produces an int, this won't compile -// const f: nat = 5n + 10; -const g: int = 1_000_000; \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/math-numbers-tez/casting.ligo b/gitlab-pages/docs/language-basics/src/math-numbers-tez/casting.ligo deleted file mode 100644 index a0a5c9f83..000000000 --- a/gitlab-pages/docs/language-basics/src/math-numbers-tez/casting.ligo +++ /dev/null @@ -1,2 +0,0 @@ -const a: int = int(1n); -const b: nat = abs(1); \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/math-numbers-tez/division.ligo b/gitlab-pages/docs/language-basics/src/math-numbers-tez/division.ligo deleted file mode 100644 index 622235e3e..000000000 --- a/gitlab-pages/docs/language-basics/src/math-numbers-tez/division.ligo +++ /dev/null @@ -1,5 +0,0 @@ -const a: int = 10 / 3; -const b: nat = 10n / 3n; -const c: nat = 10mutez / 3mutez; - -const d: int = 10 / 5 / 2 * 5; \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/math-numbers-tez/isnat.ligo b/gitlab-pages/docs/language-basics/src/math-numbers-tez/isnat.ligo deleted file mode 100644 index 5a89add1a..000000000 --- a/gitlab-pages/docs/language-basics/src/math-numbers-tez/isnat.ligo +++ /dev/null @@ -1 +0,0 @@ -const its_a_nat: option(nat) = is_nat(1) \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/math-numbers-tez/multiplication.ligo b/gitlab-pages/docs/language-basics/src/math-numbers-tez/multiplication.ligo deleted file mode 100644 index 95bdef4ab..000000000 --- a/gitlab-pages/docs/language-basics/src/math-numbers-tez/multiplication.ligo +++ /dev/null @@ -1,3 +0,0 @@ -const a: int = 5 * 5; -const b: nat = 5n * 5n; -const c: tez = 5n * 5mutez; \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/math-numbers-tez/substraction.ligo b/gitlab-pages/docs/language-basics/src/math-numbers-tez/substraction.ligo deleted file mode 100644 index cefcd4947..000000000 --- a/gitlab-pages/docs/language-basics/src/math-numbers-tez/substraction.ligo +++ /dev/null @@ -1,6 +0,0 @@ -const a: int = 5 - 10; -// substraction of two nats, yields an int -const b: int = 5n - 2n; -// won't compile, result is an int, not a nat -// const c: nat = 5n - 2n; -const d: tez = 5mutez - 1mutez; \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/sets-lists-touples/empty-set.ligo b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/empty-set.ligo similarity index 100% rename from gitlab-pages/docs/language-basics/src/sets-lists-touples/empty-set.ligo rename to gitlab-pages/docs/language-basics/src/sets-lists-tuples/empty-set.ligo diff --git a/gitlab-pages/docs/language-basics/src/sets-lists-tuples/lists.ligo b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/lists.ligo new file mode 100644 index 000000000..7d2d49fbc --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/lists.ligo @@ -0,0 +1,12 @@ +const my_list : list (int) = list [1; 2; 2] // The head is 1 + +const larger_list : int_list = 5 # my_list + +function increment (const i : int): int is i + 1 + +// Creates a new list with all elements incremented by 1 +const plus_one : list (int) = list_map (increment, larger_list); + +function sum (const acc : int; const i : int): int is acc + i + +const sum_of_elements : int = list_fold (sum, my_list, 0) diff --git a/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo new file mode 100644 index 000000000..b6ede8212 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo @@ -0,0 +1,28 @@ +type int_set is set (int) + +const my_set : int_set = set [3; 2; 2; 1] + +const contains_3 : bool = my_set contains 3 + +const set_size : nat = size (my_set) + +const larger_set : int_set = set_add (4, my_set) + +const smaller_set : int_set = set_remove (3, my_set) + +function update (var s : set (int)) : set (int) is block { + patch s with set [4; 7] +} with s + +const new_set : set (int) = update (my_set) + +function sum (const acc : int; const i : int): int is acc + i + +const sum_of_elements : int = set_fold (sum, my_set, 0) + +function loop (const s : set (int)) : int is block { + var sum : int := 0; + for element in set s block { + sum := sum + element + } +} with sum diff --git a/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo new file mode 100644 index 000000000..9fd44a62e --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo @@ -0,0 +1,16 @@ +type int_set = int set + +let my_set : int_set = + Set.add 3 (Set.add 2 (Set.add 2 (Set.add 1 (Set.empty : int set)))) + +let contains_3 : bool = Set.mem 3 my_set + +let set_size : nat = Set.size my_set + +let larger_set : int_set = Set.add 4 my_set + +let smaller_set : int_set = Set.remove 3 my_set + +let sum (acc, i : int * int) : int = acc + i + +let sum_of_elements : int = Set.fold sum my_set 0 diff --git a/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo new file mode 100644 index 000000000..6727ed8d2 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo @@ -0,0 +1,16 @@ +type int_set = set (int); + +let my_set : int_set = + Set.add (3, Set.add (2, Set.add (2, Set.add (1, Set.empty : set (int))))); + +let contains_3 : bool = Set.mem (3, my_set); + +let set_size : nat = Set.size (my_set); + +let larger_set : int_set = Set.add (4, my_set); + +let smaller_set : int_set = Set.remove (3, my_set); + +let sum = ((acc, i) : (int, int)) : int => acc + i; + +let sum_of_elements : int = Set.fold (sum, my_set, 0); diff --git a/gitlab-pages/docs/language-basics/src/strings/concat.ligo b/gitlab-pages/docs/language-basics/src/strings/concat.ligo deleted file mode 100644 index 7b80e8510..000000000 --- a/gitlab-pages/docs/language-basics/src/strings/concat.ligo +++ /dev/null @@ -1 +0,0 @@ -const a: string = string_concat("Hello ", "World"); \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/types/alias.ligo b/gitlab-pages/docs/language-basics/src/types/alias.ligo deleted file mode 100644 index d0b6414e6..000000000 --- a/gitlab-pages/docs/language-basics/src/types/alias.ligo +++ /dev/null @@ -1,2 +0,0 @@ -type animalBreed is string; -const dogBreed : animalBreed = "Saluki"; \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/types/annotation.ligo b/gitlab-pages/docs/language-basics/src/types/annotation.ligo deleted file mode 100644 index 9373e08ec..000000000 --- a/gitlab-pages/docs/language-basics/src/types/annotation.ligo +++ /dev/null @@ -1,4 +0,0 @@ -type int_map is map(int, int); -function get_first(const int_map: int_map): option(int) is int_map[1] -// empty map needs a type annotation -const first: option(int) = get_first(((map end) : int_map )); \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/types/composed-types.ligo b/gitlab-pages/docs/language-basics/src/types/composed-types.ligo deleted file mode 100644 index 3929e9de6..000000000 --- a/gitlab-pages/docs/language-basics/src/types/composed-types.ligo +++ /dev/null @@ -1,19 +0,0 @@ -// alias two types -type account is address; -type numberOfTransactions is nat; -// accountData consists of a record with two fields (balance, numberOfTransactions) -type accountData is record - balance: tez; - numberOfTransactions: numberOfTransactions; -end -// our ledger / accountBalances is a map of account <-> accountData -type accountBalances is map(account, accountData); - -// pseudo-JSON representation of our map -// { "tz1...": {balance: 10mutez, numberOfTransactions: 5n} } -const ledger: accountBalances = map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> record - balance = 10mutez; - numberOfTransactions = 5n; - end -end \ No newline at end of file diff --git a/gitlab-pages/docs/language-basics/src/types/simple-type.ligo b/gitlab-pages/docs/language-basics/src/types/simple-type.ligo index be96bd52a..c053e2eac 100644 --- a/gitlab-pages/docs/language-basics/src/types/simple-type.ligo +++ b/gitlab-pages/docs/language-basics/src/types/simple-type.ligo @@ -1,6 +1,7 @@ -// accountBalances is a simple type, a map of address <-> tez -type accountBalances is map(address, tez); +// The type accountBalances denotes maps from addresses to tez -const ledger: accountBalances = map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> 10mutez -end \ No newline at end of file +type account_balances is map (address, tez) + +const ledger : account_balances = + map + [("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> 10mutez] diff --git a/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.ligo b/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.ligo new file mode 100644 index 000000000..5f54bc61e --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.ligo @@ -0,0 +1,7 @@ +type coin is Head | Tail + +function flip (const c : coin) : coin is + case c of + Head -> Tail (Unit) // Unit needed because of a bug + | Tail -> Head (Unit) // Unit needed because of a bug + end diff --git a/gitlab-pages/docs/language-basics/src/variables-and-constants/add.ligo b/gitlab-pages/docs/language-basics/src/variables-and-constants/add.ligo index 148d7f2ee..d79db175e 100644 --- a/gitlab-pages/docs/language-basics/src/variables-and-constants/add.ligo +++ b/gitlab-pages/docs/language-basics/src/variables-and-constants/add.ligo @@ -1,7 +1,4 @@ -// won't work, use const for global values instead -// var four: int = 4; - -function add(const a: int; const b: int) : int is - block { - var c : int := a + b; - } with c \ No newline at end of file +function add (const a : int; const b : int) : int is + block { + var c : int := a + b + } with c diff --git a/gitlab-pages/docs/language-basics/src/variables-and-constants/add.mligo b/gitlab-pages/docs/language-basics/src/variables-and-constants/add.mligo new file mode 100644 index 000000000..d82e20eb5 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/variables-and-constants/add.mligo @@ -0,0 +1,2 @@ +let add (a : int) (b : int) : int = + let c : int = a + b in c diff --git a/gitlab-pages/docs/language-basics/src/variables-and-constants/add.religo b/gitlab-pages/docs/language-basics/src/variables-and-constants/add.religo index 0cabb6def..0dace01b4 100644 --- a/gitlab-pages/docs/language-basics/src/variables-and-constants/add.religo +++ b/gitlab-pages/docs/language-basics/src/variables-and-constants/add.religo @@ -1,4 +1,4 @@ -let add = (a: int, b: int): int => { +let add = (a: int, b: int) : int => { let c: int = a + b; c; -}; \ No newline at end of file +}; diff --git a/gitlab-pages/docs/language-basics/src/variables-and-constants/const.mligo b/gitlab-pages/docs/language-basics/src/variables-and-constants/const.mligo new file mode 100644 index 000000000..878531d2d --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/variables-and-constants/const.mligo @@ -0,0 +1 @@ +let age : int = 25 diff --git a/gitlab-pages/docs/language-basics/strings.md b/gitlab-pages/docs/language-basics/strings.md index 86e5e6b55..297edee09 100644 --- a/gitlab-pages/docs/language-basics/strings.md +++ b/gitlab-pages/docs/language-basics/strings.md @@ -3,22 +3,20 @@ id: strings title: Strings --- - - Strings are defined using the built-in `string` type like this: ``` -const a: string = "Hello Alice"; +const a : string = "Hello Alice" ``` ``` -let a: string = "Hello Alice" +let a : string = "Hello Alice" ``` ```reasonligo -let a: string = "Hello Alice"; +let a : string = "Hello Alice"; ``` @@ -30,77 +28,74 @@ let a: string = "Hello Alice"; Strings can be concatenated using the `^` operator. ```pascaligo -const name: string = "Alice"; -const greeting: string = "Hello"; -// Hello Alice -const full_greeting: string = greeting ^ " " ^ name; -// Hello Alice! (alternatively) -const full_greeting_exclamation: string = string_concat(full_greeting, "!"); +const name : string = "Alice" +const greeting : string = "Hello" +const full_greeting : string = greeting ^ " " ^ name ``` Strings can be concatenated using the `^` operator. ```cameligo -let name: string = "Alice" -let greeting: string = "Hello" -let full_greeting: string = greeting ^ " " ^ name +let name : string = "Alice" +let greeting : string = "Hello" +let full_greeting : string = greeting ^ " " ^ name ``` Strings can be concatenated using the `++` operator. ```reasonligo -let name: string = "Alice"; -let greeting: string = "Hello"; -let full_greeting: string = greeting ++ " " ++ name; +let name : string = "Alice"; +let greeting : string = "Hello"; +let full_greeting : string = greeting ++ " " ++ name; ``` ## Slicing strings -Strings can be sliced using the syntax specific built-in built-in function: +Strings can be sliced using a built-in function: ```pascaligo -const name: string = "Alice"; -// slice = "A" -const slice: string = string_slice(0n, 1n, name); +const name : string = "Alice" +const slice : string = string_slice (0n, 1n, name) ``` ```cameligo -let name: string = "Alice" -let slice: string = String.slice 0n 1n name +let name : string = "Alice" +let slice : string = String.slice 0n 1n name ``` ```reasonligo -let name: string = "Alice"; -let slice: string = String.slice(0n, 1n, name); +let name : string = "Alice"; +let slice : string = String.slice (0n, 1n, name); ``` -> ⚠️ Notice that the `offset` and slice `length` are `nats` +> ⚠️ Notice that the `offset` and slice `length` are natural numbers +> (`nat`). ## Aquiring the length of a string -The length of a string can be found using the syntax specific built-in function: +The length of a string can be found using a built-in function: ```pascaligo -const name: string = "Alice"; +const name : string = "Alice" // length = 5 -const length: nat = size(name); +const length : nat = size (name) ``` ```cameligo -let name: string = "Alice" -let length: nat = String.size name +let name : string = "Alice" +let length : nat = String.size name ``` ```reasonligo -let name: string = "Alice"; -let length: nat = String.size(name); +let name : string = "Alice"; +let length : nat = String.size (name); ``` diff --git a/gitlab-pages/docs/language-basics/tezos-specific.md b/gitlab-pages/docs/language-basics/tezos-specific.md index 5c9e0b1a6..a1f8c17dc 100644 --- a/gitlab-pages/docs/language-basics/tezos-specific.md +++ b/gitlab-pages/docs/language-basics/tezos-specific.md @@ -3,38 +3,45 @@ id: tezos-specific title: Tezos Domain-Specific Operations --- -LIGO is a language for writing Tezos smart contracts. It would be a little odd if -it didn't have any Tezos specific functions. This page will tell you about them. +LIGO is a programming language for writing Tezos smart contracts. It +would be a little odd if it did not have any Tezos specific +functions. This page will tell you about them. -## Pack and Unpack +## Pack and unpack -Michelson provides the `PACK` and `UNPACK` instructions for data serialization. -`PACK` converts Michelson data structures to a binary format, and `UNPACK` -reverses it. This functionality can be accessed from within LIGO. +Michelson provides the `PACK` and `UNPACK` instructions for data +serialization. The instruction `PACK` converts Michelson data +structures into a binary format, and `UNPACK` reverses that +transformation. This functionality can be accessed from within LIGO. -> ⚠️ `PACK` and `UNPACK` are features of Michelson that are intended to be used by people that really know what they're doing. There are several failure cases (such as `UNPACK`ing a lambda from an untrusted source), most of which are beyond the scope of this document. Don't use these functions without doing your homework first. +> ⚠️ `PACK` and `UNPACK` are Michelson instructions that are intended +> to be used by people that really know what they are doing. There are +> several risks and failure cases, such as unpacking a lambda from an +> untrusted source, and most of which are beyond the scope of this +> document. Do not use these functions without doing your homework +> first. -```pascaligo -function id_string (const p : string) : option(string) is block { - const packed : bytes = bytes_pack(p) ; -} with (bytes_unpack(packed): option(string)) +```pascaligo group=a +function id_string (const p : string) : option (string) is block { + const packed : bytes = bytes_pack (p) +} with (bytes_unpack (packed): option (string)) ``` -```cameligo -let id_string (p: string) : string option = +```cameligo group=a +let id_string (p : string) : string option = let packed: bytes = Bytes.pack p in - ((Bytes.unpack packed): string option) + (Bytes.unpack packed : string option) ``` -```reasonligo -let id_string = (p: string) : option(string) => { - let packed : bytes = Bytes.pack(p); - ((Bytes.unpack(packed)): option(string)); +```reasonligo group=a +let id_string = (p : string) : option (string) => { + let packed : bytes = Bytes.pack (p); + (Bytes.unpack(packed) : option (string)); }; ``` @@ -42,41 +49,35 @@ let id_string = (p: string) : option(string) => { ## Hashing Keys -It's often desirable to hash a public key. In Michelson, certain data structures -such as maps will not allow the use of the `key` type. Even if this weren't the case -hashes are much smaller than keys, and storage on blockchains comes at a cost premium. -You can hash keys with the `key_hash` type and associated built in function. +It is often desirable to hash a public key. In Michelson, certain data +structures such as maps will not allow the use of the `key` type. Even +if this were not the case, hashes are much smaller than keys, and +storage on blockchains comes at a cost premium. You can hash keys an +predefined function returning a value of type `key_hash`. -```pascaligo +```pascaligo group=b function check_hash_key (const kh1 : key_hash; const k2 : key) : bool * key_hash is block { - var ret : bool := False ; - var kh2 : key_hash := crypto_hash_key(k2) ; - if kh1 = kh2 then ret := True else skip; + var ret : bool := False; + var kh2 : key_hash := crypto_hash_key (k2); + if kh1 = kh2 then ret := True else skip } with (ret, kh2) ``` -```cameligo -let check_hash_key (kh1, k2: key_hash * key) : bool * key_hash = +```cameligo group=b +let check_hash_key (kh1, k2 : key_hash * key) : bool * key_hash = let kh2 : key_hash = Crypto.hash_key k2 in - if kh1 = kh2 - then (true, kh2) - else (false, kh2) + if kh1 = kh2 then true, kh2 else false, kh2 ``` -```reasonligo -let check_hash_key = ((kh1, k2): (key_hash, key)) : (bool, key_hash) => { +```reasonligo group=b +let check_hash_key = ((kh1, k2) : (key_hash, key)) : (bool, key_hash) => { let kh2 : key_hash = Crypto.hash_key(k2); - if (kh1 == kh2) { - (true, kh2); - } - else { - (false, kh2); - } + if (kh1 == kh2) { (true, kh2); } else { (false, kh2); } }; ``` @@ -84,60 +85,66 @@ let check_hash_key = ((kh1, k2): (key_hash, key)) : (bool, key_hash) => { ## Checking Signatures -Sometimes a contract will want to check that a message has been signed by a -particular key. For example, a point-of-sale system might want a customer to -sign a transaction so it can be processed asynchronously. You can do this in LIGO -using the `key` and `signature` types. +Sometimes a contract will want to check that a message has been signed +by a particular key. For example, a point-of-sale system might want a +customer to sign a transaction so it can be processed +asynchronously. You can do this in LIGO using the `key` and +`signature` types. -> ⚠️ There is no way to *generate* a signed message in LIGO. This is because that would require storing a private key on chain, at which point it isn't very private anymore. +> ⚠️ There is no way to *generate* a signed message in LIGO. This is +> because that would require storing a private key on chain, at which +> point it is not... private anymore. -```pascaligo +```pascaligo group=c function check_signature - (const pk: key; - const signed: signature; - const msg: bytes) : bool - is crypto_check(pk, signed, msg) + (const pk : key; + const signed : signature; + const msg : bytes) : bool + is crypto_check (pk, signed, msg) ``` -```cameligo -let check_signature (pk, signed, msg: key * signature * bytes) : bool = +```cameligo group=c +let check_signature (pk, signed, msg : key * signature * bytes) : bool = Crypto.check pk signed msg ``` -```reasonligo -let check_signature = ((pk, signed, msg): (key, signature, bytes)) : bool => { - Crypto.check(pk, signed, msg); +```reasonligo group=c +let check_signature = + ((pk, signed, msg) : (key, signature, bytes)) : bool => { + Crypto.check (pk, signed, msg); }; ``` - -## Getting The Contract's Own Address -Often you want to get the address of the contract being executed. You can do it with -`self_address`. +## Getting the contract's own address -> ⚠️ Due to limitations in Michelson, self_address in a contract is only allowed at the entry-point level. Using it in a utility function will cause an error. +Often you want to get the address of the contract being executed. You +can do it with `self_address`. + +> ⚠️ Due to limitations in Michelson, `self_address` in a contract is +> only allowed at the entry-point level (a.k.a top-level). Using it in +> an auxiliaru function will cause an error. -```pascaligo -const current_addr : address = self_address; +```pascaligo group=d +const current_addr : address = self_address ``` -```cameligo +```cameligo group=d let current_addr : address = Current.self_address ``` -```reasonligo +```reasonligo group=d let current_addr : address = Current.self_address; ``` diff --git a/gitlab-pages/docs/language-basics/types.md b/gitlab-pages/docs/language-basics/types.md index b19004a2b..6654e7a3b 100644 --- a/gitlab-pages/docs/language-basics/types.md +++ b/gitlab-pages/docs/language-basics/types.md @@ -3,163 +3,189 @@ id: types title: Types --- -LIGO is strongly and statically typed. This means that the compiler checks your program at compilation time and makes sure there won't be any type related runtime errors. LIGO types are built on top of Michelson's type system. +LIGO is strongly and statically typed. This means that the compiler +checks your program at compilation time and, if it passes the tests, +this ensures that there will be no runtime error due to wrong +assumptions on the data. This is called *type checking*. + +LIGO types are built on top of Michelson's type system. ## Built-in types -For quick referrence, you can find all the built-in types [here](https://gitlab.com/ligolang/ligo/blob/dev/src/passes/operators/operators.ml#L35). +For quick reference, you can find all the built-in types [here](https://gitlab.com/ligolang/ligo/blob/dev/src/passes/operators/operators.ml#L35). ## Type aliases -Type aliasing is great for creating a readable / maintainable smart contract. One well typed type/variable is worth a thousand words. For example we can choose to *alias* a string as an animal breed - this will allow us to comunicate our intent with added clarity. +*Type aliasing* consists in renaming a given type, when the context +calls for a more precise name. This increases readability and +maintainability of your smart contracts. For example we can choose to +alias a string type as an animal breed - this will allow us to +comunicate our intent with added clarity. -```pascaligo -type animalBreed is string; -const dogBreed : animalBreed = "Saluki"; +```pascaligo group=a +type breed is string +const dog_breed : breed = "Saluki" ``` -```cameligo -type animal_breed = string -let dog_breed: animal_breed = "Saluki" +```cameligo group=a +type breed = string +let dog_breed : breed = "Saluki" ``` -```reasonligo -type animal_breed = string; -let dog_breed: animal_breed = "Saluki"; +```reasonligo group=a +type breed = string; +let dog_breed : breed = "Saluki"; ``` -> Types in LIGO are `structural`, which means that `animalBreed`/`animal_breed` and `string` are interchangable and are considered equal. +> The above type definitions are aliases, which means that `breed` and +> `string` are interchangable in all contexts. ## Simple types + -```pascaligo -// accountBalances is a simple type, a map of address <-> tez -type accountBalances is map(address, tez); +```pascaligo group=b +// The type accountBalances denotes maps from addresses to tez + +type account_balances is map (address, tez) + +const ledger : account_balances = + map + [("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> 10mutez] -const ledger: accountBalances = map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> 10mutez -end ``` -```cameligo -// account_balances is a simple type, a map of address <-> tez +```cameligo group=b +// The type account_balances denotes maps from addresses to tez + type account_balances = (address, tez) map -let ledger: account_balances = Map.literal - [(("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), 10mutez)] +let ledger : account_balances = + Map.literal + [(("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address), 10mutez)] ``` -```reasonligo -(* account_balances is a simple type, a map of address <-> tez *) -type account_balances = map(address, tez); +```reasonligo group=b +// The type account_balances denotes maps from addresses to tez + +type account_balances = map (address, tez); let ledger: account_balances = - Map.literal([ - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, 10mutez) - ]); + Map.literal + ([("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, 10mutez)]); ``` -## Composed types +## Structured types -Often contracts require complex data structures, which in turn require well-typed storage or functions to work with. LIGO offers a simple way to compose simple types into larger & more expressive composed types. +Often contracts require complex data structures, which in turn require +well-typed storage or functions to work with. LIGO offers a simple way +to compose simple types into *structured types*. -In the example below you can see the definition of data types for a ledger that keeps the balance and number of previous transactions for a given account. +The first of those structured types is the *record*, which aggregates +types as *fields* and index them with a *field name*. In the example +below you can see the definition of data types for a ledger that keeps +the balance and number of previous transactions for a given account. -```pascaligo -// alias two types -type account is address; -type numberOfTransactions is nat; -// accountData consists of a record with two fields (balance, numberOfTransactions) -type accountData is record - balance: tez; - numberOfTransactions: numberOfTransactions; -end -// our ledger / accountBalances is a map of account <-> accountData -type accountBalances is map(account, accountData); +```pascaligo group=c +// Type aliasing +type account is address +type number_of_transactions is nat -// pseudo-JSON representation of our map -// { "tz1...": {balance: 10mutez, numberOfTransactions: 5n} } -const ledger: accountBalances = map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> record - balance = 10mutez; - numberOfTransactions = 5n; - end -end +// The type account_data is a record with two fields. +type account_data is record [ + balance : tez; + transactions : number_of_transactions +] + +// A ledger is a map from accounts to account_data +type ledger is map (account, account_data) + +const my_ledger : ledger = map [ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> + record [ + balance = 10mutez; + transactions = 5n + ] +] ``` -```cameligo -(* alias two types *) +```cameligo group=c +// Type aliasing type account = address type number_of_transactions = nat -(* account_data consists of a record with two fields (balance, number_of_transactions) *) +// The type account_data is a record with two fields. type account_data = { - balance: tez; - number_of_transactions: number_of_transactions; + balance : tez; + transactions : number_of_transactions } -(* our ledger / account_balances is a map of account <-> account_data *) -type account_balances = (account, account_data) map +// A ledger is a map from accounts to account_data +type ledger = (account, account_data) map -// pseudo-JSON representation of our map -// {"tz1...": {balance: 10mutez, number_of_transactions: 5n}} -let ledger: account_balances = Map.literal - [(("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), - {balance = 10mutez; - number_of_transactions = 5n;} - )] +let my_ledger : ledger = Map.literal + [(("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address), + {balance = 10mutez; transactions = 5n})] ``` -```reasonligo -(* alias two types *) +```reasonligo group=c +// Type aliasing type account = address; type number_of_transactions = nat; -(* account_data consists of a record with two fields (balance, number_of_transactions) *) + +// The type account_data is a record with two fields. type account_data = { - balance: tez, - number_of_transactions, + balance : tez, + transactions : number_of_transactions }; -(* our ledger / account_balances is a map of account <-> account_data *) -type account_balances = map(account, account_data); -(* pseudo-JSON representation of our map - {"tz1...": {balance: 10mutez, number_of_transactions: 5n}} *) -let ledger: account_balances = +// A ledger is a map from accounts to account_data +type ledger = map (account, account_data); + +let my_ledger : ledger = Map.literal([ - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, - {balance: 10mutez, number_of_transactions: 5n}) - ]); - + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, + {balance: 10mutez, transactions: 5n})]); ``` +The structured types which are dual to records are the *variant types* +and they are described in the section about *pattern matching*. They +are dual because records are a product of types (types are bundled +into a record), whereas variant types are a sum of types (they are +exclusive to each other). + ## Annotations -In certain cases, type of an expression cannot be properly determined. This can be circumvented by annotating an expression with it's desired type, here's an example: +In certain cases, the type of an expression cannot be properly +inferred by the compiler. In order to help the type checke, you can +annotate an expression with its desired type. Here is an example: ```pascaligo -type int_map is map(int, int); -function get_first(const int_map: int_map): option(int) is int_map[1] -// empty map needs a type annotation -const first: option(int) = get_first(((map end) : int_map )); +type int_map is map (int, int) + +function get_first (const my_map : int_map): option (int) is my_map[1] + +// The empty map always needs a type annotation + +const first : option (int) = get_first (((map end) : int_map)) ``` - \ No newline at end of file + diff --git a/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md b/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md index 1bd8a4a7e..3243750cc 100644 --- a/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md +++ b/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md @@ -3,110 +3,162 @@ id: unit-option-pattern-matching title: Unit, Option, Pattern matching --- -Optionals are a programing pattern seen in OCaml. Since Michelson and LIGO are both inspired by OCaml, you'll have the *option* to use them in LIGO as well. +Optionals are a pervasive programing pattern in OCaml. Since Michelson +and LIGO are both inspired by OCaml, *optional types* are available in +LIGO as well. Similarly, OCaml features a *unit* type, and LIGO +features it as well. Both the option type and the unit types are +instances of a more general kind of types: *variant types* (sometimes +called *sum types*). -## Type unit +## The unit type -Units in Michelson or LIGO represent *for the lack of better words* - an empty/useless/not needed value. +The `unit` type in Michelson or LIGO is a predefined type that +contains only one value that carries no information. It is used when +no relevant information is required or produced. Here is how it used. -Here's how they're defined: - -> 💡 Units come in handy when we try pattern matching on custom variants below. +> 💡 Units come in handy when we try pattern matching on custom +> variants below. -```pascaligo -const n: unit = Unit; + +In PascaLIGO, the unique value of the `unit` type is `Unit`. +```pascaligo group=a +const n : unit = Unit ``` -```cameligo -let n: unit = () + +In CameLIGO, the unique value of the `unit` type is `()`, following +the OCaml convention. +```cameligo group=a +let n : unit = () ``` -```reasonligo -let n: unit = (); + +In ReasonLIGO, the unique value of the `unit` type is `()`, following +the OCaml convention. +```reasonligo group=a +let n : unit = (); ``` -## Variants +## Variant types -Variant is a user-defined or a built-in type (in case of optionals) that can be compared to Enum (from javascript). +A variant type is a user-defined or a built-in type (in case of +options) that defines a type by cases, so a value of a variant type is +either this, or that or... The simplest variant type is equivalent to +the enumerated types found in Java, C++, JavaScript etc. -Here's how to define a new variant type: +Here is how we define a coin as being either head or tail (and nothing +else): -```pascaligo +```pascaligo group=b +type coin is Head | Tail +const head : coin = Head (Unit) // Unit needed because of a bug +const tail : coin = Tail (Unit) // Unit needed because of a bug +``` + + +```cameligo group=b +type coin = Head | Tail +let head : coin = Head +let tail : coin = Tail +``` + + +```reasonligo group=b +type coin = | Head | Tail; +let head : coin = Head; +let tail : coin = Tail; +``` + + +The names `Head` and `Tail` in the definition of the type `coin` are +called *data constructors*, or *variants*. + +In general, it is interesting for variants to carry some information, +and thus go beyond enumerated types. In the following, we show how to +define different kinds of users of a system. + + + + +```pascaligo group=c type id is nat + type user is -| Admin of id + Admin of id | Manager of id +| Guest + +const u : user = Admin (1000n) +const g : user = Guest (Unit) // Unit needed because of a bug +``` + + +```cameligo group=c +type id = nat + +type user = + Admin of id +| Manager of id +| Guest + +let u : user = Admin 1000n +let g : user = Guest +``` + + +```reasonligo group=c +type id = nat; + +type user = +| Admin (id) +| Manager (id) | Guest; -const u: user = Admin(1000n); -const g: user = Guest(Unit); -``` - - -```cameligo -type id = nat -type user = -| Admin of id -| Manager of id -| Guest of unit - -let u: user = Admin 1000n -let g: user = Guest () -``` - - -```reasonligo -type id = nat; -type user = - | Admin(id) - | Manager(id) - | Guest(unit); - -let u: user = Admin(1000n); -let g: user = Guest(); +let u : user = Admin (1000n); +let g : user = Guest; ``` -Defining a varient can be extremely useful for building semantically appealing contracts. We'll learn how to use variants for 'logic purposes' shortly. +Defining a variant can be extremely useful for building semantically +appealing contracts. We will learn how to use variants for "logic +purposes"' shortly. ## Optional values -Optionals are a type of built-in variant that can be used to determine if a variable holds a certain value or not. This is especially useful when (for example) your program's state allows for a certain variable value to be empty, like this: +The `option` type is a predefined variant type that is used to express +whether there is a value of some type or none. This is especially +useful when calling a *partial function*, that is, a function that is +not defined for some inputs. In that case, the value of the `option` +type would be `None`, otherwise `Some (v)`, where `v` is some +meaningful value *of any type*. An example in arithmetic is the +division operation: -```pascaligo -type dinner is option(string); - -// stay hungry -const p1: dinner = None; -// have some hamburgers -const p2: dinner = Some("Hamburgers") +```pascaligo group=d +function div (const a : nat; const b : nat) : option (nat) is + if b = 0n then (None: option (nat)) else Some (a/b) ``` -```cameligo -type dinner = string option - -let p1: dinner = None -let p2: dinner = Some "Hamburgers" +```cameligo group=d +let div (a, b : nat * nat) : nat option = + if b = 0n then (None: nat option) else Some (a/b) ``` -```reasonligo -type dinner = option(string); - -let p1: dinner = None; -let p2: dinner = Some("Hamburgers"); +```reasonligo group=d +let div = ((a, b) : (nat, nat)) : option (nat) => + if (b == 0n) { (None: option (nat)); } else { Some (a/b); }; ``` @@ -114,38 +166,66 @@ let p2: dinner = Some("Hamburgers"); ## Pattern matching -Pattern matching is very similiar to e.g. `switch` in Javascript, and can be used to re-route the program's flow based on a value of a variant. +*Pattern matching* is similiar to the `switch` construct in +Javascript, and can be used to route the program's control flow based +on the value of a variant. Consider for example the definition of a +function `flip` that flips a coin, as defined above. -```pascaligo -type dinner is option(string); -function is_hungry(const dinner: dinner): bool is block { skip } - with ( - case dinner of - | None -> True - | Some(d) -> False - end - ) +```pascaligo group=e +type coin is Head | Tail + +function flip (const c : coin) : coin is + case c of + Head -> Tail (Unit) // Unit needed because of a bug + | Tail -> Head (Unit) // Unit needed because of a bug + end +``` + +You can call the function `flip` by using the LIGO compiler like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.ligo +flip "(Head (Unit))" +# Outputs: Tail(Unit) ``` -```cameligo -type dinner = string option -let is_hungry (d: dinner) : bool = - match d with - | None -> true - | Some s -> false +```cameligo group=e +type coin = Head | Tail + +let flip (c : coin) : coin = + match c with + Head -> Tail + | Tail -> Head +``` + +You can call the function `flip` by using the LIGO compiler like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.mligo +flip Head +# Outputs: Tail(Unit) ``` -```reasonligo -type dinner = option(string); -let is_hungry = (d: dinner): bool => - switch (d) { - | None => true - | Some(s) => false +```reasonligo group=e +type coin = | Head | Tail; + +let flip = (c : coin) : coin => + switch (c) { + | Head => Tail + | Tail => Head }; ``` +You can call the function `flip` by using the LIGO compiler like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.religo +flip Head +# Outputs: Tail(Unit) +``` + diff --git a/gitlab-pages/docs/language-basics/variables-and-constants.md b/gitlab-pages/docs/language-basics/variables-and-constants.md index 372f30180..87f2ab109 100644 --- a/gitlab-pages/docs/language-basics/variables-and-constants.md +++ b/gitlab-pages/docs/language-basics/variables-and-constants.md @@ -3,43 +3,48 @@ id: constants-and-variables title: Constants & Variables --- -The next building block after types are constants and variables. +The next building block after types are *constants* and *variables*. ## Constants -Constants are immutable by design, which means their values can't be reassigned. -When defining a constant you need to provide a `name`, `type` and a `value`: +Constants are immutable by design, which means their values cannot be +reassigned. Put in another way, they can be assigned once, at their +declaration. When defining a constant you need to provide a `name`, +`type` and a `value`: -```pascaligo -const age : int = 25; +```pascaligo group=a +const age : int = 25 ``` -You can evaluate the constant definition above using the following CLI command: +You can evaluate the constant definition above using the following CLI +command: ```shell -ligo evaluate-value -s pascaligo gitlab-pages/docs/language-basics/src/variables-and-constants/const.ligo age +ligo evaluate-value gitlab-pages/docs/language-basics/src/variables-and-constants/const.ligo age # Outputs: 25 ``` -```cameligo -let age: int = 25 +```cameligo group=a +let age : int = 25 ``` -You can evaluate the constant definition above using the following CLI command: +You can evaluate the constant definition above using the following CLI +command: ```shell -ligo evaluate-value -s cameligo gitlab-pages/docs/language-basics/src/variables-and-constants/const.mligo age +ligo evaluate-value gitlab-pages/docs/language-basics/src/variables-and-constants/const.mligo age # Outputs: 25 ``` -```reasonligo -let age: int = 25; +```reasonligo group=a +let age : int = 25; ``` -You can evaluate the constant definition above using the following CLI command: +You can evaluate the constant definition above using the following CLI +command: ```shell -ligo evaluate-value -s reasonligo gitlab-pages/docs/language-basics/src/variables-and-constants/const.religo age +ligo evaluate-value gitlab-pages/docs/language-basics/src/variables-and-constants/const.religo age # Outputs: 25 ``` @@ -50,74 +55,78 @@ ligo evaluate-value -s reasonligo gitlab-pages/docs/language-basics/src/variable -Variables, unlike constants, are mutable. They can't be used in a *global scope*, but they can be used within functions, or function arguments. +Variables, unlike constants, are mutable. They cannot be declared in a +*global scope*, but they can be declared and used within functions, or +as function parameters. -> 💡 Don't worry if you don't understand the function syntax yet. We'll get to it in upcoming sections of the docs. +> 💡 Do not worry if you do not understand the function syntax yet. We +> will get to it in upcoming sections of this documentation. -> ⚠️ Please be wary that mutation only works within the function scope itself, values outside of the function scope will not be affected. +> ⚠️ Please be wary that mutation only works within the function scope +> itself, values outside of the function scope will not be affected. +```pascaligo group=b +// The following is invalid: use `const` for global values instead. +// var four : int = 4 -```pascaligo -// won't work, use const for global values instead -// var four: int = 4; - -function add(const a: int; const b: int) : int is - block { - var c : int := a + b; - } with c +function add (const a : int; const b : int) : int is + block { + var c : int := a + b + } with c ``` +> ⚠️ Notice the assignment operator `:=` for `var`, instead of `=` for +> constants. -> ⚠️ Notice the different assignment operator `:=` - -You can run the `add` function defined above using the LIGO compiler like this: +You can run the `add` function defined above using the LIGO compiler +like this: ```shell -ligo run-function -s pascaligo gitlab-pages/docs/language-basics/src/variables-and-constants/add.ligo add '(1,1)' +ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/add.ligo add '(1,1)' # Outputs: 2 ``` -As expected from a functional language, CameLIGO uses value-binding -for variables rather than assignment. Variables are changed by replacement, -with a new value being bound in place of the old one. +As expected in the pure subset of a functional language, CameLIGO only +features constant values: once they are declared, the value cannot be +changed (or "mutated"). -> 💡 Don't worry if you don't understand the function syntax yet. We'll get to it in upcoming sections of the docs. +> 💡 Do not worry if you do not understand the function syntax yet. We +> will get to it in upcoming sections of this documentation. -```cameligo - -let add (a: int) (b: int) : int = +```cameligo group=c +let add (a : int) (b : int) : int = let c : int = a + b in c ``` -You can run the `add` function defined above using the LIGO compiler like this: - +You can run the `add` function defined above using the LIGO compiler +like this: ```shell -ligo run-function -s cameligo gitlab-pages/docs/language-basics/src/variables-and-constants/add.mligo add '(1,1)' +ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/add.mligo add '(1,1)' # Outputs: 2 ``` -As expected from a functional language, ReasonLIGO uses value-binding -for variables rather than assignment. Variables are changed by replacement, -with a new value being bound in place of the old one. +As expected in the pure subset of a functional language, ReasonLIGO +only features constant values: once they are declared, the value +cannot be changed (or "mutated"). -> 💡 Don't worry if you don't understand the function syntax yet. We'll get to it in upcoming sections of the docs. +> 💡 Do not worry if you do not understand the function syntax yet. We +> will get to it in upcoming sections of this documentation. -```reasonligo - -let add = ((a,b): (int, int)): int => { - let c: int = a + b; +```reasonligo group=c +let add = ((a, b): (int, int)): int => { + let c : int = a + b; c; }; ``` -You can run the `add` function defined above using the LIGO compiler like this: - +You can run the `add` function defined above using the LIGO compiler +like this: ```shell -ligo run-function -s reasonligo gitlab-pages/docs/language-basics/src/variables-and-constants/add.religo add '(1,1)' +ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/add.religo add '(1,1)' # Outputs: 2 ``` diff --git a/src/bin/expect_tests/lexer_tests.ml b/src/bin/expect_tests/lexer_tests.ml index 561346f5e..f55d9a8cb 100644 --- a/src/bin/expect_tests/lexer_tests.ml +++ b/src/bin/expect_tests/lexer_tests.ml @@ -106,7 +106,7 @@ ligo: : Lexical error in file "negative_byte_sequence.religo", line 1, character run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.ligo" ; "main" ] ; [%expect {| ligo: : Lexical error in file "reserved_name.ligo", line 1, characters 4-13: - Reserved name: arguments. + Reserved name: "arguments". Hint: Change the name. {} @@ -123,7 +123,7 @@ ligo: : Lexical error in file "reserved_name.ligo", line 1, characters 4-13: run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.religo" ; "main" ] ; [%expect {| ligo: : Lexical error in file "reserved_name.religo", line 1, characters 4-7: - Reserved name: end. + Reserved name: "end". Hint: Change the name. {} @@ -140,7 +140,7 @@ ligo: : Lexical error in file "reserved_name.religo", line 1, characters 4-7: run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.mligo" ; "main" ] ; [%expect {| ligo: : Lexical error in file "reserved_name.mligo", line 1, characters 4-10: - Reserved name: object. + Reserved name: "object". Hint: Change the name. {} From 26059c281a4a7000bd79c46d632cf8c5b2e8219b Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Wed, 5 Feb 2020 18:09:45 +0100 Subject: [PATCH 017/119] Forgot to check that function parameters are not reserved names. --- src/passes/1-parser/pascaligo/Scoping.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/passes/1-parser/pascaligo/Scoping.ml b/src/passes/1-parser/pascaligo/Scoping.ml index 73a7012ac..2ac52f8d1 100644 --- a/src/passes/1-parser/pascaligo/Scoping.ml +++ b/src/passes/1-parser/pascaligo/Scoping.ml @@ -158,10 +158,12 @@ let check_variants variants = let check_parameters params = let add acc = function ParamConst {value; _} -> + check_reserved_name value.var; if VarSet.mem value.var acc then raise (Error (Duplicate_parameter value.var)) else VarSet.add value.var acc | ParamVar {value; _} -> + check_reserved_name value.var; if VarSet.mem value.var acc then raise (Error (Duplicate_parameter value.var)) else VarSet.add value.var acc in From 3583f72cb43d9cdf0ab77590c875a52b7220d817 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Thu, 6 Feb 2020 11:47:41 +0100 Subject: [PATCH 018/119] Improvements from Sander and JDP. --- .../docs/advanced/entrypoints-contracts.md | 5 +-- .../docs/advanced/timestamps-addresses.md | 16 ++++----- .../docs/language-basics/boolean-if-else.md | 9 +++-- .../docs/language-basics/functions.md | 14 ++++---- gitlab-pages/docs/language-basics/loops.md | 24 +++++++------- .../docs/language-basics/maps-records.md | 33 +++++++++---------- .../docs/language-basics/math-numbers-tez.md | 11 +++---- .../unit-option-pattern-matching/flip.mligo | 6 ++++ .../unit-option-pattern-matching/flip.religo | 7 ++++ 9 files changed, 71 insertions(+), 54 deletions(-) create mode 100644 gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.mligo create mode 100644 gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.religo diff --git a/gitlab-pages/docs/advanced/entrypoints-contracts.md b/gitlab-pages/docs/advanced/entrypoints-contracts.md index c105d08f6..29160031c 100644 --- a/gitlab-pages/docs/advanced/entrypoints-contracts.md +++ b/gitlab-pages/docs/advanced/entrypoints-contracts.md @@ -386,13 +386,14 @@ type return = (list (operation), storage); let dest : address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3" : address); -let proxy = ((param, store): (parameter, storage)) : return => +let proxy = ((param, store): (parameter, storage)) : return => { let counter : contract (parameter) = Operation.get_contract (dest); (* Reuse the parameter in the subsequent transaction or use another one, `mock_param`. *) let mock_param : parameter = Increment (5n); let op : operation = Operation.transaction (param, 0mutez, counter); - ([op], store); + ([op], store) +}; ``` diff --git a/gitlab-pages/docs/advanced/timestamps-addresses.md b/gitlab-pages/docs/advanced/timestamps-addresses.md index dd7289e81..8c20da011 100644 --- a/gitlab-pages/docs/advanced/timestamps-addresses.md +++ b/gitlab-pages/docs/advanced/timestamps-addresses.md @@ -101,8 +101,8 @@ let in_24_hrs : timestamp = today - one_day; ### Comparing Timestamps -You can also compare timestamps using the same comparison operators as -for numbers. +You can compare timestamps using the same comparison operators +applying to numbers. @@ -124,10 +124,10 @@ let not_tomorrow : bool = (Current.time == in_24_hrs); ## Addresses -The type `address` in LIGO is used to denote Tezos addresses (tz1, -tz2, tz3, KT1, ...). Currently, addresses are created by casting a -string to the type `address`. Beware of failures if the address is -invalid. Consider the following examples. +The type `address` in LIGO denotes Tezos addresses (tz1, tz2, tz3, +KT1, ...). Currently, addresses are created by casting a string to the +type `address`. Beware of failures if the address is invalid. Consider +the following examples. @@ -152,7 +152,7 @@ let my_account : address = ## Signatures -The type `signature` in LIGO datatype is used for Tezos signature +The `signature` type in LIGO datatype is used for Tezos signatures (edsig, spsig). Signatures are created by casting a string. Beware of failure if the signature is invalid. @@ -181,7 +181,7 @@ signature); ## Keys -The type `key` in LIGO is used for Tezos public keys. Do not confuse +The `key` type in LIGO is used for Tezos public keys. Do not confuse them with map keys. Keys are made by casting strings. Beware of failure if the key is invalid. diff --git a/gitlab-pages/docs/language-basics/boolean-if-else.md b/gitlab-pages/docs/language-basics/boolean-if-else.md index b6d3b0da3..d938f5b7b 100644 --- a/gitlab-pages/docs/language-basics/boolean-if-else.md +++ b/gitlab-pages/docs/language-basics/boolean-if-else.md @@ -34,7 +34,10 @@ In LIGO, only values of the same type can be compared. Moreover, not all values of the same type can be compared, only those with *comparable types*, which is a concept lifted from Michelson. Comparable types include, for instance, `int`, `nat`, -`string`, `tez`, `timestamp`, `address`, etc. +`string`, `tez`, `timestamp`, `address`, etc. As an example of +non-comparable types: maps, sets or lists are not comparable: if you +wish to compare them, you will have to write your own comparison +function. ### Comparing Strings @@ -110,7 +113,7 @@ let h : bool = (a != b); ```pascaligo group=d const a : tez = 5mutez const b : tez = 10mutez -const c : bool = (a = b) // false +const c : bool = (a = b) // False ``` ```cameligo group=d @@ -129,7 +132,7 @@ let c : bool = (a == b); // false ## Conditionals -Conditional logic enables to fork the control flow depending on the +Conditional logic enables forking the control flow depending on the state. diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index bcae8b468..c43e5e33e 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -10,11 +10,11 @@ logic into functions. ## Blocks In PascaLIGO, *blocks* enable the sequential composition of -*instructions* into an isolated scope. Each `block` needs to include -at least one instruction. If we need a placeholder *placeholder*, we -use the instruction called `skip`, that leaves the state -invariant. The rationale for `skip` instead of a truly empty block is -that it prevents you from writing an empty block by mistake. +instructions into an isolated scope. Each block needs to include at +least one instruction. If we need a placeholder, we use the +instruction `skip` which leaves the state unchanged. The rationale +for `skip` instead of a truly empty block is that it prevents you from +writing an empty block by mistake. @@ -31,10 +31,10 @@ Blocks are more versatile than simply containing instructions: they can also include *declarations* of values, like so: ```pascaligo skip // terse style -block { const a : int = 1; } +block { const a : int = 1 } // verbose style begin - const a : int = 1; + const a : int = 1 end ``` diff --git a/gitlab-pages/docs/language-basics/loops.md b/gitlab-pages/docs/language-basics/loops.md index 9a5a4d47b..6ae699cd6 100644 --- a/gitlab-pages/docs/language-basics/loops.md +++ b/gitlab-pages/docs/language-basics/loops.md @@ -64,7 +64,7 @@ to have a special type: if the type of the accumulator is `t`, then it must have the type `bool * t` (not simply `t`). It is the boolean value that denotes whether the stopping condition has been reached. -```cameligo group=b +```cameligo group=a let iter (x,y : nat * nat) : bool * (nat * nat) = if y = 0n then false, (x,y) else true, (y, x mod y) @@ -77,7 +77,7 @@ let gcd (x,y : nat * nat) : nat = To ease the writing and reading of the iterated functions (here, `iter`), two predefined functions are provided: `continue` and `stop`: -```cameligo group=c +```cameligo group=a let iter (x,y : nat * nat) : bool * (nat * nat) = if y = 0n then stop (x,y) else continue (y, x mod y) @@ -113,27 +113,29 @@ accumulator is `t`, then it must have the type `bool * t` (not simply `t`). It is the boolean value that denotes whether the stopping condition has been reached. -```reasonligo group=d +```reasonligo group=a let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => if (y == 0n) { (false, (x,y)); } else { (true, (y, x mod y)); }; -let gcd = ((x,y) : (nat, nat)) : nat => +let gcd = ((x,y) : (nat, nat)) : nat => { let (x,y) = if (x < y) { (y,x); } else { (x,y); }; let (x,y) = Loop.fold_while (iter, (x,y)); - x; + x +}; ``` To ease the writing and reading of the iterated functions (here, `iter`), two predefined functions are provided: `continue` and `stop`: -```reasonligo group=e +```reasonligo group=b let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => if (y == 0n) { stop ((x,y)); } else { continue ((y, x mod y)); }; -let gcd = ((x,y) : (nat, nat)) : nat => +let gcd = ((x,y) : (nat, nat)) : nat => { let (x,y) = if (x < y) { (y,x); } else { (x,y); }; let (x,y) = Loop.fold_while (iter, (x,y)); - x; + x +}; ``` @@ -147,7 +149,7 @@ To iterate over a range of integers you use a loop of the form `for familiar for programmers of imperative languages. Note that, for the sake of generality, the bounds are of type `int`, not `nat`. -```pascaligo group=f +```pascaligo group=c function sum (var n : nat) : int is block { var acc : int := 0; for i := 1 to int (n) block { @@ -177,7 +179,7 @@ of the form `for in Here is an example where the integers in a list are summed up. -```pascaligo group=g +```pascaligo group=d function sum_list (var l : list (int)) : int is block { var total : int := 0; for i in list l block { @@ -197,7 +199,7 @@ gitlab-pages/docs/language-basics/src/loops/collection.ligo sum_list Here is an example where the integers in a set are summed up. -```pascaligo=g +```pascaligo=e function sum_set (var s : set (int)) : int is block { var total : int := 0; for i in set s block { diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index 6a6572c37..50ec7e8b8 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -358,7 +358,7 @@ let moves : register = let moves : register = Map.literal ([ ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, (1,2)), - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3)),]); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3))]); ``` > The `Map.literal` predefined function builds a map from a list of @@ -377,8 +377,8 @@ example: ```pascaligo group=f -(*const my_balance : option (move) = - moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)] *) +const my_balance : option (move) = + moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)] ``` @@ -418,11 +418,12 @@ let force_access (key, moves : address * register) : move = ``` -```reasonlig group=f -let force_access : ((key, moves) : address * register) : move => { - switch (Map.find_opt key moves) with - Some move -> move - | None -> (failwith "No move." : move) +```reasonligo group=f +let force_access = ((key, moves) : (address, register)) : move => { + switch (Map.find_opt (key, moves)) { + | Some (move) => move + | None => failwith ("No move.") : move + } }; ``` @@ -475,9 +476,8 @@ let assign (m : register) : register = ``` > Notice the optional value `Some (4,9)` instead of `(4,9)`. If we had -> use `None` instead, that would have meant that the binding is only -> defined on its key, but not its value. This encoding enables -> partially defined bindings. +> use `None` instead, that would have meant that the binding is +> removed. @@ -492,9 +492,8 @@ let assign = (m : register) : register => { ``` > Notice the optional value `Some (4,9)` instead of `(4,9)`. If we had -> use `None` instead, that would have meant that the binding is only -> defined on its key, but not its value. This encoding enables -> partially defined bindings. +> use `None` instead, that would have meant that the binding is +> removed. @@ -601,7 +600,7 @@ let map_op = (m : register) : register => { A *fold operation* is the most general of iterations. The iterated function takes two arguments: an *accumulator* and the structure *element* at hand, with which it then produces a new accumulator. This -enables to have a partial result that becomes complete when the +enables having a partial result that becomes complete when the traversal of the data structure is over. @@ -622,7 +621,7 @@ let fold_op (m : register) : register = ```reasonligo group=f -let fold_op = (m: register): register => { +let fold_op = (m : register) : register => { let aggregate = ((i,j): (int, (address, move))) => i + j[1][1]; Map.fold (aggregate, m, 5); }; @@ -703,7 +702,7 @@ let moves : register = let moves : register = Big_map.literal ([ ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, (1,2)), - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3)),]); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3))]); ``` > The predefind function `Big_map.literal` constructs a big map from a diff --git a/gitlab-pages/docs/language-basics/math-numbers-tez.md b/gitlab-pages/docs/language-basics/math-numbers-tez.md index 859c73097..bb274cd7c 100644 --- a/gitlab-pages/docs/language-basics/math-numbers-tez.md +++ b/gitlab-pages/docs/language-basics/math-numbers-tez.md @@ -8,15 +8,14 @@ LIGO offers three built-in numerical types: `int`, `nat` and `tez`. ## Addition Addition in LIGO is accomplished by means of the `+` infix -operator. Some type constraints apply, for example you ca not add a +operator. Some type constraints apply, for example you cannot add a value of type `tez` to a value of type `nat`. In the following example you can find a series of arithmetic operations, including various numerical types. However, some bits -remain in comments because they would otherwise not compile because, -for example, adding a value of type `int` to a value of type `tez` is -invalid. Note that adding an integer to a natural number produces an -integer. +remain in comments as they would otherwise not compile, for example, +adding a value of type `int` to a value of type `tez` is invalid. Note +that adding an integer to a natural number produces an integer. @@ -115,7 +114,7 @@ let g : int = 1_000_000; ## Subtraction -Subtraction looks like as follows. +Subtraction looks as follows. > ⚠️ Even when subtracting two `nats`, the result is an `int` diff --git a/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.mligo b/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.mligo new file mode 100644 index 000000000..43e09b016 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.mligo @@ -0,0 +1,6 @@ +type coin = Head | Tail + +let flip (c : coin) : coin = + match c with + Head -> Tail + | Tail -> Head diff --git a/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.religo b/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.religo new file mode 100644 index 000000000..94d496c48 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/unit-option-pattern-matching/flip.religo @@ -0,0 +1,7 @@ +type coin = | Head | Tail; + +let flip = (c : coin) : coin => + switch (c) { + | Head => Tail + | Tail => Head + }; From 9f9f5c82ae4abd47727108b87118766f94423df0 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Thu, 6 Feb 2020 12:32:23 +0100 Subject: [PATCH 019/119] Added an example about lambdas. --- .../docs/language-basics/functions.md | 51 +++++++++++++++++++ .../src/functions/incr_map.ligo | 5 ++ .../src/functions/incr_map.mligo | 4 ++ .../src/functions/incr_map.religo | 4 ++ 4 files changed, 64 insertions(+) create mode 100644 gitlab-pages/docs/language-basics/src/functions/incr_map.ligo create mode 100644 gitlab-pages/docs/language-basics/src/functions/incr_map.mligo create mode 100644 gitlab-pages/docs/language-basics/src/functions/incr_map.religo diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index c43e5e33e..e68c93ed8 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -204,4 +204,55 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.religo # Outputs: 2 ``` + + +If the example above seems contrived, here is a more common design +pattern for lambdas: to be used as parameters to functions. Consider +the use case of having a list of integers and mapping the increment +function to all its elements. + + + +```pascaligo group=c +function incr_map (const l : list (int)) : list (int) is + list_map (function (const i : int) : int is i + 1, l) +``` +You can call the function `incr_map` defined above using the LIGO compiler +like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/functions/incr_map.ligo incr_map +"list [1;2;3]" +# Outputs: [ 2 ; 3 ; 4 ] +``` + + +```cameligo group=c +let incr_map (l : int list) : int list = + List.map (fun (i : int) -> i + 1) l +``` +You can call the function `incr_map` defined above using the LIGO compiler +like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/functions/incr_map.mligo incr_map +"list [1;2;3]" +# Outputs: [ 2 ; 3 ; 4 ] +``` + + +```reasonligo group=c +let incr_map = (l : list (int)) : list (int) => + List.map ((i : int) => i + 1, l); +``` +You can call the function `incr_map` defined above using the LIGO compiler +like so: +```shell +ligo run-function +gitlab-pages/docs/language-basics/src/functions/incr_map.religo incr_map +"list [1;2;3]" +# Outputs: [ 2 ; 3 ; 4 ] +``` + + diff --git a/gitlab-pages/docs/language-basics/src/functions/incr_map.ligo b/gitlab-pages/docs/language-basics/src/functions/incr_map.ligo new file mode 100644 index 000000000..e5f915847 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/incr_map.ligo @@ -0,0 +1,5 @@ +function increment (const b : int) : int is + (function (const a : int) : int is a + 1) (b) + +function incr_map (const l : list (int)) : list (int) is + list_map (function (const i : int) : int is i + 1, l) diff --git a/gitlab-pages/docs/language-basics/src/functions/incr_map.mligo b/gitlab-pages/docs/language-basics/src/functions/incr_map.mligo new file mode 100644 index 000000000..b2dd363c8 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/incr_map.mligo @@ -0,0 +1,4 @@ +let increment (b : int) : int = (fun (a : int) -> a + 1) b + +let incr_map (l : int list) : int list = + List.map (fun (i : int) -> i + 1) l diff --git a/gitlab-pages/docs/language-basics/src/functions/incr_map.religo b/gitlab-pages/docs/language-basics/src/functions/incr_map.religo new file mode 100644 index 000000000..85b8a39f4 --- /dev/null +++ b/gitlab-pages/docs/language-basics/src/functions/incr_map.religo @@ -0,0 +1,4 @@ +let increment = (b : int) : int => ((a : int) : int => a + 1)(b); + +let incr_map = (l : list (int)) : list (int) => + List.map ((i : int) => i + 1, l); From c82ae6359a96e88cf0bf8fea7309bf53656c43c8 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 6 Feb 2020 13:32:51 +0100 Subject: [PATCH 020/119] fix broken .md file (sets-lists-tuples) --- .../docs/language-basics/sets-lists-tuples.md | 111 ++++++++---------- 1 file changed, 51 insertions(+), 60 deletions(-) diff --git a/gitlab-pages/docs/language-basics/sets-lists-tuples.md b/gitlab-pages/docs/language-basics/sets-lists-tuples.md index 330187ac3..e43de8200 100644 --- a/gitlab-pages/docs/language-basics/sets-lists-tuples.md +++ b/gitlab-pages/docs/language-basics/sets-lists-tuples.md @@ -128,43 +128,39 @@ let my_list : list (int) = [1, 2, 2]; // The head is 1 ### Adding to a List - Lists can be augmented by adding an element before the head (or, in terms of stack, by *pushing an element on top*). This operation is usually called *consing* in functional languages. - - In PascaLIGO, the *cons operator* is infix and noted `#`. It is not symmetric: on the left lies the element to cons, and, on the right, a list on which to cons. (The symbol is helpfully asymmetric to remind you of that.) -```pascaligo group=b -const larger_list : list (int) = 5 # my_list -``` - - - In CameLIGO, the *cons operator* is infix and noted `::`. It is not symmetric: on the left lies the element to cons, and, on the right, a list on which to cons. -```cameligo group=b -let larger_list : int list = 5 :: my_list -``` - - - In ReasonLIGO, the *cons operator* is infix and noted `, ...`. It is not symmetric: on the left lies the element to cons, and, on the right, a list on which to cons. + + +```pascaligo group=b +const larger_list : list (int) = 5 # my_list +``` + + +```cameligo group=b +let larger_list : int list = 5 :: my_list +``` + + ```reasonligo group=b let larger_list : list (int) = [5, ...my_list]; ``` -
@@ -187,41 +183,32 @@ functions in LIGO. They take as a parameter the function to apply to all the elements. Of course, that function must return a value of the same type as the element. - - - - In PascaLIGO, the map function is called `list_map`. +In CameLIGO and ReasonLIGO, the map function is called `List.map`. + + + ```pascaligo group=b function increment (const i : int): int is i + 1 // Creates a new list with all elements incremented by 1 const plus_one : list (int) = list_map (increment, larger_list) ``` - - -In CameLIGO, the map function is called `List.map`. - ```cameligo group=b let increment (i : int) : int = i + 1 // Creates a new list with all elements incremented by 1 let plus_one : int list = List.map increment larger_list ``` - - -In CameLIGO, the map function is called `List.map`. - ```reasonligo group=b let increment = (i : int) : int => i + 1; // Creates a new list with all elements incremented by 1 let plus_one : list (int) = List.map (increment, larger_list); ``` - @@ -278,16 +265,17 @@ let my_set : set (int) = (Set.empty : set (int)); ### Non-empty Sets - - In PascaLIGO, the notation for sets is similar to that for lists, except the keyword `set` is used before: + + ```pascaligo group=a const my_set : set (int) = set [3; 2; 2; 1] ``` + You can check that `2` is not repeated in `my_set` by using the LIGO compiler like this (the output will sort the elements of the set, but @@ -299,16 +287,17 @@ gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo my_set # Outputs: { 3 ; 2 ; 1 } ``` - - In CameLIGO, there is no predefined syntactic construct for sets: you must build your set by adding to the empty set. (This is the way in OCaml.) + + ```cameligo group=a let my_set : int set = Set.add 3 (Set.add 2 (Set.add 2 (Set.add 1 (Set.empty : int set)))) ``` + You can check that `2` is not repeated in `my_set` by using the LIGO compiler like this (the output will sort the elements of the set, but @@ -320,16 +309,17 @@ gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo my_set # Outputs: { 3 ; 2 ; 1 } ``` - - In ReasonLIGO, there is no predefined syntactic construct for sets: you must build your set by adding to the empty set. (This is the way in OCaml.) + + ```reasonligo group=a let my_set : set (int) = Set.add (3, Set.add (2, Set.add (2, Set.add (1, Set.empty : set (int))))); ``` + You can check that `2` is not repeated in `my_set` by using the LIGO compiler like this (the output will sort the elements of the set, but @@ -341,71 +331,63 @@ gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo my_set # Outputs: { 3 ; 2 ; 1 } ``` - - ### Set Membership - - PascaLIGO features a special keyword `constains` that operates like an infix operator checking membership in a set. + + ```pascaligo group=a const contains_3 : bool = my_set contains 3 ``` - ```cameligo group=a let contains_3 : bool = Set.mem 3 my_set ``` - ```reasonligo group=a let contains_3 : bool = Set.mem (3, my_set); ``` - ### Cardinal - ```pascaligo group=a const set_size : nat = size (my_set) ``` - ```cameligo group=a let set_size : nat = Set.size my_set ``` - ```reasonligo group=a let set_size : nat = Set.size (my_set); ``` - ### Adding or Removing from a Set - - In PascaLIGO, there are two ways to update a set. Either we create a new set from the given one, or we modify it in-place. First, let us consider the former: + + ```pascaligo group=a const larger_set : set (int) = set_add (4, my_set) const smaller_set : set (int) = set_remove (3, my_set) ``` + If we are in a block, we can use an instruction to modify the set bound to a given variable. This is called a *patch*. It is only @@ -418,61 +400,69 @@ this instruction is equivalent to perform the union of two sets, one that is modified in-place, and the other given as a literal (extensional definition). -``pascaligo group=a + + +```pascaligo group=a function update (var s : set (int)) : set (int) is block { patch s with set [4; 7] } with s const new_set : set (int) = update (my_set) ``` + - In CameLIGO, we update a given set by creating another one, with or without some elements. + + ```cameligo group=a let larger_set : int set = Set.add 4 my_set let smaller_set : int set = Set.remove 3 my_set ``` + - In ReasonLIGO, we update a given set by creating another one, with or without some elements. + + ```reasonligo group=a let larger_set : set (int) = Set.add (4, my_set); let smaller_set : set (int) = Set.remove (3, my_set); ``` - ### Folding over a Set - Given a set, we may want to apply a function in turn to all the elements it contains, while accumulating some value which is returned at the end. This is a *fold operation*. In the following example, we sum up all the elements of the set `my_set` defined above. - In PascaLIGO, the folded function takes the accumulator first and the (current) set element second. The predefined fold is called `set_fold`. + + ```pascaligo group=a function sum (const acc : int; const i : int): int is acc + i const sum_of_elements : int = set_fold (sum, my_set, 0) ``` + It is possible to use a *loop* over a set as well. + + ```pascaligo group=a function loop (const s : set (int)) : int is block { var sum : int := 0; @@ -481,26 +471,27 @@ function loop (const s : set (int)) : int is block { } } with sum ``` - - + In CameLIGO, the predefined fold over sets is called `Set.fold`. + + ```cameligo group=a let sum (acc, i : int * int) : int = acc + i let sum_of_elements : int = Set.fold sum my_set 0 ``` + - -` In ReasonLIGO, the predefined fold over sets is called `Set.fold`. -``reasonligo group=a + + +```reasonligo group=a let sum = ((acc, i) : (int, int)) : int => acc + i; let sum_of_elements : int = Set.fold (sum, my_set, 0); ``` - From 9433fa9bc4f21ffc5477fbe908f62dbff2e79ab7 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Thu, 6 Feb 2020 16:17:33 +0100 Subject: [PATCH 021/119] Add lsl and lsr support. --- src/passes/7-self_mini_c/self_mini_c.ml | 2 +- src/passes/operators/operators.ml | 10 ++++++++++ src/stages/common/PP.ml | 2 ++ src/stages/common/types.ml | 2 ++ src/test/contracts/bitwise_arithmetic.ligo | 6 ++++++ src/test/contracts/bitwise_arithmetic.mligo | 2 ++ src/test/contracts/bitwise_arithmetic.religo | 2 ++ src/test/integration_tests.ml | 6 ++++++ 8 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/passes/7-self_mini_c/self_mini_c.ml b/src/passes/7-self_mini_c/self_mini_c.ml index 98bc0315c..2d56ee231 100644 --- a/src/passes/7-self_mini_c/self_mini_c.ml +++ b/src/passes/7-self_mini_c/self_mini_c.ml @@ -20,7 +20,7 @@ let is_pure_constant : constant -> bool = | C_UNIT | C_CAR | C_CDR | C_PAIR | C_NIL | C_CONS - | C_NEG | C_OR | C_AND | C_XOR | C_NOT + | C_NEG | C_OR | C_AND | C_LSL | C_LSR | C_XOR | C_NOT | C_EQ | C_NEQ | C_LT | C_LE | C_GT | C_GE | C_SOME | C_UPDATE | C_MAP_GET | C_MAP_FIND_OPT | C_MAP_ADD | C_MAP_UPDATE diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 49f693030..959b07363 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -87,6 +87,8 @@ module Simplify = struct | "bitwise_or" -> ok C_OR | "bitwise_and" -> ok C_AND | "bitwise_xor" -> ok C_XOR + | "bitwise_lsl" -> ok C_LSL + | "bitwise_lsr" -> ok C_LSR | "string_concat" -> ok C_CONCAT | "string_slice" -> ok C_SLICE | "crypto_check" -> ok C_CHECK_SIGNATURE @@ -210,6 +212,8 @@ module Simplify = struct | "Bitwise.lor" -> ok C_OR | "Bitwise.land" -> ok C_AND | "Bitwise.lxor" -> ok C_XOR + | "Bitwise.shift_left" -> ok C_LSL + | "Bitwise.shift_right" -> ok C_LSR | "String.length" -> ok C_SIZE | "String.size" -> ok C_SIZE @@ -396,6 +400,8 @@ module Typer = struct | C_AND -> ok @@ failwith "t_and" ; | C_OR -> ok @@ failwith "t_or" ; | C_XOR -> ok @@ failwith "t_xor" ; + | C_LSL -> ok @@ failwith "t_lsl" ; + | C_LSR -> ok @@ failwith "t_lsr" ; (* COMPARATOR *) | C_EQ -> ok @@ failwith "t_comparator EQ" ; | C_NEQ -> ok @@ failwith "t_comparator NEQ" ; @@ -1006,6 +1012,8 @@ module Typer = struct | C_AND -> ok @@ and_ ; | C_OR -> ok @@ or_ ; | C_XOR -> ok @@ xor ; + | C_LSL -> ok @@ lsl_; + | C_LSR -> ok @@ lsr_; (* COMPARATOR *) | C_EQ -> ok @@ comparator "EQ" ; | C_NEQ -> ok @@ comparator "NEQ" ; @@ -1103,6 +1111,8 @@ module Compiler = struct | C_OR -> ok @@ simple_binary @@ prim I_OR | C_AND -> ok @@ simple_binary @@ prim I_AND | C_XOR -> ok @@ simple_binary @@ prim I_XOR + | C_LSL -> ok @@ simple_binary @@ prim I_LSL + | C_LSR -> ok @@ simple_binary @@ prim I_LSR | C_NOT -> ok @@ simple_unary @@ prim I_NOT | C_PAIR -> ok @@ simple_binary @@ prim I_PAIR | C_CAR -> ok @@ simple_unary @@ prim I_CAR diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index 773b5eaab..f8ec5b954 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -45,6 +45,8 @@ let constant ppf : constant -> unit = function | C_AND -> fprintf ppf "AND" | C_OR -> fprintf ppf "OR" | C_XOR -> fprintf ppf "XOR" + | C_LSL -> fprintf ppf "LSL" + | C_LSR -> fprintf ppf "LSR" (* COMPARATOR *) | C_EQ -> fprintf ppf "EQ" | C_NEQ -> fprintf ppf "NEQ" diff --git a/src/stages/common/types.ml b/src/stages/common/types.ml index a0c6f9cb6..05ebae0b5 100644 --- a/src/stages/common/types.ml +++ b/src/stages/common/types.ml @@ -162,6 +162,8 @@ type constant = | C_AND | C_OR | C_XOR + | C_LSL + | C_LSR (* COMPARATOR *) | C_EQ | C_NEQ diff --git a/src/test/contracts/bitwise_arithmetic.ligo b/src/test/contracts/bitwise_arithmetic.ligo index 282b82be9..3b5c9d30d 100644 --- a/src/test/contracts/bitwise_arithmetic.ligo +++ b/src/test/contracts/bitwise_arithmetic.ligo @@ -8,3 +8,9 @@ function and_op (const n : nat) : nat is function xor_op (const n : nat) : nat is begin skip end with bitwise_xor(n , 7n) + +function lsl_op (const n : nat) : nat is + begin skip end with bitwise_lsl(n , 7n) + +function lsr_op (const n : nat) : nat is + begin skip end with bitwise_lsr(n , 7n) \ No newline at end of file diff --git a/src/test/contracts/bitwise_arithmetic.mligo b/src/test/contracts/bitwise_arithmetic.mligo index a62c702c3..a56375f81 100644 --- a/src/test/contracts/bitwise_arithmetic.mligo +++ b/src/test/contracts/bitwise_arithmetic.mligo @@ -3,3 +3,5 @@ let or_op (n: nat) : nat = Bitwise.lor n 4n let and_op (n: nat) : nat = Bitwise.land n 7n let xor_op (n: nat) : nat = Bitwise.lxor n 7n +let lsl_op (n: nat) : nat = Bitwise.shift_left n 7n +let lsr_op (n: nat) : nat = Bitwise.shift_right n 7n diff --git a/src/test/contracts/bitwise_arithmetic.religo b/src/test/contracts/bitwise_arithmetic.religo index c5e2c7837..2cc390b8a 100644 --- a/src/test/contracts/bitwise_arithmetic.religo +++ b/src/test/contracts/bitwise_arithmetic.religo @@ -3,3 +3,5 @@ let or_op = (n: nat): nat => Bitwise.lor(n, 4n); let and_op = (n: nat): nat => Bitwise.land(n, 7n); let xor_op = (n: nat): nat => Bitwise.lxor(n, 7n); +let lsl_op = (n: nat) : nat => Bitwise.shift_left(n, 7n); +let lsr_op = (n: nat) : nat => Bitwise.shift_right(n, 7n); \ No newline at end of file diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 204d2fc55..997e7d0b9 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -348,6 +348,8 @@ let bitwise_arithmetic () : unit result = let%bind () = expect_eq program "and_op" (e_nat 10) (e_nat 2) in let%bind () = expect_eq program "xor_op" (e_nat 0) (e_nat 7) in let%bind () = expect_eq program "xor_op" (e_nat 7) (e_nat 0) in + let%bind () = expect_eq program "lsl_op" (e_nat 1000) (e_nat 128000) in + let%bind () = expect_eq program "lsr_op" (e_nat 128000) (e_nat 1000) in ok () let bitwise_arithmetic_mligo () : unit result = @@ -364,6 +366,8 @@ let bitwise_arithmetic_mligo () : unit result = let%bind () = expect_eq program "and_op" (e_nat 10) (e_nat 2) in let%bind () = expect_eq program "xor_op" (e_nat 0) (e_nat 7) in let%bind () = expect_eq program "xor_op" (e_nat 7) (e_nat 0) in + let%bind () = expect_eq program "lsl_op" (e_nat 1000) (e_nat 128000) in + let%bind () = expect_eq program "lsr_op" (e_nat 128000) (e_nat 1000) in ok () let bitwise_arithmetic_religo () : unit result = @@ -380,6 +384,8 @@ let bitwise_arithmetic_religo () : unit result = let%bind () = expect_eq program "and_op" (e_nat 10) (e_nat 2) in let%bind () = expect_eq program "xor_op" (e_nat 0) (e_nat 7) in let%bind () = expect_eq program "xor_op" (e_nat 7) (e_nat 0) in + let%bind () = expect_eq program "lsl_op" (e_nat 1000) (e_nat 128000) in + let%bind () = expect_eq program "lsr_op" (e_nat 128000) (e_nat 1000) in ok () let string_arithmetic () : unit result = From e14dd18680ff764467f063c339bd379226defdce Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Thu, 6 Feb 2020 17:30:50 +0100 Subject: [PATCH 022/119] Correction: lsl and lsr are impure --- src/passes/7-self_mini_c/self_mini_c.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/passes/7-self_mini_c/self_mini_c.ml b/src/passes/7-self_mini_c/self_mini_c.ml index 2d56ee231..636a72732 100644 --- a/src/passes/7-self_mini_c/self_mini_c.ml +++ b/src/passes/7-self_mini_c/self_mini_c.ml @@ -20,7 +20,7 @@ let is_pure_constant : constant -> bool = | C_UNIT | C_CAR | C_CDR | C_PAIR | C_NIL | C_CONS - | C_NEG | C_OR | C_AND | C_LSL | C_LSR | C_XOR | C_NOT + | C_NEG | C_OR | C_AND | C_XOR | C_NOT | C_EQ | C_NEQ | C_LT | C_LE | C_GT | C_GE | C_SOME | C_UPDATE | C_MAP_GET | C_MAP_FIND_OPT | C_MAP_ADD | C_MAP_UPDATE @@ -31,7 +31,7 @@ let is_pure_constant : constant -> bool = | C_HASH_KEY | C_BYTES_PACK | C_CONCAT -> true (* unfortunately impure: *) - | C_ADD | C_SUB |C_MUL|C_DIV|C_MOD + | C_ADD | C_SUB |C_MUL|C_DIV|C_MOD | C_LSL | C_LSR (* impure: *) | C_ASSERTION | C_ASSERT_INFERRED | C_MAP_GET_FORCE | C_MAP_FIND From 784c2da81b980a41177e41fb6ff43dad437009f7 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 6 Feb 2020 18:06:36 +0100 Subject: [PATCH 023/119] Remove useless constants: * C_HASH (removed) * C_MAP_GET --replaced--> C_MAP_FIND_OPT * C_MAP_GET_FORCE --replaced--> C_MAP_FIND --- src/bin/expect_tests/contract_tests.ml | 20 ++++++++++---------- src/passes/6-transpiler/transpiler.ml | 2 +- src/passes/7-self_mini_c/self_mini_c.ml | 4 ++-- src/passes/operators/operators.ml | 21 ++------------------- src/stages/common/PP.ml | 3 --- src/stages/common/types.ml | 3 --- 6 files changed, 15 insertions(+), 38 deletions(-) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 66a9b140b..cc0b054d2 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -7,13 +7,13 @@ let bad_contract basename = let%expect_test _ = run_ligo_good [ "measure-contract" ; contract "coase.ligo" ; "main" ] ; - [%expect {| 2066 bytes |}] ; + [%expect {| 2062 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig.ligo" ; "main" ] ; [%expect {| 1093 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ; - [%expect {| 2717 bytes |}] ; + [%expect {| 2713 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ; [%expect {| 642 bytes |}] ; @@ -86,7 +86,7 @@ let%expect_test _ = SWAP ; DIP { DUP ; CAR ; CAR } ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CAR ; DIP { DUP ; CDR ; PUSH nat 1 ; ADD } ; @@ -168,7 +168,7 @@ let%expect_test _ = SWAP ; DIP { DUP ; CAR ; CDR } ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CAR ; SOURCE ; @@ -182,7 +182,7 @@ let%expect_test _ = CDR ; DIP { DIP { DUP } ; SWAP ; CAR ; CAR } ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CDR ; PUSH nat 1 ; @@ -262,7 +262,7 @@ let%expect_test _ = CAR ; DIP { DUP } ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CAR ; SOURCE ; @@ -488,7 +488,7 @@ let%expect_test _ = CAR ; SENDER ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; PUSH nat 1 ; ADD ; SOME ; @@ -529,7 +529,7 @@ let%expect_test _ = CAR ; SENDER ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; PUSH nat 1 ; ADD ; SOME ; @@ -572,7 +572,7 @@ let%expect_test _ = CAR ; SENDER ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; DIP { DIP 4 { DUP } ; DIG 4 ; CAR ; CDR ; CAR } ; COMPARE ; @@ -768,7 +768,7 @@ let%expect_test _ = CAR ; SENDER ; GET ; - IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ; + IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; PUSH nat 1 ; SWAP ; SUB ; diff --git a/src/passes/6-transpiler/transpiler.ml b/src/passes/6-transpiler/transpiler.ml index 86c921c70..162231e7e 100644 --- a/src/passes/6-transpiler/transpiler.ml +++ b/src/passes/6-transpiler/transpiler.ml @@ -490,7 +490,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re ) | E_look_up dsi -> ( let%bind (ds', i') = bind_map_pair f dsi in - return @@ E_constant (C_MAP_GET, [i' ; ds']) + return @@ E_constant (C_MAP_FIND_OPT, [i' ; ds']) ) | E_sequence (a , b) -> ( let%bind a' = transpile_annotated_expression a in diff --git a/src/passes/7-self_mini_c/self_mini_c.ml b/src/passes/7-self_mini_c/self_mini_c.ml index 98bc0315c..7a12a9216 100644 --- a/src/passes/7-self_mini_c/self_mini_c.ml +++ b/src/passes/7-self_mini_c/self_mini_c.ml @@ -23,7 +23,7 @@ let is_pure_constant : constant -> bool = | C_NEG | C_OR | C_AND | C_XOR | C_NOT | C_EQ | C_NEQ | C_LT | C_LE | C_GT | C_GE | C_SOME - | C_UPDATE | C_MAP_GET | C_MAP_FIND_OPT | C_MAP_ADD | C_MAP_UPDATE + | C_UPDATE | C_MAP_FIND_OPT | C_MAP_ADD | C_MAP_UPDATE | C_INT | C_ABS | C_IS_NAT | C_BALANCE | C_AMOUNT | C_ADDRESS | C_NOW | C_SOURCE | C_SENDER | C_CHAIN_ID | C_SET_MEM | C_SET_ADD | C_SET_REMOVE | C_SLICE @@ -34,7 +34,7 @@ let is_pure_constant : constant -> bool = | C_ADD | C_SUB |C_MUL|C_DIV|C_MOD (* impure: *) | C_ASSERTION | C_ASSERT_INFERRED - | C_MAP_GET_FORCE | C_MAP_FIND + | C_MAP_FIND | C_FOLD_WHILE | C_CALL (* TODO... *) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 49f693030..fdeb599c2 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -66,7 +66,7 @@ module Simplify = struct module Pascaligo = struct let constants = function - | "get_force" -> ok C_MAP_GET_FORCE + | "get_force" -> ok C_MAP_FIND | "get_chain_id" -> ok C_CHAIN_ID | "transaction" -> ok C_CALL | "get_contract" -> ok C_CONTRACT @@ -109,7 +109,7 @@ module Simplify = struct | "map_fold" -> ok C_MAP_FOLD | "map_remove" -> ok C_MAP_REMOVE | "map_update" -> ok C_MAP_UPDATE - | "map_get" -> ok C_MAP_GET + | "map_get" -> ok C_MAP_FIND_OPT | "map_mem" -> ok C_MAP_MEM | "sha_256" -> ok C_SHA256 | "sha_512" -> ok C_SHA512 @@ -163,7 +163,6 @@ module Simplify = struct | "Current.failwith" -> ok C_FAILWITH | "failwith" -> ok C_FAILWITH - | "Crypto.hash" -> ok C_HASH | "Crypto.blake2b" -> ok C_BLAKE2b | "Crypto.sha256" -> ok C_SHA256 | "Crypto.sha512" -> ok C_SHA512 @@ -424,8 +423,6 @@ module Typer = struct | C_LIST_FOLD -> ok @@ failwith "t_list_fold" ; | C_LIST_CONS -> ok @@ failwith "t_list_cons" ; (* MAP *) - | C_MAP_GET -> ok @@ failwith "t_map_get" ; - | C_MAP_GET_FORCE -> ok @@ failwith "t_map_get_force" ; | C_MAP_ADD -> ok @@ t_map_add ; | C_MAP_REMOVE -> ok @@ t_map_remove ; | C_MAP_UPDATE -> ok @@ t_map_update ; @@ -562,16 +559,6 @@ module Typer = struct let default = t_unit () in ok @@ Simple_utils.Option.unopt ~default opt - let map_get_force = typer_2 "MAP_GET_FORCE" @@ fun i m -> - let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in - let%bind _ = assert_type_value_eq (src, i) in - ok dst - - let map_get = typer_2 "MAP_GET" @@ fun i m -> - let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in - let%bind _ = assert_type_value_eq (src, i) in - ok @@ t_option dst () - let int : typer = typer_1 "INT" @@ fun t -> let%bind () = assert_t_nat t in ok @@ t_int () @@ -1034,8 +1021,6 @@ module Typer = struct | C_LIST_FOLD -> ok @@ list_fold ; | C_LIST_CONS -> ok @@ list_cons ; (* MAP *) - | C_MAP_GET -> ok @@ map_get ; - | C_MAP_GET_FORCE -> ok @@ map_get_force ; | C_MAP_ADD -> ok @@ map_add ; | C_MAP_REMOVE -> ok @@ map_remove ; | C_MAP_UPDATE -> ok @@ map_update ; @@ -1115,9 +1100,7 @@ module Compiler = struct | C_GE -> ok @@ simple_binary @@ seq [prim I_COMPARE ; prim I_GE] | C_UPDATE -> ok @@ simple_ternary @@ prim I_UPDATE | C_SOME -> ok @@ simple_unary @@ prim I_SOME - | C_MAP_GET_FORCE -> ok @@ simple_binary @@ seq [prim I_GET ; i_assert_some_msg (i_push_string "GET_FORCE")] | C_MAP_FIND -> ok @@ simple_binary @@ seq [prim I_GET ; i_assert_some_msg (i_push_string "MAP FIND")] - | C_MAP_GET -> ok @@ simple_binary @@ prim I_GET | C_MAP_MEM -> ok @@ simple_binary @@ prim I_MEM | C_MAP_FIND_OPT -> ok @@ simple_binary @@ prim I_GET | C_MAP_ADD -> ok @@ simple_ternary @@ seq [dip (i_some) ; prim I_UPDATE] diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index 773b5eaab..a47965e57 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -82,8 +82,6 @@ let constant ppf : constant -> unit = function | C_MAP -> fprintf ppf "MAP" | C_MAP_EMPTY -> fprintf ppf "MAP_EMPTY" | C_MAP_LITERAL -> fprintf ppf "MAP_LITERAL" - | C_MAP_GET -> fprintf ppf "MAP_GET" - | C_MAP_GET_FORCE -> fprintf ppf "MAP_GET_FORCE" | C_MAP_ADD -> fprintf ppf "MAP_ADD" | C_MAP_REMOVE -> fprintf ppf "MAP_REMOVE" | C_MAP_UPDATE -> fprintf ppf "MAP_UPDATE" @@ -101,7 +99,6 @@ let constant ppf : constant -> unit = function | C_SHA256 -> fprintf ppf "SHA256" | C_SHA512 -> fprintf ppf "SHA512" | C_BLAKE2b -> fprintf ppf "BLAKE2b" - | C_HASH -> fprintf ppf "HASH" | C_HASH_KEY -> fprintf ppf "HASH_KEY" | C_CHECK_SIGNATURE -> fprintf ppf "CHECK_SIGNATURE" | C_CHAIN_ID -> fprintf ppf "CHAIN_ID" diff --git a/src/stages/common/types.ml b/src/stages/common/types.ml index a0c6f9cb6..1d65e14d5 100644 --- a/src/stages/common/types.ml +++ b/src/stages/common/types.ml @@ -199,8 +199,6 @@ type constant = | C_MAP | C_MAP_EMPTY | C_MAP_LITERAL - | C_MAP_GET - | C_MAP_GET_FORCE | C_MAP_ADD | C_MAP_REMOVE | C_MAP_UPDATE @@ -218,7 +216,6 @@ type constant = | C_SHA256 | C_SHA512 | C_BLAKE2b - | C_HASH | C_HASH_KEY | C_CHECK_SIGNATURE | C_CHAIN_ID From 78693b482c511f2e5814ecc3d24aade2de5c96c2 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 6 Feb 2020 18:12:44 +0100 Subject: [PATCH 024/119] remove unused test --- src/test/contracts/new-syntax.mligo | 19 ------------------- src/test/integration_tests.ml | 7 ------- 2 files changed, 26 deletions(-) delete mode 100644 src/test/contracts/new-syntax.mligo diff --git a/src/test/contracts/new-syntax.mligo b/src/test/contracts/new-syntax.mligo deleted file mode 100644 index 9f318f2d1..000000000 --- a/src/test/contracts/new-syntax.mligo +++ /dev/null @@ -1,19 +0,0 @@ -type storage = { - challenge : string; -} - -type param = { - new_challenge : string; - attempt : bytes; -} - -let attempt (p: param) storage = - if Crypto.hash (Bytes.pack p.attempt) <> Bytes.pack storage.challenge - then failwith "Failed challenge" - else - let contract : unit contract = - Operation.get_contract sender in - let transfer : operation = - Operation.transaction (unit, contract, 10tz) in - let storage : storage = {challenge = p.new_challenge} - in ([] : operation list), storage diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 204d2fc55..247832641 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1458,12 +1458,6 @@ let assert_religo () : unit result = let%bind _ = expect_eq program "main" (make_input true) make_expected in ok () -let guess_the_hash_mligo () : unit result = - let%bind program = mtype_file "./contracts/new-syntax.mligo" in - let make_input = fun n-> e_pair (e_int n) (e_int 42) in - let make_expected = fun n -> e_pair (e_typed_list [] t_operation) (e_int (42 + n)) in - expect_eq_n program "main" make_input make_expected - let guess_string_mligo () : unit result = let%bind program = type_file "./contracts/guess_string.mligo" in let make_input = fun n -> e_pair (e_int n) (e_int 42) in @@ -2314,7 +2308,6 @@ let main = test_suite "Integration (End to End)" [ (* test "list matching (mligo)" mligo_list ; *) test "list matching (mligo)" mligo_list ; test "list matching (religo)" religo_list ; - (* test "guess the hash mligo" guess_the_hash_mligo ; WIP? *) test "failwith ligo" failwith_ligo ; test "failwith mligo" failwith_mligo ; test "assert mligo" assert_mligo ; From dfb4c4caa329fad645b03ca761dfc56f4cd81925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jev=20Bj=C3=B6rsell?= Date: Thu, 6 Feb 2020 18:43:24 -0800 Subject: [PATCH 025/119] Move CI ENV vars and use a recent docker image When this MR is merged, remove `LIGO_REGISTRY_IMAGE_BASE_NAME` and `LIGO_REGISTRY_IMAGE` from gitlabs CI settings: https://gitlab.com/ligolang/ligo/-/settings/ci_cd This will allow CI builds to run in forked repositories. Use a recent docker/dind image that supports `--cache-from` which will be put to use in later MRs. --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be47c3829..8710225f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ variables: GIT_SUBMODULE_STRATEGY: recursive build_binary_script: "./scripts/distribution/generic/build.sh" package_binary_script: "./scripts/distribution/generic/package.sh" + LIGO_REGISTRY_IMAGE_BASE_NAME: "${CI_PROJECT_PATH}/${CI_PROJECT_NAME}" stages: - test @@ -75,9 +76,9 @@ dont-merge-to-master: - public .docker: &docker - image: docker:1.11 + image: docker:19 services: - - docker:dind + - docker:19-dind .before_script: &before_script From c119c44c136ca185840b0172bc4adf669eedbfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jev=20Bj=C3=B6rsell?= Date: Thu, 6 Feb 2020 19:04:18 -0800 Subject: [PATCH 026/119] Import webide into main ligo monorepo When this is merged https://gitlab.com/ligolang/ligo-web-ide/ will be marked as deprecated. This MR does not hook up the webide build to the main CI. The CI integration will come in a subsequent MR for the sake of making review easier. --- tools/webide/.editorconfig | 10 + tools/webide/.gitignore | 4 + tools/webide/Dockerfile | 32 + tools/webide/README.md | 12 + tools/webide/package.json | 17 + tools/webide/packages/client/.gitignore | 23 + tools/webide/packages/client/README.md | 44 + .../cameligo/arithmetic-contract.ligo | 37 + .../pascaligo/arithmetic-contract.ligo | 38 + .../reasonligo/arithmetic-contract.ligo | 39 + tools/webide/packages/client/ligo_run.svg | 84 + .../packages/client/package-examples.js | 118 + .../webide/packages/client/package-lock.json | 16597 ++++++++++++++++ tools/webide/packages/client/package.json | 61 + .../webide/packages/client/public/index.html | 55 + tools/webide/packages/client/public/logo.svg | 1 + .../packages/client/public/manifest.json | 25 + .../webide/packages/client/public/robots.txt | 2 + tools/webide/packages/client/src/App.test.tsx | 9 + tools/webide/packages/client/src/App.tsx | 55 + .../client/src/components/checkbox.tsx | 58 + .../client/src/components/command-select.tsx | 146 + .../client/src/components/compile-pane.tsx | 31 + .../client/src/components/configure-tab.tsx | 142 + .../client/src/components/deploy-pane.tsx | 69 + .../client/src/components/dry-run-pane.tsx | 59 + .../packages/client/src/components/editor.tsx | 32 + .../src/components/evaluate-function-pane.tsx | 45 + .../src/components/evaluate-value-pane.tsx | 31 + .../client/src/components/examples.tsx | 107 + .../client/src/components/float-button.tsx | 83 + .../packages/client/src/components/header.tsx | 68 + .../packages/client/src/components/inputs.tsx | 47 + .../packages/client/src/components/monaco.tsx | 86 + .../client/src/components/output-tab.tsx | 149 + .../packages/client/src/components/share.tsx | 200 + .../client/src/components/syntax-select.tsx | 148 + .../client/src/components/tabs-panel.tsx | 94 + .../packages/client/src/components/toggle.tsx | 83 + .../packages/client/src/configure-store.ts | 31 + tools/webide/packages/client/src/index.css | 79 + tools/webide/packages/client/src/index.tsx | 12 + .../packages/client/src/react-app-env.d.ts | 1 + .../client/src/redux/actions/cancellable.ts | 13 + .../client/src/redux/actions/compile.ts | 39 + .../client/src/redux/actions/deploy.ts | 99 + .../client/src/redux/actions/dry-run.ts | 41 + .../src/redux/actions/evaluate-function.ts | 43 + .../src/redux/actions/evaluate-value.ts | 44 + tools/webide/packages/client/src/redux/app.ts | 41 + .../packages/client/src/redux/command.ts | 45 + .../packages/client/src/redux/compile.ts | 41 + .../packages/client/src/redux/deploy.ts | 66 + .../packages/client/src/redux/dry-run.ts | 66 + .../packages/client/src/redux/editor.ts | 53 + .../client/src/redux/evaluate-function.ts | 55 + .../client/src/redux/evaluate-value.ts | 36 + .../packages/client/src/redux/example.ts | 17 + .../packages/client/src/redux/examples.ts | 38 + .../packages/client/src/redux/loading.ts | 42 + .../packages/client/src/redux/result.ts | 43 + .../webide/packages/client/src/redux/share.ts | 82 + .../webide/packages/client/src/redux/types.ts | 13 + .../packages/client/src/serviceWorker.ts | 143 + .../packages/client/src/services/api.ts | 132 + .../webide/packages/client/src/setupProxy.js | 11 + tools/webide/packages/client/tsconfig.json | 19 + tools/webide/packages/e2e/Dockerfile | 12 + tools/webide/packages/e2e/docker-compose.yml | 18 + .../packages/e2e/jest-puppeteer.config.js | 13 + tools/webide/packages/e2e/package-lock.json | 4820 +++++ tools/webide/packages/e2e/package.json | 22 + .../webide/packages/e2e/test/common-utils.js | 112 + .../e2e/test/compile-contract.spec.js | 34 + .../webide/packages/e2e/test/dry-run.spec.js | 44 + .../e2e/test/evaluate-function.spec.js | 39 + tools/webide/packages/e2e/test/share.spec.js | 210 + tools/webide/packages/server/README.md | 22 + tools/webide/packages/server/jest.config.js | 7 + .../webide/packages/server/package-lock.json | 7506 +++++++ tools/webide/packages/server/package.json | 45 + .../server/src/handlers/compile-contract.ts | 49 + .../server/src/handlers/compile-expression.ts | 46 + .../packages/server/src/handlers/deploy.ts | 68 + .../packages/server/src/handlers/dry-run.ts | 52 + .../server/src/handlers/evaluate-value.ts | 49 + .../server/src/handlers/run-function.ts | 49 + .../packages/server/src/handlers/share.ts | 111 + .../server/src/handlers/shared-link.ts | 36 + tools/webide/packages/server/src/index.ts | 64 + .../packages/server/src/ligo-compiler.ts | 212 + .../webide/packages/server/src/load-state.ts | 50 + tools/webide/packages/server/src/logger.ts | 24 + .../packages/server/src/schemas/migration.ts | 26 + .../server/src/schemas/share-latest.ts | 3 + .../packages/server/src/schemas/share-v0.ts | 29 + .../packages/server/src/schemas/share-v1.ts | 109 + .../packages/server/src/services/key.ts | 13 + .../server/src/storage/disk-storage.ts | 23 + .../server/src/storage/google-storage.ts | 45 + .../packages/server/src/storage/index.ts | 18 + .../packages/server/src/storage/interface.ts | 6 + .../server/test/schemas/share-latest.spec.ts | 7 + .../server/test/schemas/share-v0.spec.ts | 25 + .../server/test/schemas/share-v1.spec.ts | 59 + tools/webide/packages/server/tsconfig.json | 11 + tools/webide/tsconfig.json | 63 + tools/webide/webide-ci.yml | 70 + tools/webide/yarn.lock | 12567 ++++++++++++ 109 files changed, 47074 insertions(+) create mode 100644 tools/webide/.editorconfig create mode 100644 tools/webide/.gitignore create mode 100644 tools/webide/Dockerfile create mode 100644 tools/webide/README.md create mode 100644 tools/webide/package.json create mode 100644 tools/webide/packages/client/.gitignore create mode 100644 tools/webide/packages/client/README.md create mode 100644 tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo create mode 100644 tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo create mode 100644 tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo create mode 100644 tools/webide/packages/client/ligo_run.svg create mode 100644 tools/webide/packages/client/package-examples.js create mode 100644 tools/webide/packages/client/package-lock.json create mode 100644 tools/webide/packages/client/package.json create mode 100644 tools/webide/packages/client/public/index.html create mode 100644 tools/webide/packages/client/public/logo.svg create mode 100644 tools/webide/packages/client/public/manifest.json create mode 100644 tools/webide/packages/client/public/robots.txt create mode 100644 tools/webide/packages/client/src/App.test.tsx create mode 100644 tools/webide/packages/client/src/App.tsx create mode 100644 tools/webide/packages/client/src/components/checkbox.tsx create mode 100644 tools/webide/packages/client/src/components/command-select.tsx create mode 100644 tools/webide/packages/client/src/components/compile-pane.tsx create mode 100644 tools/webide/packages/client/src/components/configure-tab.tsx create mode 100644 tools/webide/packages/client/src/components/deploy-pane.tsx create mode 100644 tools/webide/packages/client/src/components/dry-run-pane.tsx create mode 100644 tools/webide/packages/client/src/components/editor.tsx create mode 100644 tools/webide/packages/client/src/components/evaluate-function-pane.tsx create mode 100644 tools/webide/packages/client/src/components/evaluate-value-pane.tsx create mode 100644 tools/webide/packages/client/src/components/examples.tsx create mode 100644 tools/webide/packages/client/src/components/float-button.tsx create mode 100644 tools/webide/packages/client/src/components/header.tsx create mode 100644 tools/webide/packages/client/src/components/inputs.tsx create mode 100644 tools/webide/packages/client/src/components/monaco.tsx create mode 100644 tools/webide/packages/client/src/components/output-tab.tsx create mode 100644 tools/webide/packages/client/src/components/share.tsx create mode 100644 tools/webide/packages/client/src/components/syntax-select.tsx create mode 100644 tools/webide/packages/client/src/components/tabs-panel.tsx create mode 100644 tools/webide/packages/client/src/components/toggle.tsx create mode 100644 tools/webide/packages/client/src/configure-store.ts create mode 100644 tools/webide/packages/client/src/index.css create mode 100644 tools/webide/packages/client/src/index.tsx create mode 100644 tools/webide/packages/client/src/react-app-env.d.ts create mode 100644 tools/webide/packages/client/src/redux/actions/cancellable.ts create mode 100644 tools/webide/packages/client/src/redux/actions/compile.ts create mode 100644 tools/webide/packages/client/src/redux/actions/deploy.ts create mode 100644 tools/webide/packages/client/src/redux/actions/dry-run.ts create mode 100644 tools/webide/packages/client/src/redux/actions/evaluate-function.ts create mode 100644 tools/webide/packages/client/src/redux/actions/evaluate-value.ts create mode 100644 tools/webide/packages/client/src/redux/app.ts create mode 100644 tools/webide/packages/client/src/redux/command.ts create mode 100644 tools/webide/packages/client/src/redux/compile.ts create mode 100644 tools/webide/packages/client/src/redux/deploy.ts create mode 100644 tools/webide/packages/client/src/redux/dry-run.ts create mode 100644 tools/webide/packages/client/src/redux/editor.ts create mode 100644 tools/webide/packages/client/src/redux/evaluate-function.ts create mode 100644 tools/webide/packages/client/src/redux/evaluate-value.ts create mode 100644 tools/webide/packages/client/src/redux/example.ts create mode 100644 tools/webide/packages/client/src/redux/examples.ts create mode 100644 tools/webide/packages/client/src/redux/loading.ts create mode 100644 tools/webide/packages/client/src/redux/result.ts create mode 100644 tools/webide/packages/client/src/redux/share.ts create mode 100644 tools/webide/packages/client/src/redux/types.ts create mode 100644 tools/webide/packages/client/src/serviceWorker.ts create mode 100644 tools/webide/packages/client/src/services/api.ts create mode 100644 tools/webide/packages/client/src/setupProxy.js create mode 100644 tools/webide/packages/client/tsconfig.json create mode 100644 tools/webide/packages/e2e/Dockerfile create mode 100644 tools/webide/packages/e2e/docker-compose.yml create mode 100644 tools/webide/packages/e2e/jest-puppeteer.config.js create mode 100644 tools/webide/packages/e2e/package-lock.json create mode 100644 tools/webide/packages/e2e/package.json create mode 100644 tools/webide/packages/e2e/test/common-utils.js create mode 100644 tools/webide/packages/e2e/test/compile-contract.spec.js create mode 100644 tools/webide/packages/e2e/test/dry-run.spec.js create mode 100644 tools/webide/packages/e2e/test/evaluate-function.spec.js create mode 100644 tools/webide/packages/e2e/test/share.spec.js create mode 100644 tools/webide/packages/server/README.md create mode 100644 tools/webide/packages/server/jest.config.js create mode 100644 tools/webide/packages/server/package-lock.json create mode 100644 tools/webide/packages/server/package.json create mode 100644 tools/webide/packages/server/src/handlers/compile-contract.ts create mode 100644 tools/webide/packages/server/src/handlers/compile-expression.ts create mode 100644 tools/webide/packages/server/src/handlers/deploy.ts create mode 100644 tools/webide/packages/server/src/handlers/dry-run.ts create mode 100644 tools/webide/packages/server/src/handlers/evaluate-value.ts create mode 100644 tools/webide/packages/server/src/handlers/run-function.ts create mode 100644 tools/webide/packages/server/src/handlers/share.ts create mode 100644 tools/webide/packages/server/src/handlers/shared-link.ts create mode 100644 tools/webide/packages/server/src/index.ts create mode 100644 tools/webide/packages/server/src/ligo-compiler.ts create mode 100644 tools/webide/packages/server/src/load-state.ts create mode 100644 tools/webide/packages/server/src/logger.ts create mode 100644 tools/webide/packages/server/src/schemas/migration.ts create mode 100644 tools/webide/packages/server/src/schemas/share-latest.ts create mode 100644 tools/webide/packages/server/src/schemas/share-v0.ts create mode 100644 tools/webide/packages/server/src/schemas/share-v1.ts create mode 100644 tools/webide/packages/server/src/services/key.ts create mode 100644 tools/webide/packages/server/src/storage/disk-storage.ts create mode 100644 tools/webide/packages/server/src/storage/google-storage.ts create mode 100644 tools/webide/packages/server/src/storage/index.ts create mode 100644 tools/webide/packages/server/src/storage/interface.ts create mode 100644 tools/webide/packages/server/test/schemas/share-latest.spec.ts create mode 100644 tools/webide/packages/server/test/schemas/share-v0.spec.ts create mode 100644 tools/webide/packages/server/test/schemas/share-v1.spec.ts create mode 100644 tools/webide/packages/server/tsconfig.json create mode 100644 tools/webide/tsconfig.json create mode 100644 tools/webide/webide-ci.yml create mode 100644 tools/webide/yarn.lock diff --git a/tools/webide/.editorconfig b/tools/webide/.editorconfig new file mode 100644 index 000000000..c91f545e3 --- /dev/null +++ b/tools/webide/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +insert_final_newline = true +end_of_line = lf + +[*.{js,ts,tsx,json,css}] +indent_style = space +indent_size = 2 +quote_type = single diff --git a/tools/webide/.gitignore b/tools/webide/.gitignore new file mode 100644 index 000000000..c381c0181 --- /dev/null +++ b/tools/webide/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +tmp/ +dist +*.log diff --git a/tools/webide/Dockerfile b/tools/webide/Dockerfile new file mode 100644 index 000000000..4dfa9963a --- /dev/null +++ b/tools/webide/Dockerfile @@ -0,0 +1,32 @@ +FROM node:12-alpine as builder + +WORKDIR /app + +COPY package.json package.json +COPY yarn.lock yarn.lock +COPY packages/client packages/client +COPY packages/server packages/server + +RUN yarn install + +COPY tsconfig.json tsconfig.json + +RUN yarn workspaces run build + +FROM node:12-buster + +WORKDIR /app + +RUN apt-get update && apt-get -y install libev-dev perl pkg-config libgmp-dev libhidapi-dev m4 libcap-dev bubblewrap rsync + +COPY ligo_deb10.deb /tmp/ligo_deb10.deb +RUN dpkg -i /tmp/ligo_deb10.deb && rm /tmp/ligo_deb10.deb + +COPY --from=builder /app/packages/client/build /app/client/build +COPY --from=builder /app/node_modules /app/node_modules +COPY --from=builder /app/packages/server/dist/src /app/server/dist + +ENV STATIC_ASSETS /app/client +ENV LIGO_CMD /bin/ligo + +ENTRYPOINT [ "node", "server/dist/index.js" ] diff --git a/tools/webide/README.md b/tools/webide/README.md new file mode 100644 index 000000000..bf9724e1a --- /dev/null +++ b/tools/webide/README.md @@ -0,0 +1,12 @@ +# Quick Start + +Install `yarn`. +Run `yarn` to install dependencies. + +## Server + +See the README under the `packages/server/` for information about how to get started on the server development. + +## Client + +See the README under the `packages/client/` for information about how to get started on the client development. diff --git a/tools/webide/package.json b/tools/webide/package.json new file mode 100644 index 000000000..cf8c93ff9 --- /dev/null +++ b/tools/webide/package.json @@ -0,0 +1,17 @@ +{ + "name": "ligo-editor", + "version": "1.0.0", + "private": true, + "workspaces": [ + "packages/*" + ], + "description": "", + "scripts": { + "prestart": "cd packages/client && npm run build", + "start": "" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@gitlab.com:ligolang/ligo-web-ide.git" + } +} diff --git a/tools/webide/packages/client/.gitignore b/tools/webide/packages/client/.gitignore new file mode 100644 index 000000000..4d29575de --- /dev/null +++ b/tools/webide/packages/client/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/tools/webide/packages/client/README.md b/tools/webide/packages/client/README.md new file mode 100644 index 000000000..2fa78e71b --- /dev/null +++ b/tools/webide/packages/client/README.md @@ -0,0 +1,44 @@ +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `yarn start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+You will also see any lint errors in the console. + +### `yarn test` + +Launches the test runner in the interactive watch mode.
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `yarn build` + +Builds the app for production to the `build` folder.
+It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo b/tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo new file mode 100644 index 000000000..ac674c6ef --- /dev/null +++ b/tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo @@ -0,0 +1,37 @@ +(*_* + name: Cameligo Contract + language: cameligo + compile: + entrypoint: main + dryRun: + entrypoint: main + parameters: Increment 1 + storage: 0 + deploy: + entrypoint: main + storage: 0 + evaluateValue: + entrypoint: "" + evaluateFunction: + entrypoint: add + parameters: 5, 6 +*_*) +type storage = int + +(* variant defining pseudo multi-entrypoint actions *) + +type action = +| Increment of int +| Decrement of int + +let add (a,b: int * int) : int = a + b +let sub (a,b: int * int) : int = a - b + +(* real entrypoint that re-routes the flow based on the action provided *) + +let main (p,s: action * storage) = + let storage = + match p with + | Increment n -> add (s, n) + | Decrement n -> sub (s, n) + in ([] : operation list), storage diff --git a/tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo b/tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo new file mode 100644 index 000000000..d533ba6e4 --- /dev/null +++ b/tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo @@ -0,0 +1,38 @@ +(*_* + name: Pascaligo Contract + language: pascaligo + compile: + entrypoint: main + dryRun: + entrypoint: main + parameters: Increment (1) + storage: 0 + deploy: + entrypoint: main + storage: 0 + evaluateValue: + entrypoint: "" + evaluateFunction: + entrypoint: add + parameters: (5, 6) +*_*) +// variant defining pseudo multi-entrypoint actions +type action is +| Increment of int +| Decrement of int + +function add (const a : int ; const b : int) : int is + block { skip } with a + b + +function subtract (const a : int ; const b : int) : int is + block { skip } with a - b + +// real entrypoint that re-routes the flow based +// on the action provided +function main (const p : action ; const s : int) : + (list(operation) * int) is + block { skip } with ((nil : list(operation)), + case p of + | Increment(n) -> add(s, n) + | Decrement(n) -> subtract(s, n) + end) diff --git a/tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo b/tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo new file mode 100644 index 000000000..646d9c3a7 --- /dev/null +++ b/tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo @@ -0,0 +1,39 @@ +(*_* + name: Reasonligo Contract + language: reasonligo + compile: + entrypoint: main + dryRun: + entrypoint: main + parameters: Increment (1) + storage: 0 + deploy: + entrypoint: main + storage: 0 + evaluateValue: + entrypoint: "" + evaluateFunction: + entrypoint: add + parameters: (5, 6) +*_*) +type storage = int; + +/* variant defining pseudo multi-entrypoint actions */ + +type action = + | Increment(int) + | Decrement(int); + +let add = ((a,b): (int, int)): int => a + b; +let sub = ((a,b): (int, int)): int => a - b; + +/* real entrypoint that re-routes the flow based on the action provided */ + +let main = ((p,storage): (action, storage)) => { + let storage = + switch (p) { + | Increment(n) => add((storage, n)) + | Decrement(n) => sub((storage, n)) + }; + ([]: list(operation), storage); +}; diff --git a/tools/webide/packages/client/ligo_run.svg b/tools/webide/packages/client/ligo_run.svg new file mode 100644 index 000000000..642bb327a --- /dev/null +++ b/tools/webide/packages/client/ligo_run.svg @@ -0,0 +1,84 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/tools/webide/packages/client/package-examples.js b/tools/webide/packages/client/package-examples.js new file mode 100644 index 000000000..848721660 --- /dev/null +++ b/tools/webide/packages/client/package-examples.js @@ -0,0 +1,118 @@ +const createHash = require('crypto').createHash; +const glob = require('glob'); +const join = require('path').join; +const fs = require('fs'); +const YAML = require('yamljs'); + +function urlFriendlyHash(content) { + const hash = createHash('md5'); + hash.update(content); + + return hash + .digest('base64') + .replace(/\+/g, '-') + .replace(/\//g, '_') + .replace(/=/g, ''); +} + +function convertToJson(content, path) { + const METADATA_REGEX = /\(\*_\*([^]*?)\*_\*\)\s*/; + const match = content.match(METADATA_REGEX); + + if (!match || !match[1]) { + throw new Error(`Unable to find compiler configuration in ${path}.`); + } + + try { + const config = YAML.parse(match[1]); + config.editor = { + language: config.language, + code: content.replace(METADATA_REGEX, '') + }; + delete config.language; + + return config; + } catch (ex) { + throw new Error(`${path} doesn't contain valid metadata. ${ex}`); + } +} + +function findFiles(pattern, dir) { + return new Promise((resolve, reject) => { + glob(pattern, { cwd: dir }, (error, files) => { + if (error) { + reject(error); + } else { + resolve(files); + } + }); + }); +} + +function readFile(path) { + return new Promise((resolve, reject) => { + fs.readFile(path, 'utf8', (error, content) => { + if (error) { + reject(error); + } else { + resolve(content); + } + }); + }); +} + +function writeFile(path, config) { + return new Promise((resolve, reject) => { + fs.writeFile(path, JSON.stringify(config), error => { + if (error) { + reject(error); + } else { + resolve(); + } + }); + }); +} + +async function processExample(srcDir, file, destDir) { + const path = join(srcDir, file); + + console.log(`Processing ${path}`); + + const content = await readFile(path); + const config = convertToJson(content, path); + const id = urlFriendlyHash(file); + + config.id = id; + + await writeFile(join(destDir, id), config); + + return { id: id, name: config.name }; +} + +function processExamples(srcDir, files, destDir) { + return Promise.all(files.map(file => processExample(srcDir, file, destDir))); +} + +async function main() { + process.on('unhandledRejection', error => { + throw error; + }); + + const EXAMPLES_DEST_DIR = join(process.cwd(), 'build', 'static', 'examples'); + const EXAMPLES_DIR = join(process.cwd(), 'examples'); + const EXAMPLES_GLOB = '**/*.ligo'; + const EXAMPLES_LIST_FILE = 'list'; + + fs.mkdirSync(EXAMPLES_DEST_DIR, { recursive: true }); + + const files = await findFiles(EXAMPLES_GLOB, EXAMPLES_DIR); + const examples = await processExamples( + EXAMPLES_DIR, + files, + EXAMPLES_DEST_DIR + ); + + await writeFile(join(EXAMPLES_DEST_DIR, EXAMPLES_LIST_FILE), examples); +} + +main(); diff --git a/tools/webide/packages/client/package-lock.json b/tools/webide/packages/client/package-lock.json new file mode 100644 index 000000000..3fb2eb759 --- /dev/null +++ b/tools/webide/packages/client/package-lock.json @@ -0,0 +1,16597 @@ +{ + "name": "client", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/compat-data": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.8.1.tgz", + "integrity": "sha512-Z+6ZOXvyOWYxJ50BwxzdhRnRsGST8Y3jaZgxYig575lTjVSs3KtJnmESwZegg6e2Dn0td1eDhoWlp1wI4BTCPw==", + "requires": { + "browserslist": "^4.8.2", + "invariant": "^2.2.4", + "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "@babel/core": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.0.tgz", + "integrity": "sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw==", + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.6.0", + "@babel/helpers": "^7.6.0", + "@babel/parser": "^7.6.0", + "@babel/template": "^7.6.0", + "@babel/traverse": "^7.6.0", + "@babel/types": "^7.6.0", + "convert-source-map": "^1.1.0", + "debug": "^4.1.0", + "json5": "^2.1.0", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "@babel/generator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.3.tgz", + "integrity": "sha512-WjoPk8hRpDRqqzRpvaR8/gDUPkrnOOeuT2m8cNICJtZH6mwaCo3v0OKMI7Y6SM1pBtyijnLtAL0HDi41pf41ug==", + "requires": { + "@babel/types": "^7.8.3", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz", + "integrity": "sha512-6o+mJrZBxOoEX77Ezv9zwW7WV8DdluouRKNY/IR5u/YTMuKHgugHOzYWlYvYLpLA9nPsQCAAASpCIbjI9Mv+Uw==", + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.8.3.tgz", + "integrity": "sha512-5eFOm2SyFPK4Rh3XMMRDjN7lBH0orh3ss0g3rTYZnBQ+r6YPj7lgDyCvPphynHvUrobJmeMignBr6Acw9mAPlw==", + "requires": { + "@babel/helper-explode-assignable-expression": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-builder-react-jsx": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.8.3.tgz", + "integrity": "sha512-JT8mfnpTkKNCboTqZsQTdGo3l3Ik3l7QIt9hh0O9DYiwVel37VoJpILKM4YFbP2euF32nkQSb+F9cUk9b7DDXQ==", + "requires": { + "@babel/types": "^7.8.3", + "esutils": "^2.0.0" + } + }, + "@babel/helper-call-delegate": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.8.3.tgz", + "integrity": "sha512-6Q05px0Eb+N4/GTyKPPvnkig7Lylw+QzihMpws9iiZQv7ZImf84ZsZpQH7QoWN4n4tm81SnSzPgHw2qtO0Zf3A==", + "requires": { + "@babel/helper-hoist-variables": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.8.3.tgz", + "integrity": "sha512-JLylPCsFjhLN+6uBSSh3iYdxKdeO9MNmoY96PE/99d8kyBFaXLORtAVhqN6iHa+wtPeqxKLghDOZry0+Aiw9Tw==", + "requires": { + "@babel/compat-data": "^7.8.1", + "browserslist": "^4.8.2", + "invariant": "^2.2.4", + "levenary": "^1.1.0", + "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.3.tgz", + "integrity": "sha512-qmp4pD7zeTxsv0JNecSBsEmG1ei2MqwJq4YQcK3ZWm/0t07QstWfvuV/vm3Qt5xNMFETn2SZqpMx2MQzbtq+KA==", + "requires": { + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3" + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.8.3.tgz", + "integrity": "sha512-Gcsm1OHCUr9o9TcJln57xhWHtdXbA2pgQ58S0Lxlks0WMGNXuki4+GLfX0p+L2ZkINUGZvfkz8rzoqJQSthI+Q==", + "requires": { + "@babel/helper-regex": "^7.8.3", + "regexpu-core": "^4.6.0" + } + }, + "@babel/helper-define-map": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.8.3.tgz", + "integrity": "sha512-PoeBYtxoZGtct3md6xZOCWPcKuMuk3IHhgxsRRNtnNShebf4C8YonTSblsK4tvDbm+eJAw2HAPOfCr+Q/YRG/g==", + "requires": { + "@babel/helper-function-name": "^7.8.3", + "@babel/types": "^7.8.3", + "lodash": "^4.17.13" + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.8.3.tgz", + "integrity": "sha512-N+8eW86/Kj147bO9G2uclsg5pwfs/fqqY5rwgIL7eTBklgXjcOJ3btzS5iM6AitJcftnY7pm2lGsrJVYLGjzIw==", + "requires": { + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-function-name": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", + "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", + "requires": { + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", + "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.8.3.tgz", + "integrity": "sha512-ky1JLOjcDUtSc+xkt0xhYff7Z6ILTAHKmZLHPxAhOP0Nd77O+3nCsd6uSVYur6nJnCI029CrNbYlc0LoPfAPQg==", + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", + "integrity": "sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA==", + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-module-imports": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", + "integrity": "sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==", + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-module-transforms": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.8.3.tgz", + "integrity": "sha512-C7NG6B7vfBa/pwCOshpMbOYUmrYQDfCpVL/JCRu0ek8B5p8kue1+BCXpg2vOYs7w5ACB9GTOBYQ5U6NwrMg+3Q==", + "requires": { + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-simple-access": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3", + "lodash": "^4.17.13" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", + "integrity": "sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ==", + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", + "integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==" + }, + "@babel/helper-regex": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.8.3.tgz", + "integrity": "sha512-BWt0QtYv/cg/NecOAZMdcn/waj/5P26DR4mVLXfFtDokSR6fyuG0Pj+e2FqtSME+MqED1khnSMulkmGl8qWiUQ==", + "requires": { + "lodash": "^4.17.13" + } + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.8.3.tgz", + "integrity": "sha512-kgwDmw4fCg7AVgS4DukQR/roGp+jP+XluJE5hsRZwxCYGg+Rv9wSGErDWhlI90FODdYfd4xG4AQRiMDjjN0GzA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-wrap-function": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-replace-supers": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.8.3.tgz", + "integrity": "sha512-xOUssL6ho41U81etpLoT2RTdvdus4VfHamCuAm4AHxGr+0it5fnwoVdwUJ7GFEqCsQYzJUhcbsN9wB9apcYKFA==", + "requires": { + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-simple-access": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", + "integrity": "sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw==", + "requires": { + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", + "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-wrap-function": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.8.3.tgz", + "integrity": "sha512-LACJrbUET9cQDzb6kG7EeD7+7doC3JNvUgTEQOx2qaO1fKlzE/Bf05qs9w1oXQMmXlPO65lC3Tq9S6gZpTErEQ==", + "requires": { + "@babel/helper-function-name": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helpers": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.3.tgz", + "integrity": "sha512-LmU3q9Pah/XyZU89QvBgGt+BCsTPoQa+73RxAQh8fb8qkDyIfeQnmgs+hvzhTCKTzqOyk7JTkS3MS1S8Mq5yrQ==", + "requires": { + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/highlight": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", + "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.3.tgz", + "integrity": "sha512-/V72F4Yp/qmHaTALizEm9Gf2eQHV3QyTL3K0cNfijwnMnb1L+LDlAubb/ZnSdGAVzVSWakujHYs1I26x66sMeQ==" + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz", + "integrity": "sha512-NZ9zLv848JsV3hs8ryEh7Uaz/0KsmPLqv0+PdkDJL1cJy0K4kOCFa8zc1E3mp+RHPQcpdfb/6GovEsW4VDrOMw==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-remap-async-to-generator": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0" + } + }, + "@babel/plugin-proposal-class-properties": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.4.tgz", + "integrity": "sha512-EcuXeV4Hv1X3+Q1TsuOmyyxeTRiSqurGJ26+I/FW1WbymmRRapVORm6x1Zl3iDIHyRxEs+VXWp6qnlcfcJSbbw==", + "requires": { + "@babel/helper-create-class-features-plugin": "^7.7.4", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-proposal-decorators": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.7.4.tgz", + "integrity": "sha512-GftcVDcLCwVdzKmwOBDjATd548+IE+mBo7ttgatqNDR7VG7GqIuZPtRWlMLHbhTXhcnFZiGER8iIYl1n/imtsg==", + "requires": { + "@babel/helper-create-class-features-plugin": "^7.7.4", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-decorators": "^7.7.4" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz", + "integrity": "sha512-NyaBbyLFXFLT9FP+zk0kYlUlA8XtCUbehs67F0nnEg7KICgMc2mNkIeu9TYhKzyXMkrapZFwAhXLdnt4IYHy1w==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.0" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.8.3.tgz", + "integrity": "sha512-KGhQNZ3TVCQG/MjRbAUwuH+14y9q0tpxs1nWWs3pbSleRdDro9SAMMDyye8HhY1gqZ7/NqIc8SKhya0wRDgP1Q==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.0" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-TS9MlfzXpXKt6YYomudb/KU7nQI6/xnapG6in1uZxoxDghuSMZsPb6D2fyUwNYSAp4l1iR7QtFOjkqcRYcUsfw==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.7.4.tgz", + "integrity": "sha512-CG605v7lLpVgVldSY6kxsN9ui1DxFOyepBfuX2AzU2TNriMAYApoU55mrGw9Jr4TlrTzPCG10CL8YXyi+E/iPw==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-numeric-separator": "^7.7.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-8qvuPwU/xxUCt78HocNlv0mXXo0wdh9VT1R04WU8HGOfaOob26pF+9P5/lYjN/q7DHOX1bvX60hnhOvuQUJdbA==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-0gkX7J7E+AtAw9fcwlVQj8peP61qhdg/89D5swOkjYbkboA2CVckn3kiyum1DE0wskGb7KJJxBdyEBApDLLVdw==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.8.3.tgz", + "integrity": "sha512-QIoIR9abkVn+seDE3OjA08jWcs3eZ9+wJCKSRgo3WdEU2csFYgdScb+8qHB3+WXsGJD55u+5hWCISI7ejXS+kg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.0" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.8.3.tgz", + "integrity": "sha512-1/1/rEZv2XGweRwwSkLpY+s60za9OZ1hJs4YDqFHCw0kYWYwL5IFljVY1MYBL+weT1l9pokDO2uhSTLVxzoHkQ==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-decorators": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.8.3.tgz", + "integrity": "sha512-8Hg4dNNT9/LcA1zQlfwuKR8BUc/if7Q7NkTam9sGTcJphLwpf2g4S42uhspQrIrR+dpzE0dtTqBVFoHl8GtnnQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-flow": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.8.3.tgz", + "integrity": "sha512-innAx3bUbA0KSYj2E2MNFSn9hiCeowOFLxlsuhXzw8hMQnzkDomUr9QCD7E9VF60NmnG1sNTuuv6Qf4f8INYsg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.8.3.tgz", + "integrity": "sha512-WxdW9xyLgBdefoo0Ynn3MRSkhe5tFVxxKNVdnZSh318WrG2e2jH+E9wd/++JsqcLJZPfz87njQJ8j2Upjm0M0A==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.8.3.tgz", + "integrity": "sha512-H7dCMAdN83PcCmqmkHB5dtp+Xa9a6LKSvA2hiFBC/5alSHxM5VgWZXFqDi0YFe8XNGT6iCa+z4V4zSt/PdZ7Dw==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.8.3.tgz", + "integrity": "sha512-kwj1j9lL/6Wd0hROD3b/OZZ7MSrZLqqn9RAZ5+cYYsflQ9HZBIKCUkr3+uL1MEJ1NePiUbf98jjiMQSv0NMR9g==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.8.3.tgz", + "integrity": "sha512-GO1MQ/SGGGoiEXY0e0bSpHimJvxqB7lktLLIq2pv8xG7WZ8IMEle74jIe1FhprHBWjwjZtXHkycDLZXIWM5Wfg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.8.3.tgz", + "integrity": "sha512-0MRF+KC8EqH4dbuITCWwPSzsyO3HIWWlm30v8BbbpOrS1B++isGxPnnuq/IZvOX5J2D/p7DQalQm+/2PnlKGxg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.8.3.tgz", + "integrity": "sha512-imt9tFLD9ogt56Dd5CI/6XgpukMwd/fLGSrix2httihVe7LOGVPhyhMh1BU5kDM7iHD08i8uUtmV2sWaBFlHVQ==", + "requires": { + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-remap-async-to-generator": "^7.8.3" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.8.3.tgz", + "integrity": "sha512-vo4F2OewqjbB1+yaJ7k2EJFHlTP3jR634Z9Cj9itpqNjuLXvhlVxgnjsHsdRgASR8xYDrx6onw4vW5H6We0Jmg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.8.3.tgz", + "integrity": "sha512-pGnYfm7RNRgYRi7bids5bHluENHqJhrV4bCZRwc5GamaWIIs07N4rZECcmJL6ZClwjDz1GbdMZFtPs27hTB06w==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "lodash": "^4.17.13" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.8.3.tgz", + "integrity": "sha512-SjT0cwFJ+7Rbr1vQsvphAHwUHvSUPmMjMU/0P59G8U2HLFqSa082JO7zkbDNWs9kH/IUqpHI6xWNesGf8haF1w==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-define-map": "^7.8.3", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.8.3.tgz", + "integrity": "sha512-O5hiIpSyOGdrQZRQ2ccwtTVkgUDBBiCuK//4RJ6UfePllUTCENOzKxfh6ulckXKc0DixTFLCfb2HVkNA7aDpzA==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.8.3.tgz", + "integrity": "sha512-H4X646nCkiEcHZUZaRkhE2XVsoz0J/1x3VVujnn96pSoGCtKPA99ZZA+va+gK+92Zycd6OBKCD8tDb/731bhgQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.8.3.tgz", + "integrity": "sha512-kLs1j9Nn4MQoBYdRXH6AeaXMbEJFaFu/v1nQkvib6QzTj8MZI5OQzqmD83/2jEM1z0DLilra5aWO5YpyC0ALIw==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.8.3.tgz", + "integrity": "sha512-s8dHiBUbcbSgipS4SMFuWGqCvyge5V2ZeAWzR6INTVC3Ltjig/Vw1G2Gztv0vU/hRG9X8IvKvYdoksnUfgXOEQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.8.3.tgz", + "integrity": "sha512-zwIpuIymb3ACcInbksHaNcR12S++0MDLKkiqXHl3AzpgdKlFNhog+z/K0+TGW+b0w5pgTq4H6IwV/WhxbGYSjQ==", + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-flow-strip-types": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.7.4.tgz", + "integrity": "sha512-w9dRNlHY5ElNimyMYy0oQowvQpwt/PRHI0QS98ZJCTZU2bvSnKXo5zEiD5u76FBPigTm8TkqzmnUTg16T7qbkA==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-flow": "^7.7.4" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.8.3.tgz", + "integrity": "sha512-ZjXznLNTxhpf4Q5q3x1NsngzGA38t9naWH8Gt+0qYZEJAcvPI9waSStSh56u19Ofjr7QmD0wUsQ8hw8s/p1VnA==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.8.3.tgz", + "integrity": "sha512-rO/OnDS78Eifbjn5Py9v8y0aR+aSYhDhqAwVfsTl0ERuMZyr05L1aFSCJnbv2mmsLkit/4ReeQ9N2BgLnOcPCQ==", + "requires": { + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.8.3.tgz", + "integrity": "sha512-3Tqf8JJ/qB7TeldGl+TT55+uQei9JfYaregDcEAyBZ7akutriFrt6C/wLYIer6OYhleVQvH/ntEhjE/xMmy10A==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.8.3.tgz", + "integrity": "sha512-3Wk2EXhnw+rP+IDkK6BdtPKsUE5IeZ6QOGrPYvw52NwBStw9V1ZVzxgK6fSKSxqUvH9eQPR3tm3cOq79HlsKYA==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.8.3.tgz", + "integrity": "sha512-MadJiU3rLKclzT5kBH4yxdry96odTUwuqrZM+GllFI/VhxfPz+k9MshJM+MwhfkCdxxclSbSBbUGciBngR+kEQ==", + "requires": { + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "babel-plugin-dynamic-import-node": "^2.3.0" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.8.3.tgz", + "integrity": "sha512-JpdMEfA15HZ/1gNuB9XEDlZM1h/gF/YOH7zaZzQu2xCFRfwc01NXBMHHSTT6hRjlXJJs5x/bfODM3LiCk94Sxg==", + "requires": { + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-simple-access": "^7.8.3", + "babel-plugin-dynamic-import-node": "^2.3.0" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.8.3.tgz", + "integrity": "sha512-8cESMCJjmArMYqa9AO5YuMEkE4ds28tMpZcGZB/jl3n0ZzlsxOAi3mC+SKypTfT8gjMupCnd3YiXCkMjj2jfOg==", + "requires": { + "@babel/helper-hoist-variables": "^7.8.3", + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "babel-plugin-dynamic-import-node": "^2.3.0" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.8.3.tgz", + "integrity": "sha512-evhTyWhbwbI3/U6dZAnx/ePoV7H6OUG+OjiJFHmhr9FPn0VShjwC2kdxqIuQ/+1P50TMrneGzMeyMTFOjKSnAw==", + "requires": { + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.8.3.tgz", + "integrity": "sha512-f+tF/8UVPU86TrCb06JoPWIdDpTNSGGcAtaD9mLP0aYGA0OS0j7j7DHJR0GTFrUZPUU6loZhbsVZgTh0N+Qdnw==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.8.3" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.8.3.tgz", + "integrity": "sha512-QuSGysibQpyxexRyui2vca+Cmbljo8bcRckgzYV4kRIsHpVeyeC3JDO63pY+xFZ6bWOBn7pfKZTqV4o/ix9sFw==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.8.3.tgz", + "integrity": "sha512-57FXk+gItG/GejofIyLIgBKTas4+pEU47IXKDBWFTxdPd7F80H8zybyAY7UoblVfBhBGs2EKM+bJUu2+iUYPDQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.3" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.8.3.tgz", + "integrity": "sha512-/pqngtGb54JwMBZ6S/D3XYylQDFtGjWrnoCF4gXZOUpFV/ujbxnoNGNvDGu6doFWRPBveE72qTx/RRU44j5I/Q==", + "requires": { + "@babel/helper-call-delegate": "^7.8.3", + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.8.3.tgz", + "integrity": "sha512-uGiiXAZMqEoQhRWMK17VospMZh5sXWg+dlh2soffpkAl96KAm+WZuJfa6lcELotSRmooLqg0MWdH6UUq85nmmg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-react-constant-elements": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.8.3.tgz", + "integrity": "sha512-glrzN2U+egwRfkNFtL34xIBYTxbbUF2qJTP8HD3qETBBqzAWSeNB821X0GjU06+dNpq/UyCIjI72FmGE5NNkQQ==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-react-display-name": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.8.3.tgz", + "integrity": "sha512-3Jy/PCw8Fe6uBKtEgz3M82ljt+lTg+xJaM4og+eyu83qLT87ZUSckn0wy7r31jflURWLO83TW6Ylf7lyXj3m5A==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-react-jsx": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.8.3.tgz", + "integrity": "sha512-r0h+mUiyL595ikykci+fbwm9YzmuOrUBi0b+FDIKmi3fPQyFokWVEMJnRWHJPPQEjyFJyna9WZC6Viv6UHSv1g==", + "requires": { + "@babel/helper-builder-react-jsx": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" + } + }, + "@babel/plugin-transform-react-jsx-self": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.8.3.tgz", + "integrity": "sha512-01OT7s5oa0XTLf2I8XGsL8+KqV9lx3EZV+jxn/L2LQ97CGKila2YMroTkCEIE0HV/FF7CMSRsIAybopdN9NTdg==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" + } + }, + "@babel/plugin-transform-react-jsx-source": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.8.3.tgz", + "integrity": "sha512-PLMgdMGuVDtRS/SzjNEQYUT8f4z1xb2BAT54vM1X5efkVuYBf5WyGUMbpmARcfq3NaglIwz08UVQK4HHHbC6ag==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.8.3.tgz", + "integrity": "sha512-qt/kcur/FxrQrzFR432FGZznkVAjiyFtCOANjkAKwCbt465L6ZCiUQh2oMYGU3Wo8LRFJxNDFwWn106S5wVUNA==", + "requires": { + "regenerator-transform": "^0.14.0" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.8.3.tgz", + "integrity": "sha512-mwMxcycN3omKFDjDQUl+8zyMsBfjRFr0Zn/64I41pmjv4NJuqcYlEtezwYtw9TFd9WR1vN5kiM+O0gMZzO6L0A==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-runtime": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.7.4.tgz", + "integrity": "sha512-O8kSkS5fP74Ad/8pfsCMGa8sBRdLxYoSReaARRNSz3FbFQj3z/QUvoUmJ28gn9BO93YfnXc3j+Xyaqe8cKDNBQ==", + "requires": { + "@babel/helper-module-imports": "^7.7.4", + "@babel/helper-plugin-utils": "^7.0.0", + "resolve": "^1.8.1", + "semver": "^5.5.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.8.3.tgz", + "integrity": "sha512-I9DI6Odg0JJwxCHzbzW08ggMdCezoWcuQRz3ptdudgwaHxTjxw5HgdFJmZIkIMlRymL6YiZcped4TTCB0JcC8w==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.8.3.tgz", + "integrity": "sha512-CkuTU9mbmAoFOI1tklFWYYbzX5qCIZVXPVy0jpXgGwkplCndQAa58s2jr66fTeQnA64bDox0HL4U56CFYoyC7g==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.8.3.tgz", + "integrity": "sha512-9Spq0vGCD5Bb4Z/ZXXSK5wbbLFMG085qd2vhL1JYu1WcQ5bXqZBAYRzU1d+p79GcHs2szYv5pVQCX13QgldaWw==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-regex": "^7.8.3" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.8.3.tgz", + "integrity": "sha512-820QBtykIQOLFT8NZOcTRJ1UNuztIELe4p9DCgvj4NK+PwluSJ49we7s9FB1HIGNIYT7wFUJ0ar2QpCDj0escQ==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.8.3.tgz", + "integrity": "sha512-3TrkKd4LPqm4jHs6nPtSDI/SV9Cm5PRJkHLUgTcqRQQTMAZ44ZaAdDZJtvWFSaRcvT0a1rTmJ5ZA5tDKjleF3g==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-transform-typescript": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.8.3.tgz", + "integrity": "sha512-Ebj230AxcrKGZPKIp4g4TdQLrqX95TobLUWKd/CwG7X1XHUH1ZpkpFvXuXqWbtGRWb7uuEWNlrl681wsOArAdQ==", + "requires": { + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-typescript": "^7.8.3" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.8.3.tgz", + "integrity": "sha512-+ufgJjYdmWfSQ+6NS9VGUR2ns8cjJjYbrbi11mZBTaWm+Fui/ncTLFF28Ei1okavY+xkojGr1eJxNsWYeA5aZw==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/preset-env": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.8.3.tgz", + "integrity": "sha512-Rs4RPL2KjSLSE2mWAx5/iCH+GC1ikKdxPrhnRS6PfFVaiZeom22VFKN4X8ZthyN61kAaR05tfXTbCvatl9WIQg==", + "requires": { + "@babel/compat-data": "^7.8.0", + "@babel/helper-compilation-targets": "^7.8.3", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-proposal-async-generator-functions": "^7.8.3", + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-json-strings": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.8.3", + "@babel/plugin-proposal-optional-catch-binding": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.8.3", + "@babel/plugin-proposal-unicode-property-regex": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.0", + "@babel/plugin-syntax-json-strings": "^7.8.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.0", + "@babel/plugin-syntax-top-level-await": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3", + "@babel/plugin-transform-async-to-generator": "^7.8.3", + "@babel/plugin-transform-block-scoped-functions": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3", + "@babel/plugin-transform-classes": "^7.8.3", + "@babel/plugin-transform-computed-properties": "^7.8.3", + "@babel/plugin-transform-destructuring": "^7.8.3", + "@babel/plugin-transform-dotall-regex": "^7.8.3", + "@babel/plugin-transform-duplicate-keys": "^7.8.3", + "@babel/plugin-transform-exponentiation-operator": "^7.8.3", + "@babel/plugin-transform-for-of": "^7.8.3", + "@babel/plugin-transform-function-name": "^7.8.3", + "@babel/plugin-transform-literals": "^7.8.3", + "@babel/plugin-transform-member-expression-literals": "^7.8.3", + "@babel/plugin-transform-modules-amd": "^7.8.3", + "@babel/plugin-transform-modules-commonjs": "^7.8.3", + "@babel/plugin-transform-modules-systemjs": "^7.8.3", + "@babel/plugin-transform-modules-umd": "^7.8.3", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", + "@babel/plugin-transform-new-target": "^7.8.3", + "@babel/plugin-transform-object-super": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.8.3", + "@babel/plugin-transform-property-literals": "^7.8.3", + "@babel/plugin-transform-regenerator": "^7.8.3", + "@babel/plugin-transform-reserved-words": "^7.8.3", + "@babel/plugin-transform-shorthand-properties": "^7.8.3", + "@babel/plugin-transform-spread": "^7.8.3", + "@babel/plugin-transform-sticky-regex": "^7.8.3", + "@babel/plugin-transform-template-literals": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.3", + "@babel/plugin-transform-unicode-regex": "^7.8.3", + "@babel/types": "^7.8.3", + "browserslist": "^4.8.2", + "core-js-compat": "^3.6.2", + "invariant": "^2.2.2", + "levenary": "^1.1.0", + "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "@babel/preset-react": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.8.3.tgz", + "integrity": "sha512-9hx0CwZg92jGb7iHYQVgi0tOEHP/kM60CtWJQnmbATSPIQQ2xYzfoCI3EdqAhFBeeJwYMdWQuDUHMsuDbH9hyQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-transform-react-display-name": "^7.8.3", + "@babel/plugin-transform-react-jsx": "^7.8.3", + "@babel/plugin-transform-react-jsx-self": "^7.8.3", + "@babel/plugin-transform-react-jsx-source": "^7.8.3" + } + }, + "@babel/preset-typescript": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.7.4.tgz", + "integrity": "sha512-rqrjxfdiHPsnuPur0jKrIIGQCIgoTWMTjlbWE69G4QJ6TIOVnnRnIJhUxNTL/VwDmEAVX08Tq3B1nirer5341w==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-transform-typescript": "^7.7.4" + } + }, + "@babel/runtime": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.8.3.tgz", + "integrity": "sha512-fVHx1rzEmwB130VTkLnxR+HmxcTjGzH12LYQcFFoBwakMd3aOMD4OsRN7tGG/UOYE2ektgFrS8uACAoRk1CY0w==", + "requires": { + "regenerator-runtime": "^0.13.2" + } + }, + "@babel/runtime-corejs3": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.8.3.tgz", + "integrity": "sha512-lrIU4aVbmlM/wQPzhEvzvNJskKyYptuXb0fGC0lTQTupTOYtR2Vqbu6/jf8vTr4M8Wt1nIzxVrSvPI5qESa/xA==", + "requires": { + "core-js-pure": "^3.0.0", + "regenerator-runtime": "^0.13.2" + } + }, + "@babel/template": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.3.tgz", + "integrity": "sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ==", + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/traverse": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.3.tgz", + "integrity": "sha512-we+a2lti+eEImHmEXp7bM9cTxGzxPmBiVJlLVD+FuuQMeeO7RaDbutbgeheDkw+Xe3mCfJHnGOWLswT74m2IPg==", + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.3", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/types": "^7.8.3", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@babel/types": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.3.tgz", + "integrity": "sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg==", + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "@cnakazawa/watch": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz", + "integrity": "sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA==", + "requires": { + "exec-sh": "^0.3.2", + "minimist": "^1.2.0" + } + }, + "@csstools/convert-colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz", + "integrity": "sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==" + }, + "@csstools/normalize.css": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-9.0.1.tgz", + "integrity": "sha512-6It2EVfGskxZCQhuykrfnALg7oVeiI6KclWSmGDqB0AiInVrTGB9Jp9i4/Ad21u9Jde/voVQz6eFX/eSg/UsPA==" + }, + "@emotion/is-prop-valid": { + "version": "0.8.6", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.6.tgz", + "integrity": "sha512-mnZMho3Sq8BfzkYYRVc8ilQTnc8U02Ytp6J1AwM6taQStZ3AhsEJBX2LzhA/LJirNCwM2VtHL3VFIZ+sNJUgUQ==", + "requires": { + "@emotion/memoize": "0.7.4" + } + }, + "@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" + }, + "@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, + "@fortawesome/fontawesome-common-types": { + "version": "0.2.26", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.26.tgz", + "integrity": "sha512-CcM/fIFwZlRdiWG/25xE/wHbtyUuCtqoCTrr6BsWw7hH072fR++n4L56KPydAr3ANgMJMjT8v83ZFIsDc7kE+A==" + }, + "@fortawesome/fontawesome-svg-core": { + "version": "1.2.26", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.26.tgz", + "integrity": "sha512-3Dfd/v2IztP1TxKOxZiB5+4kaOZK9mNy0KU1vVK7nFlPWz3gzxrCWB+AloQhQUoJ8HhGqbzjliK89Vl7PExGbw==", + "requires": { + "@fortawesome/fontawesome-common-types": "^0.2.26" + } + }, + "@fortawesome/free-solid-svg-icons": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.12.0.tgz", + "integrity": "sha512-CnpsWs6GhTs9ekNB3d8rcO5HYqRkXbYKf2YNiAlTWbj5eVlPqsd/XH1F9If8jkcR1aegryAbln/qYeKVZzpM0g==", + "requires": { + "@fortawesome/fontawesome-common-types": "^0.2.26" + } + }, + "@fortawesome/react-fontawesome": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.8.tgz", + "integrity": "sha512-I5h9YQg/ePA3Br9ISS18fcwOYmzQYDSM1ftH03/8nHkiqIVHtUyQBw482+60dnzvlr82gHt3mGm+nDUp159FCw==", + "requires": { + "prop-types": "^15.5.10" + } + }, + "@hapi/address": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", + "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==" + }, + "@hapi/bourne": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz", + "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==" + }, + "@hapi/hoek": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.0.tgz", + "integrity": "sha512-7XYT10CZfPsH7j9F1Jmg1+d0ezOux2oM2GfArAzLwWe4mE2Dr3hVjsAL6+TFY49RRJlCdJDMw3nJsLFroTc8Kw==" + }, + "@hapi/joi": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz", + "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==", + "requires": { + "@hapi/address": "2.x.x", + "@hapi/bourne": "1.x.x", + "@hapi/hoek": "8.x.x", + "@hapi/topo": "3.x.x" + } + }, + "@hapi/topo": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz", + "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==", + "requires": { + "@hapi/hoek": "^8.3.0" + } + }, + "@jest/console": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", + "integrity": "sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ==", + "requires": { + "@jest/source-map": "^24.9.0", + "chalk": "^2.0.1", + "slash": "^2.0.0" + } + }, + "@jest/core": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.9.0.tgz", + "integrity": "sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A==", + "requires": { + "@jest/console": "^24.7.1", + "@jest/reporters": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "graceful-fs": "^4.1.15", + "jest-changed-files": "^24.9.0", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-resolve-dependencies": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "jest-watcher": "^24.9.0", + "micromatch": "^3.1.10", + "p-each-series": "^1.0.0", + "realpath-native": "^1.1.0", + "rimraf": "^2.5.4", + "slash": "^2.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==" + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "@jest/environment": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.9.0.tgz", + "integrity": "sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==", + "requires": { + "@jest/fake-timers": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0" + } + }, + "@jest/fake-timers": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.9.0.tgz", + "integrity": "sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A==", + "requires": { + "@jest/types": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0" + } + }, + "@jest/reporters": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.9.0.tgz", + "integrity": "sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw==", + "requires": { + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.2", + "istanbul-lib-coverage": "^2.0.2", + "istanbul-lib-instrument": "^3.0.1", + "istanbul-lib-report": "^2.0.4", + "istanbul-lib-source-maps": "^3.0.1", + "istanbul-reports": "^2.2.6", + "jest-haste-map": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.6.0", + "node-notifier": "^5.4.2", + "slash": "^2.0.0", + "source-map": "^0.6.0", + "string-length": "^2.0.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "@jest/source-map": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.9.0.tgz", + "integrity": "sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg==", + "requires": { + "callsites": "^3.0.0", + "graceful-fs": "^4.1.15", + "source-map": "^0.6.0" + }, + "dependencies": { + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "@jest/test-result": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz", + "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==", + "requires": { + "@jest/console": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/istanbul-lib-coverage": "^2.0.0" + } + }, + "@jest/test-sequencer": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz", + "integrity": "sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A==", + "requires": { + "@jest/test-result": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0" + } + }, + "@jest/transform": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.9.0.tgz", + "integrity": "sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==", + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^24.9.0", + "babel-plugin-istanbul": "^5.1.0", + "chalk": "^2.0.1", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.1.15", + "jest-haste-map": "^24.9.0", + "jest-regex-util": "^24.9.0", + "jest-util": "^24.9.0", + "micromatch": "^3.1.10", + "pirates": "^4.0.1", + "realpath-native": "^1.1.0", + "slash": "^2.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "2.4.1" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "@jest/types": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", + "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^13.0.0" + } + }, + "@mrmlnc/readdir-enhanced": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", + "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", + "requires": { + "call-me-maybe": "^1.0.1", + "glob-to-regexp": "^0.3.0" + } + }, + "@nodelib/fs.stat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", + "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" + }, + "@svgr/babel-plugin-add-jsx-attribute": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.2.0.tgz", + "integrity": "sha512-j7KnilGyZzYr/jhcrSYS3FGWMZVaqyCG0vzMCwzvei0coIkczuYMcniK07nI0aHJINciujjH11T72ICW5eL5Ig==" + }, + "@svgr/babel-plugin-remove-jsx-attribute": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-remove-jsx-attribute/-/babel-plugin-remove-jsx-attribute-4.2.0.tgz", + "integrity": "sha512-3XHLtJ+HbRCH4n28S7y/yZoEQnRpl0tvTZQsHqvaeNXPra+6vE5tbRliH3ox1yZYPCxrlqaJT/Mg+75GpDKlvQ==" + }, + "@svgr/babel-plugin-remove-jsx-empty-expression": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-remove-jsx-empty-expression/-/babel-plugin-remove-jsx-empty-expression-4.2.0.tgz", + "integrity": "sha512-yTr2iLdf6oEuUE9MsRdvt0NmdpMBAkgK8Bjhl6epb+eQWk6abBaX3d65UZ3E3FWaOwePyUgNyNCMVG61gGCQ7w==" + }, + "@svgr/babel-plugin-replace-jsx-attribute-value": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-replace-jsx-attribute-value/-/babel-plugin-replace-jsx-attribute-value-4.2.0.tgz", + "integrity": "sha512-U9m870Kqm0ko8beHawRXLGLvSi/ZMrl89gJ5BNcT452fAjtF2p4uRzXkdzvGJJJYBgx7BmqlDjBN/eCp5AAX2w==" + }, + "@svgr/babel-plugin-svg-dynamic-title": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-dynamic-title/-/babel-plugin-svg-dynamic-title-4.3.3.tgz", + "integrity": "sha512-w3Be6xUNdwgParsvxkkeZb545VhXEwjGMwExMVBIdPQJeyMQHqm9Msnb2a1teHBqUYL66qtwfhNkbj1iarCG7w==" + }, + "@svgr/babel-plugin-svg-em-dimensions": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-em-dimensions/-/babel-plugin-svg-em-dimensions-4.2.0.tgz", + "integrity": "sha512-C0Uy+BHolCHGOZ8Dnr1zXy/KgpBOkEUYY9kI/HseHVPeMbluaX3CijJr7D4C5uR8zrc1T64nnq/k63ydQuGt4w==" + }, + "@svgr/babel-plugin-transform-react-native-svg": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-react-native-svg/-/babel-plugin-transform-react-native-svg-4.2.0.tgz", + "integrity": "sha512-7YvynOpZDpCOUoIVlaaOUU87J4Z6RdD6spYN4eUb5tfPoKGSF9OG2NuhgYnq4jSkAxcpMaXWPf1cePkzmqTPNw==" + }, + "@svgr/babel-plugin-transform-svg-component": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-svg-component/-/babel-plugin-transform-svg-component-4.2.0.tgz", + "integrity": "sha512-hYfYuZhQPCBVotABsXKSCfel2slf/yvJY8heTVX1PCTaq/IgASq1IyxPPKJ0chWREEKewIU/JMSsIGBtK1KKxw==" + }, + "@svgr/babel-preset": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@svgr/babel-preset/-/babel-preset-4.3.3.tgz", + "integrity": "sha512-6PG80tdz4eAlYUN3g5GZiUjg2FMcp+Wn6rtnz5WJG9ITGEF1pmFdzq02597Hn0OmnQuCVaBYQE1OVFAnwOl+0A==", + "requires": { + "@svgr/babel-plugin-add-jsx-attribute": "^4.2.0", + "@svgr/babel-plugin-remove-jsx-attribute": "^4.2.0", + "@svgr/babel-plugin-remove-jsx-empty-expression": "^4.2.0", + "@svgr/babel-plugin-replace-jsx-attribute-value": "^4.2.0", + "@svgr/babel-plugin-svg-dynamic-title": "^4.3.3", + "@svgr/babel-plugin-svg-em-dimensions": "^4.2.0", + "@svgr/babel-plugin-transform-react-native-svg": "^4.2.0", + "@svgr/babel-plugin-transform-svg-component": "^4.2.0" + } + }, + "@svgr/core": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@svgr/core/-/core-4.3.3.tgz", + "integrity": "sha512-qNuGF1QON1626UCaZamWt5yedpgOytvLj5BQZe2j1k1B8DUG4OyugZyfEwBeXozCUwhLEpsrgPrE+eCu4fY17w==", + "requires": { + "@svgr/plugin-jsx": "^4.3.3", + "camelcase": "^5.3.1", + "cosmiconfig": "^5.2.1" + } + }, + "@svgr/hast-util-to-babel-ast": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-4.3.2.tgz", + "integrity": "sha512-JioXclZGhFIDL3ddn4Kiq8qEqYM2PyDKV0aYno8+IXTLuYt6TOgHUbUAAFvqtb0Xn37NwP0BTHglejFoYr8RZg==", + "requires": { + "@babel/types": "^7.4.4" + } + }, + "@svgr/plugin-jsx": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@svgr/plugin-jsx/-/plugin-jsx-4.3.3.tgz", + "integrity": "sha512-cLOCSpNWQnDB1/v+SUENHH7a0XY09bfuMKdq9+gYvtuwzC2rU4I0wKGFEp1i24holdQdwodCtDQdFtJiTCWc+w==", + "requires": { + "@babel/core": "^7.4.5", + "@svgr/babel-preset": "^4.3.3", + "@svgr/hast-util-to-babel-ast": "^4.3.2", + "svg-parser": "^2.0.0" + } + }, + "@svgr/plugin-svgo": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@svgr/plugin-svgo/-/plugin-svgo-4.3.1.tgz", + "integrity": "sha512-PrMtEDUWjX3Ea65JsVCwTIXuSqa3CG9px+DluF1/eo9mlDrgrtFE7NE/DjdhjJgSM9wenlVBzkzneSIUgfUI/w==", + "requires": { + "cosmiconfig": "^5.2.1", + "merge-deep": "^3.0.2", + "svgo": "^1.2.2" + } + }, + "@svgr/webpack": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@svgr/webpack/-/webpack-4.3.2.tgz", + "integrity": "sha512-F3VE5OvyOWBEd2bF7BdtFRyI6E9it3mN7teDw0JQTlVtc4HZEYiiLSl+Uf9Uub6IYHVGc+qIrxxDyeedkQru2w==", + "requires": { + "@babel/core": "^7.4.5", + "@babel/plugin-transform-react-constant-elements": "^7.0.0", + "@babel/preset-env": "^7.4.5", + "@babel/preset-react": "^7.0.0", + "@svgr/core": "^4.3.2", + "@svgr/plugin-jsx": "^4.3.2", + "@svgr/plugin-svgo": "^4.3.1", + "loader-utils": "^1.2.3" + } + }, + "@taquito/http-utils": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-5.1.0-beta.1.tgz", + "integrity": "sha512-/UvE61t9j5CR94vy8Dtb+/6oJERE0P9LmHBbkESKUxNC9SAlETCEntSNiHha+vuwgCoOj0pXsHkBtAZkWAaEeg==", + "requires": { + "xhr2-cookies": "^1.1.0" + } + }, + "@taquito/indexer": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/indexer/-/indexer-5.1.0-beta.1.tgz", + "integrity": "sha512-NDWK7XQGgUP0YkEWhJklF9uhKHZDWtRaAPSsSfxSDYiQzol4iAUn7ru7+TQPNqfsXq0NjpvzGHBysQ8HTeb0Gg==", + "requires": { + "@taquito/http-utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0" + } + }, + "@taquito/michelson-encoder": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-5.1.0-beta.1.tgz", + "integrity": "sha512-kBpHDfsvsxzsIXbM4dOZs0nklY7CjCunSJ2sABUdBu4SmXDM06F5NDzg0166q7VBhFZgOhq/NNM9g7hcgn5qJg==", + "requires": { + "@taquito/utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0" + } + }, + "@taquito/rpc": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-5.1.0-beta.1.tgz", + "integrity": "sha512-ZbqpJVZw1ljAS92Xs9t/1BAgPEMzOv3qk7ubWU7AGZOKDLREjOqI4EAZQfq4gL9hP2KIgqgLubTvPF3GsmTADg==", + "requires": { + "@taquito/http-utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0", + "lodash": "^4.17.15" + } + }, + "@taquito/signer": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-5.1.0-beta.1.tgz", + "integrity": "sha512-N7ZteHnXv2kS+CCxbmQ+Br21aIf8cwP/WGAjwOh0uMUcXg2qsmKE/0XnRYnLhftVaJolNo85oBckYnA6U48uCg==", + "requires": { + "@taquito/utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0", + "bip39": "^3.0.2", + "elliptic": "^6.5.1", + "libsodium-wrappers": "^0.7.5", + "pbkdf2": "^3.0.17", + "typedarray-to-buffer": "^3.1.5" + } + }, + "@taquito/taquito": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-5.1.0-beta.1.tgz", + "integrity": "sha512-hLV7vZiraMlx+Not3dRdELNSwxd0ZLndRGGDBh+uexpo1aH7xX5IQbIgQBREaR1F7fqHswxBBCKcBbrGhP5EWQ==", + "requires": { + "@taquito/indexer": "^5.1.0-beta.1", + "@taquito/michelson-encoder": "^5.1.0-beta.1", + "@taquito/rpc": "^5.1.0-beta.1", + "@taquito/signer": "^5.1.0-beta.1", + "@taquito/utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0", + "rxjs": "^6.5.3" + } + }, + "@taquito/tezbridge-signer": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/tezbridge-signer/-/tezbridge-signer-5.1.0-beta.1.tgz", + "integrity": "sha512-Q/bjRjMgYjIcrdW4h2JUAajYuck0wxxb27k7ElINVEtV3qdP3g+0Ubls1YXPMnb5MG4NlDJ4H3xGWiy1dnfrdQ==", + "requires": { + "@taquito/utils": "^5.1.0-beta.1", + "typedarray-to-buffer": "^3.1.5" + } + }, + "@taquito/utils": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-5.1.0-beta.1.tgz", + "integrity": "sha512-3Qk+RLYKNYUW3jj1HYH0KymQQjWXdMcsp08eG+Cc0LKDvwzC5ewd4tfeUwq/jfHsd1fQ9LsG5FJ3NZg93W0H6w==", + "requires": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^5.2.1" + } + }, + "@types/babel__core": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz", + "integrity": "sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA==", + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz", + "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==", + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz", + "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==", + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.8.tgz", + "integrity": "sha512-yGeB2dHEdvxjP0y4UbRtQaSkXJ9649fYCmIdRoul5kfAoGCwxuCbMhag0k3RPfnuh9kPGm8x89btcfDEXdVWGw==", + "requires": { + "@babel/types": "^7.3.0" + } + }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==" + }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "dev": true, + "requires": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", + "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==" + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", + "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", + "requires": { + "@types/istanbul-lib-coverage": "*", + "@types/istanbul-lib-report": "*" + } + }, + "@types/jest": { + "version": "24.0.18", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.18.tgz", + "integrity": "sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ==", + "requires": { + "@types/jest-diff": "*" + } + }, + "@types/jest-diff": { + "version": "24.3.0", + "resolved": "https://registry.npmjs.org/@types/jest-diff/-/jest-diff-24.3.0.tgz", + "integrity": "sha512-vx1CRDeDUwQ0Pc7v+hS61O1ETA81kD04IMEC0hS1kPyVtHDdZrokAvpF7MT9VI/fVSzicelUZNCepDvhRV1PeA==", + "requires": { + "jest-diff": "*" + } + }, + "@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==" + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/node": { + "version": "12.7.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.12.tgz", + "integrity": "sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ==" + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" + }, + "@types/prop-types": { + "version": "15.7.3", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz", + "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==" + }, + "@types/q": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz", + "integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==" + }, + "@types/react": { + "version": "16.9.5", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.5.tgz", + "integrity": "sha512-jQ12VMiFOWYlp+j66dghOWcmDDwhca0bnlcTxS4Qz/fh5gi6wpaZDthPEu/Gc/YlAuO87vbiUXL8qKstFvuOaA==", + "requires": { + "@types/prop-types": "*", + "csstype": "^2.2.0" + } + }, + "@types/react-dom": { + "version": "16.9.1", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.1.tgz", + "integrity": "sha512-1S/akvkKr63qIUWVu5IKYou2P9fHLb/P2VAwyxVV85JGaGZTcUniMiTuIqM3lXFB25ej6h+CYEQ27ERVwi6eGA==", + "requires": { + "@types/react": "*" + } + }, + "@types/react-native": { + "version": "0.61.2", + "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.61.2.tgz", + "integrity": "sha512-z15qGoBmZD6KIx3ZRYsqjelwBYXRMylPqz34swCH2exEk1EwOcPG2cp/TIpiN72lpByHlPvoMKbu8v1lzQrayw==", + "dev": true, + "requires": { + "@types/prop-types": "*", + "@types/react": "*" + } + }, + "@types/react-outside-click-handler": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@types/react-outside-click-handler/-/react-outside-click-handler-1.3.0.tgz", + "integrity": "sha512-BxQpd5GsbA9rjqLcM4lYp70VnvahgjMUeJ4OKi0A7QOsDLD2yUPswOVixtDpmvCu0PkRTfvMoStIR3gKC/L3XQ==", + "requires": { + "@types/react": "*" + } + }, + "@types/react-redux": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.6.tgz", + "integrity": "sha512-OjIrYtOg+j7MwNURIZ1BHoxWEzX3lDS/5169JqXUE+1XcOHGRVZirnnsexBDl5ykjxXlNHi4AS0aOismP3DaIA==", + "dev": true, + "requires": { + "@types/hoist-non-react-statics": "^3.3.0", + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0", + "redux": "^4.0.0" + } + }, + "@types/stack-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==" + }, + "@types/styled-components": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-4.4.2.tgz", + "integrity": "sha512-dngFx2PuGoy0MGE68eHayAmJvLSqWrnTe9w+DnQruu8PS+waWEsKmoBRhkzL2h2pK1OJhzJhVfuiz+oZa4etpA==", + "dev": true, + "requires": { + "@types/hoist-non-react-statics": "*", + "@types/react": "*", + "@types/react-native": "*", + "csstype": "^2.2.0" + } + }, + "@types/yargs": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.5.tgz", + "integrity": "sha512-CF/+sxTO7FOwbIRL4wMv0ZYLCRfMid2HQpzDRyViH7kSpfoAFiMdGqKIxb1PxWfjtQXQhnQuD33lvRHNwr809Q==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==" + }, + "@typescript-eslint/eslint-plugin": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.17.0.tgz", + "integrity": "sha512-tg/OMOtPeXlvk0ES8mZzEZ4gd1ruSE03nsKcK+teJhxYv5CPCXK6Mb/OK6NpB4+CqGTHs4MVeoSZXNFqpT1PyQ==", + "requires": { + "@typescript-eslint/experimental-utils": "2.17.0", + "eslint-utils": "^1.4.3", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.17.0.tgz", + "integrity": "sha512-2bNf+mZ/3mj5/3CP56v+ldRK3vFy9jOvmCPs/Gr2DeSJh+asPZrhFniv4QmQsHWQFPJFWhFHgkGgJeRmK4m8iQ==", + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.17.0", + "eslint-scope": "^5.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.17.0.tgz", + "integrity": "sha512-k1g3gRQ4fwfJoIfgUpz78AovicSWKFANmvTfkAHP24MgJHjWfZI6ya7tsQZt1sLczvP4G9BE5G5MgADHdmJB/w==", + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.17.0", + "@typescript-eslint/typescript-estree": "2.17.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.17.0.tgz", + "integrity": "sha512-g0eVRULGnEEUakxRfJO0s0Hr1LLQqsI6OrkiCLpdHtdJJek+wyd8mb00vedqAoWldeDcOcP8plqw8/jx9Gr3Lw==", + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@webassemblyjs/ast": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", + "integrity": "sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ==", + "requires": { + "@webassemblyjs/helper-module-context": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/wast-parser": "1.8.5" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz", + "integrity": "sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ==" + }, + "@webassemblyjs/helper-api-error": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz", + "integrity": "sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA==" + }, + "@webassemblyjs/helper-buffer": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz", + "integrity": "sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q==" + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz", + "integrity": "sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ==", + "requires": { + "@webassemblyjs/wast-printer": "1.8.5" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz", + "integrity": "sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow==" + }, + "@webassemblyjs/helper-module-context": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz", + "integrity": "sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "mamacro": "^0.0.3" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz", + "integrity": "sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ==" + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz", + "integrity": "sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz", + "integrity": "sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g==", + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.8.5.tgz", + "integrity": "sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A==", + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.8.5.tgz", + "integrity": "sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw==" + }, + "@webassemblyjs/wasm-edit": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz", + "integrity": "sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/helper-wasm-section": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5", + "@webassemblyjs/wasm-opt": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5", + "@webassemblyjs/wast-printer": "1.8.5" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz", + "integrity": "sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/ieee754": "1.8.5", + "@webassemblyjs/leb128": "1.8.5", + "@webassemblyjs/utf8": "1.8.5" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz", + "integrity": "sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz", + "integrity": "sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-api-error": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/ieee754": "1.8.5", + "@webassemblyjs/leb128": "1.8.5", + "@webassemblyjs/utf8": "1.8.5" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz", + "integrity": "sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/floating-point-hex-parser": "1.8.5", + "@webassemblyjs/helper-api-error": "1.8.5", + "@webassemblyjs/helper-code-frame": "1.8.5", + "@webassemblyjs/helper-fsm": "1.8.5", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz", + "integrity": "sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/wast-parser": "1.8.5", + "@xtuc/long": "4.2.2" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==" + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" + }, + "abab": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==" + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "acorn": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" + }, + "acorn-globals": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "requires": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + }, + "dependencies": { + "acorn": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", + "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==" + } + } + }, + "acorn-jsx": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==" + }, + "acorn-walk": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==" + }, + "address": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/address/-/address-1.1.2.tgz", + "integrity": "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==" + }, + "adjust-sourcemap-loader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-2.0.0.tgz", + "integrity": "sha512-4hFsTsn58+YjrU9qKzML2JSSDqKvN8mUGQ0nNIrfPi8hmIONT4L3uUaT6MKdMsZ9AjsU6D2xDkZxCkbQPxChrA==", + "requires": { + "assert": "1.4.1", + "camelcase": "5.0.0", + "loader-utils": "1.2.3", + "object-path": "0.11.4", + "regex-parser": "2.2.10" + }, + "dependencies": { + "camelcase": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", + "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==" + } + } + }, + "airbnb-prop-types": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.15.0.tgz", + "integrity": "sha512-jUh2/hfKsRjNFC4XONQrxo/n/3GG4Tn6Hl0WlFQN5PY9OMC9loSCoAYKnZsWaP8wEfd5xcrPloK0Zg6iS1xwVA==", + "requires": { + "array.prototype.find": "^2.1.0", + "function.prototype.name": "^1.1.1", + "has": "^1.0.3", + "is-regex": "^1.0.4", + "object-is": "^1.0.1", + "object.assign": "^4.1.0", + "object.entries": "^1.1.0", + "prop-types": "^15.7.2", + "prop-types-exact": "^1.2.0", + "react-is": "^16.9.0" + } + }, + "ajv": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", + "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", + "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==" + }, + "ajv-keywords": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz", + "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==" + }, + "alphanum-sort": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=" + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-colors": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==" + }, + "ansi-escapes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz", + "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==", + "requires": { + "type-fest": "^0.8.1" + } + }, + "ansi-html": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", + "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=" + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "aria-query": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz", + "integrity": "sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=", + "requires": { + "ast-types-flow": "0.0.7", + "commander": "^2.11.0" + } + }, + "arity-n": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arity-n/-/arity-n-1.0.4.tgz", + "integrity": "sha1-2edrEXM+CFacCEeuezmyhgswt0U=" + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-flatten": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", + "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==" + }, + "array-includes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", + "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0", + "is-string": "^1.0.5" + } + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, + "array.prototype.find": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.1.0.tgz", + "integrity": "sha512-Wn41+K1yuO5p7wRZDl7890c3xvv5UBrfVXTVIe28rSQb6LS0fZMDrQB6PAcxQFRFy6vJTLDc3A2+3CjQdzVKRg==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.13.0" + } + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "requires": { + "util": "0.10.3" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, + "ast-types-flow": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", + "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=" + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==" + }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "requires": { + "lodash": "^4.17.14" + } + }, + "async-each": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", + "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==" + }, + "async-foreach": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", + "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", + "dev": true + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + }, + "autoprefixer": { + "version": "9.7.4", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.4.tgz", + "integrity": "sha512-g0Ya30YrMBAEZk60lp+qfX5YQllG+S5W3GYCFvyHTvhOki0AEQJLPEcIuGRsqVwLi8FvXPVtwTGhfr38hVpm0g==", + "requires": { + "browserslist": "^4.8.3", + "caniuse-lite": "^1.0.30001020", + "chalk": "^2.4.2", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "postcss": "^7.0.26", + "postcss-value-parser": "^4.0.2" + }, + "dependencies": { + "postcss-value-parser": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz", + "integrity": "sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ==" + } + } + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" + }, + "axios": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.1.tgz", + "integrity": "sha512-Yl+7nfreYKaLRvAvjNPkvfjnQHJM1yLBY3zhqAwcJSwR/6ETkanUgylgtIvkvz0xJ+p/vZuNw8X7Hnb7Whsbpw==", + "requires": { + "follow-redirects": "1.5.10" + } + }, + "axobject-query": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.1.tgz", + "integrity": "sha512-lF98xa/yvy6j3fBHAgQXIYl+J4eZadOSqsPojemUqClzNbBV38wWGpUbQbVEyf4eUF5yF7eHmGgGA2JiHyjeqw==", + "requires": { + "@babel/runtime": "^7.7.4", + "@babel/runtime-corejs3": "^7.7.4" + } + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + } + } + }, + "babel-eslint": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.3.tgz", + "integrity": "sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@babel/types": "^7.0.0", + "eslint-visitor-keys": "^1.0.0", + "resolve": "^1.12.0" + } + }, + "babel-extract-comments": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz", + "integrity": "sha512-qWWzi4TlddohA91bFwgt6zO/J0X+io7Qp184Fw0m2JYRSTZnJbFR8+07KmzudHCZgOiKRCrjhylwv9Xd8gfhVQ==", + "requires": { + "babylon": "^6.18.0" + } + }, + "babel-jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz", + "integrity": "sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw==", + "requires": { + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/babel__core": "^7.1.0", + "babel-plugin-istanbul": "^5.1.0", + "babel-preset-jest": "^24.9.0", + "chalk": "^2.4.2", + "slash": "^2.0.0" + } + }, + "babel-loader": { + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.6.tgz", + "integrity": "sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw==", + "requires": { + "find-cache-dir": "^2.0.0", + "loader-utils": "^1.0.2", + "mkdirp": "^0.5.1", + "pify": "^4.0.1" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz", + "integrity": "sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ==", + "requires": { + "object.assign": "^4.1.0" + } + }, + "babel-plugin-istanbul": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz", + "integrity": "sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "find-up": "^3.0.0", + "istanbul-lib-instrument": "^3.3.0", + "test-exclude": "^5.2.3" + } + }, + "babel-plugin-jest-hoist": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz", + "integrity": "sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==", + "requires": { + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-plugin-macros": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.7.1.tgz", + "integrity": "sha512-HNM284amlKSQ6FddI4jLXD+XTqF0cTYOe5uemOIZxHJHnamC+OhFQ57rMF9sgnYhkJQptVl9U1SKVZsV9/GLQQ==", + "requires": { + "@babel/runtime": "^7.7.2", + "cosmiconfig": "^6.0.0", + "resolve": "^1.12.0" + }, + "dependencies": { + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "parse-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", + "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + } + } + }, + "babel-plugin-named-asset-import": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.5.tgz", + "integrity": "sha512-sGhfINU+AuMw9oFAdIn/nD5sem3pn/WgxAfDZ//Q3CnF+5uaho7C7shh2rKLk6sKE/XkfmyibghocwKdVjLIKg==" + }, + "babel-plugin-styled-components": { + "version": "1.10.6", + "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.6.tgz", + "integrity": "sha512-gyQj/Zf1kQti66100PhrCRjI5ldjaze9O0M3emXRPAN80Zsf8+e1thpTpaXJXVHXtaM4/+dJEgZHyS9Its+8SA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-module-imports": "^7.0.0", + "babel-plugin-syntax-jsx": "^6.18.0", + "lodash": "^4.17.11" + } + }, + "babel-plugin-syntax-jsx": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=" + }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=" + }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", + "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", + "requires": { + "babel-plugin-syntax-object-rest-spread": "^6.8.0", + "babel-runtime": "^6.26.0" + } + }, + "babel-plugin-transform-react-remove-prop-types": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", + "integrity": "sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA==" + }, + "babel-preset-jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz", + "integrity": "sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg==", + "requires": { + "@babel/plugin-syntax-object-rest-spread": "^7.0.0", + "babel-plugin-jest-hoist": "^24.9.0" + } + }, + "babel-preset-react-app": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-react-app/-/babel-preset-react-app-9.1.0.tgz", + "integrity": "sha512-0qMOv/pCcCQWxX1eNyKD9GlzZTdzZIK/Pq3O6TGe65tZSJTSplw1pFlaPujm0GjBj4g3GeCQbP08vvzlH7OGHg==", + "requires": { + "@babel/core": "7.7.4", + "@babel/plugin-proposal-class-properties": "7.7.4", + "@babel/plugin-proposal-decorators": "7.7.4", + "@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4", + "@babel/plugin-proposal-numeric-separator": "7.7.4", + "@babel/plugin-proposal-object-rest-spread": "7.7.4", + "@babel/plugin-proposal-optional-chaining": "7.7.4", + "@babel/plugin-syntax-dynamic-import": "7.7.4", + "@babel/plugin-transform-destructuring": "7.7.4", + "@babel/plugin-transform-flow-strip-types": "7.7.4", + "@babel/plugin-transform-react-display-name": "7.7.4", + "@babel/plugin-transform-runtime": "7.7.4", + "@babel/preset-env": "7.7.4", + "@babel/preset-react": "7.7.4", + "@babel/preset-typescript": "7.7.4", + "@babel/runtime": "7.7.4", + "babel-plugin-dynamic-import-node": "2.3.0", + "babel-plugin-macros": "2.7.1", + "babel-plugin-transform-react-remove-prop-types": "0.4.24" + }, + "dependencies": { + "@babel/core": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.4.tgz", + "integrity": "sha512-+bYbx56j4nYBmpsWtnPUsKW3NdnYxbqyfrP2w9wILBuHzdfIKz9prieZK0DFPyIzkjYVUe4QkusGL07r5pXznQ==", + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.7.4", + "@babel/helpers": "^7.7.4", + "@babel/parser": "^7.7.4", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@babel/types": "^7.7.4", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "json5": "^2.1.0", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.7.4.tgz", + "integrity": "sha512-TbYHmr1Gl1UC7Vo2HVuj/Naci5BEGNZ0AJhzqD2Vpr6QPFWpUmBRLrIDjedzx7/CShq0bRDS2gI4FIs77VHLVQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.7.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz", + "integrity": "sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-object-rest-spread": "^7.7.4" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.7.4.tgz", + "integrity": "sha512-JmgaS+ygAWDR/STPe3/7y0lNlHgS+19qZ9aC06nYLwQ/XB7c0q5Xs+ksFU3EDnp9EiEsO0dnRAOKeyLHTZuW3A==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-optional-chaining": "^7.7.4" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.7.4.tgz", + "integrity": "sha512-jHQW0vbRGvwQNgyVxwDh4yuXu4bH1f5/EICJLAhl1SblLs2CDhrsmCk+v5XLdE9wxtAFRyxx+P//Iw+a5L/tTg==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.7.4.tgz", + "integrity": "sha512-4jFMXI1Cu2aXbcXXl8Lr6YubCn6Oc7k9lLsu8v61TZh+1jny2BWmdtvY9zSUlLdGUvcy9DMAWyZEOqjsbeg/wA==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/plugin-transform-react-display-name": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.7.4.tgz", + "integrity": "sha512-sBbIvqYkthai0X0vkD2xsAwluBp+LtNHH+/V4a5ydifmTtb8KOVOlrMIk/MYmIc4uTYDnjZUHQildYNo36SRJw==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/preset-env": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.7.4.tgz", + "integrity": "sha512-Dg+ciGJjwvC1NIe/DGblMbcGq1HOtKbw8RLl4nIjlfcILKEOkWT/vRqPpumswABEBVudii6dnVwrBtzD7ibm4g==", + "requires": { + "@babel/helper-module-imports": "^7.7.4", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-async-generator-functions": "^7.7.4", + "@babel/plugin-proposal-dynamic-import": "^7.7.4", + "@babel/plugin-proposal-json-strings": "^7.7.4", + "@babel/plugin-proposal-object-rest-spread": "^7.7.4", + "@babel/plugin-proposal-optional-catch-binding": "^7.7.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.7.4", + "@babel/plugin-syntax-async-generators": "^7.7.4", + "@babel/plugin-syntax-dynamic-import": "^7.7.4", + "@babel/plugin-syntax-json-strings": "^7.7.4", + "@babel/plugin-syntax-object-rest-spread": "^7.7.4", + "@babel/plugin-syntax-optional-catch-binding": "^7.7.4", + "@babel/plugin-syntax-top-level-await": "^7.7.4", + "@babel/plugin-transform-arrow-functions": "^7.7.4", + "@babel/plugin-transform-async-to-generator": "^7.7.4", + "@babel/plugin-transform-block-scoped-functions": "^7.7.4", + "@babel/plugin-transform-block-scoping": "^7.7.4", + "@babel/plugin-transform-classes": "^7.7.4", + "@babel/plugin-transform-computed-properties": "^7.7.4", + "@babel/plugin-transform-destructuring": "^7.7.4", + "@babel/plugin-transform-dotall-regex": "^7.7.4", + "@babel/plugin-transform-duplicate-keys": "^7.7.4", + "@babel/plugin-transform-exponentiation-operator": "^7.7.4", + "@babel/plugin-transform-for-of": "^7.7.4", + "@babel/plugin-transform-function-name": "^7.7.4", + "@babel/plugin-transform-literals": "^7.7.4", + "@babel/plugin-transform-member-expression-literals": "^7.7.4", + "@babel/plugin-transform-modules-amd": "^7.7.4", + "@babel/plugin-transform-modules-commonjs": "^7.7.4", + "@babel/plugin-transform-modules-systemjs": "^7.7.4", + "@babel/plugin-transform-modules-umd": "^7.7.4", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.4", + "@babel/plugin-transform-new-target": "^7.7.4", + "@babel/plugin-transform-object-super": "^7.7.4", + "@babel/plugin-transform-parameters": "^7.7.4", + "@babel/plugin-transform-property-literals": "^7.7.4", + "@babel/plugin-transform-regenerator": "^7.7.4", + "@babel/plugin-transform-reserved-words": "^7.7.4", + "@babel/plugin-transform-shorthand-properties": "^7.7.4", + "@babel/plugin-transform-spread": "^7.7.4", + "@babel/plugin-transform-sticky-regex": "^7.7.4", + "@babel/plugin-transform-template-literals": "^7.7.4", + "@babel/plugin-transform-typeof-symbol": "^7.7.4", + "@babel/plugin-transform-unicode-regex": "^7.7.4", + "@babel/types": "^7.7.4", + "browserslist": "^4.6.0", + "core-js-compat": "^3.1.1", + "invariant": "^2.2.2", + "js-levenshtein": "^1.1.3", + "semver": "^5.5.0" + } + }, + "@babel/preset-react": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.7.4.tgz", + "integrity": "sha512-j+vZtg0/8pQr1H8wKoaJyGL2IEk3rG/GIvua7Sec7meXVIvGycihlGMx5xcU00kqCJbwzHs18xTu3YfREOqQ+g==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-transform-react-display-name": "^7.7.4", + "@babel/plugin-transform-react-jsx": "^7.7.4", + "@babel/plugin-transform-react-jsx-self": "^7.7.4", + "@babel/plugin-transform-react-jsx-source": "^7.7.4" + } + }, + "@babel/runtime": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.7.4.tgz", + "integrity": "sha512-r24eVUUr0QqNZa+qrImUk8fn5SPhHq+IfYvIoIMg0do3GdK9sMdiLKP3GYVVaxpPKORgm8KRKaNTEhAjgIpLMw==", + "requires": { + "regenerator-runtime": "^0.13.2" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "core-js": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", + "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + } + } + }, + "base-x": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.7.tgz", + "integrity": "sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + }, + "batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" + }, + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==" + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "bip39": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz", + "integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==", + "requires": { + "@types/node": "11.11.6", + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1" + }, + "dependencies": { + "@types/node": { + "version": "11.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", + "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" + } + } + }, + "blakejs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", + "integrity": "sha1-ad+S75U6qIylGjLfarHFShVfx6U=" + }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "dev": true, + "requires": { + "inherits": "~2.0.0" + } + }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, + "body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "requires": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + }, + "dependencies": { + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + } + } + }, + "bonjour": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz", + "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", + "requires": { + "array-flatten": "^2.1.0", + "deep-equal": "^1.0.1", + "dns-equal": "^1.0.0", + "dns-txt": "^2.0.2", + "multicast-dns": "^6.0.1", + "multicast-dns-service-types": "^1.1.0" + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browser-process-hrtime": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", + "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==" + }, + "browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" + } + } + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "4.8.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.8.5.tgz", + "integrity": "sha512-4LMHuicxkabIB+n9874jZX/az1IaZ5a+EUuvD7KFOu9x/Bd5YHyO0DIz2ls/Kl8g0ItS4X/ilEgf4T1Br0lgSg==", + "requires": { + "caniuse-lite": "^1.0.30001022", + "electron-to-chromium": "^1.3.338", + "node-releases": "^1.1.46" + } + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz", + "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "buffer-indexof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", + "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==" + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "cacache": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz", + "integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==", + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "call-me-maybe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", + "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=" + }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "requires": { + "callsites": "^2.0.0" + } + }, + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=" + }, + "camel-case": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", + "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", + "requires": { + "no-case": "^2.2.0", + "upper-case": "^1.1.1" + } + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + } + } + }, + "camelize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", + "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" + }, + "caniuse-api": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "requires": { + "browserslist": "^4.0.0", + "caniuse-lite": "^1.0.0", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, + "caniuse-lite": { + "version": "1.0.30001022", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001022.tgz", + "integrity": "sha512-FjwPPtt/I07KyLPkBQ0g7/XuZg6oUkYBVnPHNj3VHJbOjmmJ/GdSo/GUY6MwINEQvjhP6WZVbX8Tvms8xh0D5A==" + }, + "capture-exit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", + "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==", + "requires": { + "rsvp": "^4.8.4" + } + }, + "case-sensitive-paths-webpack-plugin": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.2.0.tgz", + "integrity": "sha512-u5ElzokS8A1pm9vM3/iDgTcI3xqHxuCao94Oz8etI3cf0Tio0p8izkDYbTIn09uP3yUUr6+veaE6IkjnTYS46g==" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + } + }, + "fsevents": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz", + "integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==", + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1", + "node-pre-gyp": "*" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "optional": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "optional": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.3", + "bundled": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "optional": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "debug": { + "version": "3.2.6", + "bundled": true, + "optional": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.7", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.6", + "bundled": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.3", + "bundled": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "bundled": true, + "optional": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "optional": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "optional": true + }, + "minipass": { + "version": "2.9.0", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "optional": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.1.2", + "bundled": true, + "optional": true + }, + "needle": { + "version": "2.4.0", + "bundled": true, + "optional": true, + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.14.0", + "bundled": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4.4.2" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.1.1", + "bundled": true, + "optional": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "npm-packlist": { + "version": "1.4.7", + "bundled": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "optional": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "optional": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "bundled": true, + "optional": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "optional": true + }, + "semver": { + "version": "5.7.1", + "bundled": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "tar": { + "version": "4.4.13", + "bundled": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "yallist": { + "version": "3.1.1", + "bundled": true, + "optional": true + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "chownr": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==" + }, + "chrome-trace-event": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", + "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "clean-css": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.1.tgz", + "integrity": "sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g==", + "requires": { + "source-map": "~0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=" + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "clone-deep": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-0.2.4.tgz", + "integrity": "sha1-TnPdCen7lxzDhnDF3O2cGJZIHMY=", + "requires": { + "for-own": "^0.1.3", + "is-plain-object": "^2.0.1", + "kind-of": "^3.0.2", + "lazy-cache": "^1.0.3", + "shallow-clone": "^0.1.2" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "coa": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.2.tgz", + "integrity": "sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA==", + "requires": { + "@types/q": "^1.5.1", + "chalk": "^2.4.1", + "q": "^1.1.2" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/color/-/color-3.1.2.tgz", + "integrity": "sha512-vXTJhHebByxZn3lDvDJYw4lR5+uB3vuoHsuYA5AKuxRVn5wzzIfQKGLBmgdVRHKTJYeK5rvJcHnrd0Li49CFpg==", + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "common-tags": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", + "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==" + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + }, + "compose-function": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/compose-function/-/compose-function-3.0.3.tgz", + "integrity": "sha1-ntZ18TzFRQHTCVCkhv9qe6OrGF8=", + "requires": { + "arity-n": "^1.0.4" + } + }, + "compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "requires": { + "mime-db": ">= 1.43.0 < 2" + } + }, + "compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "requires": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "confusing-browser-globals": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", + "integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==" + }, + "connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==" + }, + "console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "consolidated-events": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/consolidated-events/-/consolidated-events-2.0.2.tgz", + "integrity": "sha512-2/uRVMdRypf5z/TW/ncD/66l75P5hH2vM/GR8Jf8HLc2xnfJtmina6F6du8+v4Z2vTrMo7jC+W1tmEEuuELgkQ==" + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=" + }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=" + }, + "content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "requires": { + "safe-buffer": "5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "requires": { + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "cookie": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + }, + "core-js": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz", + "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==" + }, + "core-js-compat": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.6.4.tgz", + "integrity": "sha512-zAa3IZPvsJ0slViBQ2z+vgyyTuhd3MFn1rBQjZSKVEgB0UMYhUkCj9jJUVPgGTGqWvsBVmfnruXgTcNyTlEiSA==", + "requires": { + "browserslist": "^4.8.3", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==" + } + } + }, + "core-js-pure": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.4.tgz", + "integrity": "sha512-epIhRLkXdgv32xIUFaaAry2wdxZYBi6bgM7cB136dzzXXa+dFyRLTZeLUJxnd8ShrmyVXBub63n2NHo2JAt8Cw==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cosmiconfig": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", + "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", + "requires": { + "import-fresh": "^2.0.0", + "is-directory": "^0.3.1", + "js-yaml": "^3.13.1", + "parse-json": "^4.0.0" + } + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "css": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", + "integrity": "sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw==", + "requires": { + "inherits": "^2.0.3", + "source-map": "^0.6.1", + "source-map-resolve": "^0.5.2", + "urix": "^0.1.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "css-blank-pseudo": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-0.1.4.tgz", + "integrity": "sha512-LHz35Hr83dnFeipc7oqFDmsjHdljj3TQtxGGiNWSOsTLIAubSm4TEz8qCaKFpk7idaQ1GfWscF4E6mgpBysA1w==", + "requires": { + "postcss": "^7.0.5" + } + }, + "css-color-keywords": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", + "integrity": "sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=" + }, + "css-color-names": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", + "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=" + }, + "css-declaration-sorter": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-4.0.1.tgz", + "integrity": "sha512-BcxQSKTSEEQUftYpBVnsH4SF05NTuBokb19/sBt6asXGKZ/6VP7PLG1CBCkFDYOnhXhPh0jMhO6xZ71oYHXHBA==", + "requires": { + "postcss": "^7.0.1", + "timsort": "^0.3.0" + } + }, + "css-has-pseudo": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/css-has-pseudo/-/css-has-pseudo-0.10.0.tgz", + "integrity": "sha512-Z8hnfsZu4o/kt+AuFzeGpLVhFOGO9mluyHBaA2bA8aCGTwah5sT3WV/fTHH8UNZUytOIImuGPrl/prlb4oX4qQ==", + "requires": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^5.0.0-rc.4" + }, + "dependencies": { + "cssesc": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz", + "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==" + }, + "postcss-selector-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz", + "integrity": "sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ==", + "requires": { + "cssesc": "^2.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "css-loader": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-2.1.1.tgz", + "integrity": "sha512-OcKJU/lt232vl1P9EEDamhoO9iKY3tIjY5GU+XDLblAykTdgs6Ux9P1hTHve8nFKy5KPpOXOsVI/hIwi3841+w==", + "requires": { + "camelcase": "^5.2.0", + "icss-utils": "^4.1.0", + "loader-utils": "^1.2.3", + "normalize-path": "^3.0.0", + "postcss": "^7.0.14", + "postcss-modules-extract-imports": "^2.0.0", + "postcss-modules-local-by-default": "^2.0.6", + "postcss-modules-scope": "^2.1.0", + "postcss-modules-values": "^2.0.0", + "postcss-value-parser": "^3.3.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + } + } + }, + "css-prefers-color-scheme": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/css-prefers-color-scheme/-/css-prefers-color-scheme-3.1.1.tgz", + "integrity": "sha512-MTu6+tMs9S3EUqzmqLXEcgNRbNkkD/TGFvowpeoWJn5Vfq7FMgsmRQs9X5NXAURiOBmOxm/lLjsDNXDE6k9bhg==", + "requires": { + "postcss": "^7.0.5" + } + }, + "css-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz", + "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==", + "requires": { + "boolbase": "^1.0.0", + "css-what": "^3.2.1", + "domutils": "^1.7.0", + "nth-check": "^1.0.2" + } + }, + "css-select-base-adapter": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz", + "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==" + }, + "css-to-react-native": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-2.3.2.tgz", + "integrity": "sha512-VOFaeZA053BqvvvqIA8c9n0+9vFppVBAHCp6JgFTtTMU3Mzi+XnelJ9XC9ul3BqFzZyQ5N+H0SnwsWT2Ebchxw==", + "requires": { + "camelize": "^1.0.0", + "css-color-keywords": "^1.0.0", + "postcss-value-parser": "^3.3.0" + } + }, + "css-tree": { + "version": "1.0.0-alpha.37", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz", + "integrity": "sha512-DMxWJg0rnz7UgxKT0Q1HU/L9BeJI0M6ksor0OgqOnF+aRCDWg/N2641HmVyU9KVIu0OVVWOb2IpC9A+BJRnejg==", + "requires": { + "mdn-data": "2.0.4", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "css-unit-converter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.1.tgz", + "integrity": "sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY=" + }, + "css-what": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.2.1.tgz", + "integrity": "sha512-WwOrosiQTvyms+Ti5ZC5vGEK0Vod3FTt1ca+payZqvKuGJF+dq7bG63DstxtN0dpm6FxY27a/zS3Wten+gEtGw==" + }, + "cssdb": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-4.4.0.tgz", + "integrity": "sha512-LsTAR1JPEM9TpGhl/0p3nQecC2LJ0kD8X5YARu1hk/9I1gril5vDtMZyNxcEpxxDj34YNck/ucjuoUd66K03oQ==" + }, + "cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==" + }, + "cssnano": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz", + "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==", + "requires": { + "cosmiconfig": "^5.0.0", + "cssnano-preset-default": "^4.0.7", + "is-resolvable": "^1.0.0", + "postcss": "^7.0.0" + } + }, + "cssnano-preset-default": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-4.0.7.tgz", + "integrity": "sha512-x0YHHx2h6p0fCl1zY9L9roD7rnlltugGu7zXSKQx6k2rYw0Hi3IqxcoAGF7u9Q5w1nt7vK0ulxV8Lo+EvllGsA==", + "requires": { + "css-declaration-sorter": "^4.0.1", + "cssnano-util-raw-cache": "^4.0.1", + "postcss": "^7.0.0", + "postcss-calc": "^7.0.1", + "postcss-colormin": "^4.0.3", + "postcss-convert-values": "^4.0.1", + "postcss-discard-comments": "^4.0.2", + "postcss-discard-duplicates": "^4.0.2", + "postcss-discard-empty": "^4.0.1", + "postcss-discard-overridden": "^4.0.1", + "postcss-merge-longhand": "^4.0.11", + "postcss-merge-rules": "^4.0.3", + "postcss-minify-font-values": "^4.0.2", + "postcss-minify-gradients": "^4.0.2", + "postcss-minify-params": "^4.0.2", + "postcss-minify-selectors": "^4.0.2", + "postcss-normalize-charset": "^4.0.1", + "postcss-normalize-display-values": "^4.0.2", + "postcss-normalize-positions": "^4.0.2", + "postcss-normalize-repeat-style": "^4.0.2", + "postcss-normalize-string": "^4.0.2", + "postcss-normalize-timing-functions": "^4.0.2", + "postcss-normalize-unicode": "^4.0.1", + "postcss-normalize-url": "^4.0.1", + "postcss-normalize-whitespace": "^4.0.2", + "postcss-ordered-values": "^4.1.2", + "postcss-reduce-initial": "^4.0.3", + "postcss-reduce-transforms": "^4.0.2", + "postcss-svgo": "^4.0.2", + "postcss-unique-selectors": "^4.0.1" + } + }, + "cssnano-util-get-arguments": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz", + "integrity": "sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8=" + }, + "cssnano-util-get-match": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz", + "integrity": "sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0=" + }, + "cssnano-util-raw-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.1.tgz", + "integrity": "sha512-qLuYtWK2b2Dy55I8ZX3ky1Z16WYsx544Q0UWViebptpwn/xDBmog2TLg4f+DBMg1rJ6JDWtn96WHbOKDWt1WQA==", + "requires": { + "postcss": "^7.0.0" + } + }, + "cssnano-util-same-parent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz", + "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==" + }, + "csso": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/csso/-/csso-4.0.2.tgz", + "integrity": "sha512-kS7/oeNVXkHWxby5tHVxlhjizRCSv8QdU7hB2FpdAibDU8FjTAolhNjKNTiLzXtUrKT6HwClE81yXwEk1309wg==", + "requires": { + "css-tree": "1.0.0-alpha.37" + } + }, + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + }, + "cssstyle": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", + "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", + "requires": { + "cssom": "0.3.x" + } + }, + "csstype": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.8.tgz", + "integrity": "sha512-msVS9qTuMT5zwAGCVm4mxfrZ18BNc6Csd0oJAtiFMZ1FAx1CCvy2+5MDmYoix63LM/6NDbNtodCiGYGmFgO0dA==" + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "cyclist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", + "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=" + }, + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "damerau-levenshtein": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz", + "integrity": "sha512-CBCRqFnpu715iPmw1KrdOrzRqbdFwQTwAWyyyYS42+iAgHCuXZ+/TdMgQkUENPomxEz9z1BEzuQU2Xw0kUuAgA==" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "data-urls": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", + "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", + "requires": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.2.0", + "whatwg-url": "^7.0.0" + }, + "dependencies": { + "whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + } + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "deep-equal": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz", + "integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==", + "requires": { + "is-arguments": "^1.0.4", + "is-date-object": "^1.0.1", + "is-regex": "^1.0.4", + "object-is": "^1.0.1", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.2.0" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, + "default-gateway": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz", + "integrity": "sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA==", + "requires": { + "execa": "^1.0.0", + "ip-regex": "^2.1.0" + } + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "requires": { + "object-keys": "^1.0.12" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + } + } + }, + "del": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "requires": { + "globby": "^6.1.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "p-map": "^1.1.1", + "pify": "^3.0.0", + "rimraf": "^2.2.8" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "detect-newline": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=" + }, + "detect-node": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz", + "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==" + }, + "detect-port-alt": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/detect-port-alt/-/detect-port-alt-1.1.6.tgz", + "integrity": "sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q==", + "requires": { + "address": "^1.0.1", + "debug": "^2.6.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "diff-sequences": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz", + "integrity": "sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==" + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "dir-glob": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + } + }, + "dns-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", + "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=" + }, + "dns-packet": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz", + "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", + "requires": { + "ip": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, + "dns-txt": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", + "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", + "requires": { + "buffer-indexof": "^1.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "requires": { + "esutils": "^2.0.2" + } + }, + "document.contains": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/document.contains/-/document.contains-1.0.1.tgz", + "integrity": "sha512-A1KqlZq1w605bwiiLqVZehWE9S9UYlUXPoduFWi64pNVNQ9vy6wwH/7BS+iEfSlF1YyZgcg5PZw5HqDi7FCrUw==", + "requires": { + "define-properties": "^1.1.3" + } + }, + "dom-converter": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", + "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==", + "requires": { + "utila": "~0.4" + } + }, + "dom-serializer": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", + "requires": { + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + }, + "dependencies": { + "domelementtype": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", + "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==" + } + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==" + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" + }, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "requires": { + "webidl-conversions": "^4.0.2" + } + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "requires": { + "is-obj": "^1.0.0" + } + }, + "dotenv": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz", + "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==" + }, + "dotenv-expand": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", + "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "duplexify": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", + "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "electron-to-chromium": { + "version": "1.3.338", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.338.tgz", + "integrity": "sha512-wlmfixuHEc9CkfOKgcqdtzBmRW4NStM9ptl5oPILY2UDyHuSXb3Yit+yLVyLObTgGuMMU36hhnfs2GDJId7ctA==" + }, + "elliptic": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", + "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "enhanced-resolve": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz", + "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==", + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + }, + "dependencies": { + "memory-fs": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", + "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "entities": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", + "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==" + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "requires": { + "prr": "~1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.17.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz", + "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==", + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "es5-ext": { + "version": "0.10.53", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", + "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==", + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.3", + "next-tick": "~1.0.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "escodegen": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.13.0.tgz", + "integrity": "sha512-eYk2dCkxR07DsHA/X2hRBj0CFAZeri/LyDMc0C8JT1Hqi6JnVpMhJ7XFITbb0+yZS3lVkaPL2oCkZ3AVmeVbMw==", + "requires": { + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true + } + } + }, + "eslint": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "globals": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz", + "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==", + "requires": { + "type-fest": "^0.8.1" + } + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==" + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + } + } + }, + "eslint-config-react-app": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-5.1.0.tgz", + "integrity": "sha512-hBaxisHC6HXRVvxX+/t1n8mOdmCVIKgkXsf2WoUkJi7upHJTwYTsdCmx01QPOjKNT34QMQQ9sL0tVBlbiMFjxA==", + "requires": { + "confusing-browser-globals": "^1.0.9" + } + }, + "eslint-import-resolver-node": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz", + "integrity": "sha512-b8crLDo0M5RSe5YG8Pu2DYBj71tSB6OvXkfzwbJU2w7y8P4/yo0MyF8jU26IEuEuHF2K5/gcAJE3LhQGqBBbVg==", + "requires": { + "debug": "^2.6.9", + "resolve": "^1.13.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "resolve": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz", + "integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==", + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "eslint-loader": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/eslint-loader/-/eslint-loader-3.0.2.tgz", + "integrity": "sha512-S5VnD+UpVY1PyYRqeBd/4pgsmkvSokbHqTXAQMpvCyRr3XN2tvSLo9spm2nEpqQqh9dezw3os/0zWihLeOg2Rw==", + "requires": { + "fs-extra": "^8.1.0", + "loader-fs-cache": "^1.0.2", + "loader-utils": "^1.2.3", + "object-hash": "^1.3.1", + "schema-utils": "^2.2.0" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "schema-utils": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.6.4.tgz", + "integrity": "sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ==", + "requires": { + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1" + } + } + } + }, + "eslint-module-utils": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.5.2.tgz", + "integrity": "sha512-LGScZ/JSlqGKiT8OC+cYRxseMjyqt6QO54nl281CK93unD89ijSeRV6An8Ci/2nvWVKe8K/Tqdm75RQoIOCr+Q==", + "requires": { + "debug": "^2.6.9", + "pkg-dir": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "requires": { + "find-up": "^2.1.0" + } + } + } + }, + "eslint-plugin-flowtype": { + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz", + "integrity": "sha512-bhewp36P+t7cEV0b6OdmoRWJCBYRiHFlqPZAG1oS3SF+Y0LQkeDvFSM4oxoxvczD1OdONCXMlJfQFiWLcV9urw==", + "requires": { + "lodash": "^4.17.15" + } + }, + "eslint-plugin-import": { + "version": "2.18.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz", + "integrity": "sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==", + "requires": { + "array-includes": "^3.0.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.2", + "eslint-module-utils": "^2.4.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.0", + "read-pkg-up": "^2.0.0", + "resolve": "^1.11.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + } + } + }, + "eslint-plugin-jsx-a11y": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz", + "integrity": "sha512-CawzfGt9w83tyuVekn0GDPU9ytYtxyxyFZ3aSWROmnRRFQFT2BiPJd7jvRdzNDi6oLWaS2asMeYSNMjWTV4eNg==", + "requires": { + "@babel/runtime": "^7.4.5", + "aria-query": "^3.0.0", + "array-includes": "^3.0.3", + "ast-types-flow": "^0.0.7", + "axobject-query": "^2.0.2", + "damerau-levenshtein": "^1.0.4", + "emoji-regex": "^7.0.2", + "has": "^1.0.3", + "jsx-ast-utils": "^2.2.1" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + } + } + }, + "eslint-plugin-react": { + "version": "7.14.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz", + "integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==", + "requires": { + "array-includes": "^3.0.3", + "doctrine": "^2.1.0", + "has": "^1.0.3", + "jsx-ast-utils": "^2.1.0", + "object.entries": "^1.1.0", + "object.fromentries": "^2.0.0", + "object.values": "^1.1.0", + "prop-types": "^15.7.2", + "resolve": "^1.10.1" + }, + "dependencies": { + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "requires": { + "esutils": "^2.0.2" + } + } + } + }, + "eslint-plugin-react-hooks": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz", + "integrity": "sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA==" + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==" + }, + "espree": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", + "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", + "requires": { + "acorn": "^7.1.0", + "acorn-jsx": "^5.1.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "requires": { + "estraverse": "^4.0.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eventemitter3": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz", + "integrity": "sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg==" + }, + "events": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", + "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==" + }, + "eventsource": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz", + "integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==", + "requires": { + "original": "^1.0.0" + } + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "exec-sh": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz", + "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==" + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expect": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-24.9.0.tgz", + "integrity": "sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q==", + "requires": { + "@jest/types": "^24.9.0", + "ansi-styles": "^3.2.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.9.0" + } + }, + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "requires": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "content-type": "~1.0.4", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.5", + "qs": "6.7.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "ext": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", + "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", + "requires": { + "type": "^2.0.0" + }, + "dependencies": { + "type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/type/-/type-2.0.0.tgz", + "integrity": "sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" + }, + "fast-glob": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", + "integrity": "sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==", + "requires": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, + "faye-websocket": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.3.tgz", + "integrity": "sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA==", + "requires": { + "websocket-driver": ">=0.5.1" + } + }, + "fb-watchman": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", + "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", + "requires": { + "bser": "2.1.1" + } + }, + "figgy-pudding": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", + "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==" + }, + "figures": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz", + "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==", + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "requires": { + "flat-cache": "^2.0.1" + } + }, + "file-loader": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-3.0.1.tgz", + "integrity": "sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw==", + "requires": { + "loader-utils": "^1.0.2", + "schema-utils": "^1.0.0" + } + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, + "filesize": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz", + "integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==" + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==" + }, + "flatten": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.3.tgz", + "integrity": "sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg==" + }, + "flush-write-stream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", + "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==", + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.3.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "requires": { + "for-in": "^1.0.1" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "fork-ts-checker-webpack-plugin": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.5.0.tgz", + "integrity": "sha512-zEhg7Hz+KhZlBhILYpXy+Beu96gwvkROWJiTXOCyOOMMrdBIRPvsBpBqgTI4jfJGrJXcqGwJR8zsBGDmzY0jsA==", + "requires": { + "babel-code-frame": "^6.22.0", + "chalk": "^2.4.1", + "chokidar": "^2.0.4", + "micromatch": "^3.1.10", + "minimatch": "^3.0.4", + "semver": "^5.6.0", + "tapable": "^1.0.0", + "worker-rpc": "^0.1.0" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.0.7.tgz", + "integrity": "sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ==", + "optional": true + }, + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "function.prototype.name": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.2.tgz", + "integrity": "sha512-C8A+LlHBJjB2AdcRPorc5JvJ5VUoWlXdEHLOJdCI7kjHEtGTpHQUiqMvCIKUwIsGwZX2jZJy761AXsn356bJQg==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "functions-have-names": "^1.2.0" + } + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" + }, + "functions-have-names": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.1.tgz", + "integrity": "sha512-j48B/ZI7VKs3sgeI2cZp7WXWmZXu7Iq5pl5/vptV5N2mq+DGFuS/ulaDjtaoLpYzuD6u8UgrUKHfgo7fDTSiBA==" + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "gaze": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "dev": true, + "requires": { + "globule": "^1.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-own-enumerable-property-symbols": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", + "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==" + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "glob-to-regexp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", + "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=" + }, + "global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "requires": { + "global-prefix": "^3.0.0" + } + }, + "global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "requires": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "dependencies": { + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + } + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + }, + "globby": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-8.0.2.tgz", + "integrity": "sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w==", + "requires": { + "array-union": "^1.0.1", + "dir-glob": "2.0.0", + "fast-glob": "^2.0.2", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + }, + "dependencies": { + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==" + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" + } + } + }, + "globule": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.0.tgz", + "integrity": "sha512-YlD4kdMqRCQHrhVdonet4TdRtv1/sZKepvoxNT4Nrhrp5HI8XFfc8kFlGlBn2myBo80aGp8Eft259mbcUJhgSg==", + "dev": true, + "requires": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" + }, + "gzip-size": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.1.1.tgz", + "integrity": "sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA==", + "requires": { + "duplexer": "^0.1.1", + "pify": "^4.0.1" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, + "handle-thing": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.0.tgz", + "integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ==" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "harmony-reflect": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.1.tgz", + "integrity": "sha512-WJTeyp0JzGtHcuMsi7rw2VwtkvLa+JyfEKJCFyfcS0+CDkjQ5lHPu7zEhFZP+PDSRrEgXa5Ah0l1MbgbE41XjA==" + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + } + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==" + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" + }, + "hex-color-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", + "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==" + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw==", + "requires": { + "react-is": "^16.7.0" + } + }, + "hosted-git-info": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", + "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==" + }, + "hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "requires": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "hsl-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz", + "integrity": "sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4=" + }, + "hsla-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hsla-regex/-/hsla-regex-1.0.0.tgz", + "integrity": "sha1-wc56MWjIxmFAM6S194d/OyJfnDg=" + }, + "html-comment-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.2.tgz", + "integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==" + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "requires": { + "whatwg-encoding": "^1.0.1" + } + }, + "html-entities": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz", + "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=" + }, + "html-escaper": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.0.tgz", + "integrity": "sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig==" + }, + "html-minifier": { + "version": "3.5.21", + "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.21.tgz", + "integrity": "sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA==", + "requires": { + "camel-case": "3.0.x", + "clean-css": "4.2.x", + "commander": "2.17.x", + "he": "1.2.x", + "param-case": "2.1.x", + "relateurl": "0.2.x", + "uglify-js": "3.4.x" + }, + "dependencies": { + "commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==" + } + } + }, + "html-webpack-plugin": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.5.tgz", + "integrity": "sha512-y5l4lGxOW3pz3xBTFdfB9rnnrWRPVxlAhX6nrBYIcW+2k2zC3mSp/3DxlWVCMBfnO6UAnoF8OcFn0IMy6kaKAQ==", + "requires": { + "html-minifier": "^3.5.20", + "loader-utils": "^1.1.0", + "lodash": "^4.17.11", + "pretty-error": "^2.1.1", + "tapable": "^1.1.0", + "util.promisify": "1.0.0" + }, + "dependencies": { + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + } + } + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + } + } + }, + "http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=" + }, + "http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, + "http-parser-js": { + "version": "0.4.10", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz", + "integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=" + }, + "http-proxy": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz", + "integrity": "sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==", + "requires": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "http-proxy-middleware": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.20.0.tgz", + "integrity": "sha512-dNJAk71nEJhPiAczQH9hGvE/MT9kEs+zn2Dh+Hi94PGZe1GluQirC7mw5rdREUtWx6qGS1Gu0bZd4qEAg+REgw==", + "requires": { + "http-proxy": "^1.17.0", + "is-glob": "^4.0.1", + "lodash": "^4.17.14", + "micromatch": "^4.0.2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "icss-replace-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", + "integrity": "sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=" + }, + "icss-utils": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-4.1.1.tgz", + "integrity": "sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==", + "requires": { + "postcss": "^7.0.14" + } + }, + "identity-obj-proxy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz", + "integrity": "sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ=", + "requires": { + "harmony-reflect": "^1.4.6" + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=" + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" + }, + "immer": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/immer/-/immer-1.10.0.tgz", + "integrity": "sha512-O3sR1/opvCDGLEVcvrGTMtLac8GJ5IwZC4puPrLuRj3l7ICKvkmA0vGuU9OW8mV9WIBRnaxp5GJh9IEAaNOoYg==" + }, + "import-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", + "integrity": "sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk=", + "requires": { + "import-from": "^2.1.0" + } + }, + "import-fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", + "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "requires": { + "caller-path": "^2.0.0", + "resolve-from": "^3.0.0" + } + }, + "import-from": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-2.1.0.tgz", + "integrity": "sha1-M1238qev/VOqpHHUuAId7ja387E=", + "requires": { + "resolve-from": "^3.0.0" + } + }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "in-publish": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz", + "integrity": "sha1-4g/146KvwmkDILbcVSaCqcf631E=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "indexes-of": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=" + }, + "infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "inquirer": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.3.tgz", + "integrity": "sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw==", + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^2.4.2", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.2.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + } + }, + "internal-ip": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.3.0.tgz", + "integrity": "sha512-S1zBo1D6zcsyuC6PMmY5+55YMILQ9av8lotMx447Bq6SAgo/sDK6y6uUKmuYhW7eacnIhFfsPmCNYdDzsnnDCg==", + "requires": { + "default-gateway": "^4.2.0", + "ipaddr.js": "^1.9.0" + } + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "requires": { + "loose-envify": "^1.0.0" + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, + "ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=" + }, + "ipaddr.js": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", + "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" + }, + "is-absolute-url": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", + "integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=" + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-callable": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==" + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-color-stop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-color-stop/-/is-color-stop-1.1.0.tgz", + "integrity": "sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=", + "requires": { + "css-color-names": "^0.0.4", + "hex-color-regex": "^1.1.0", + "hsl-regex": "^1.0.0", + "hsla-regex": "^1.0.0", + "rgb-regex": "^1.0.1", + "rgba-regex": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==" + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } + } + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=" + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==" + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=" + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "requires": { + "is-path-inside": "^1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "^3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" + }, + "is-regex": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "requires": { + "has": "^1.0.3" + } + }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=" + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==" + }, + "is-root": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-root/-/is-root-2.1.0.tgz", + "integrity": "sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==" + }, + "is-svg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-3.0.0.tgz", + "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==", + "requires": { + "html-comment-regex": "^1.1.0" + } + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-what": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.5.1.tgz", + "integrity": "sha512-NHeqazf97ZVerGNEDmYG4+J4UY3uDQOjaJNMIMXw2i/tFfMconSgSK8Z27Y4VWMbM96E9ylroUSnD7jXRjzBwA==" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==" + }, + "istanbul-lib-instrument": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", + "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "requires": { + "@babel/generator": "^7.4.0", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", + "istanbul-lib-coverage": "^2.0.5", + "semver": "^6.0.0" + } + }, + "istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "requires": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", + "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "rimraf": "^2.6.3", + "source-map": "^0.6.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "istanbul-reports": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", + "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", + "requires": { + "html-escaper": "^2.0.0" + } + }, + "jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-24.9.0.tgz", + "integrity": "sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw==", + "requires": { + "import-local": "^2.0.0", + "jest-cli": "^24.9.0" + }, + "dependencies": { + "jest-cli": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.9.0.tgz", + "integrity": "sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg==", + "requires": { + "@jest/core": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "import-local": "^2.0.0", + "is-ci": "^2.0.0", + "jest-config": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "prompts": "^2.0.1", + "realpath-native": "^1.1.0", + "yargs": "^13.3.0" + } + } + } + }, + "jest-changed-files": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz", + "integrity": "sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg==", + "requires": { + "@jest/types": "^24.9.0", + "execa": "^1.0.0", + "throat": "^4.0.0" + } + }, + "jest-config": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz", + "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==", + "requires": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^24.9.0", + "@jest/types": "^24.9.0", + "babel-jest": "^24.9.0", + "chalk": "^2.0.1", + "glob": "^7.1.1", + "jest-environment-jsdom": "^24.9.0", + "jest-environment-node": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "micromatch": "^3.1.10", + "pretty-format": "^24.9.0", + "realpath-native": "^1.1.0" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "jest-diff": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz", + "integrity": "sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==", + "requires": { + "chalk": "^2.0.1", + "diff-sequences": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-docblock": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.9.0.tgz", + "integrity": "sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA==", + "requires": { + "detect-newline": "^2.1.0" + } + }, + "jest-each": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.9.0.tgz", + "integrity": "sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog==", + "requires": { + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-environment-jsdom": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz", + "integrity": "sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA==", + "requires": { + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0", + "jsdom": "^11.5.1" + } + }, + "jest-environment-jsdom-fourteen": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom-fourteen/-/jest-environment-jsdom-fourteen-0.1.0.tgz", + "integrity": "sha512-4vtoRMg7jAstitRzL4nbw83VmGH8Rs13wrND3Ud2o1fczDhMUF32iIrNKwYGgeOPUdfvZU4oy8Bbv+ni1fgVCA==", + "requires": { + "jest-mock": "^24.5.0", + "jest-util": "^24.5.0", + "jsdom": "^14.0.0" + }, + "dependencies": { + "acorn": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", + "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==" + }, + "jsdom": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-14.1.0.tgz", + "integrity": "sha512-O901mfJSuTdwU2w3Sn+74T+RnDVP+FuV5fH8tcPWyqrseRAb0s5xOtPgCFiPOtLcyK7CLIJwPyD83ZqQWvA5ng==", + "requires": { + "abab": "^2.0.0", + "acorn": "^6.0.4", + "acorn-globals": "^4.3.0", + "array-equal": "^1.0.0", + "cssom": "^0.3.4", + "cssstyle": "^1.1.1", + "data-urls": "^1.1.0", + "domexception": "^1.0.1", + "escodegen": "^1.11.0", + "html-encoding-sniffer": "^1.0.2", + "nwsapi": "^2.1.3", + "parse5": "5.1.0", + "pn": "^1.1.0", + "request": "^2.88.0", + "request-promise-native": "^1.0.5", + "saxes": "^3.1.9", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.5.0", + "w3c-hr-time": "^1.0.1", + "w3c-xmlserializer": "^1.1.2", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^7.0.0", + "ws": "^6.1.2", + "xml-name-validator": "^3.0.0" + } + }, + "parse5": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", + "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==" + }, + "whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "jest-environment-node": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.9.0.tgz", + "integrity": "sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA==", + "requires": { + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0" + } + }, + "jest-get-type": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz", + "integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==" + }, + "jest-haste-map": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.9.0.tgz", + "integrity": "sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ==", + "requires": { + "@jest/types": "^24.9.0", + "anymatch": "^2.0.0", + "fb-watchman": "^2.0.0", + "fsevents": "^1.2.7", + "graceful-fs": "^4.1.15", + "invariant": "^2.2.4", + "jest-serializer": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.9.0", + "micromatch": "^3.1.10", + "sane": "^4.0.3", + "walker": "^1.0.7" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fsevents": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz", + "integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==", + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1", + "node-pre-gyp": "*" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "optional": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "optional": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.3", + "bundled": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "optional": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "debug": { + "version": "3.2.6", + "bundled": true, + "optional": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.7", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.6", + "bundled": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.3", + "bundled": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "bundled": true, + "optional": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "optional": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "optional": true + }, + "minipass": { + "version": "2.9.0", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "optional": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.1.2", + "bundled": true, + "optional": true + }, + "needle": { + "version": "2.4.0", + "bundled": true, + "optional": true, + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.14.0", + "bundled": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4.4.2" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.1.1", + "bundled": true, + "optional": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "npm-packlist": { + "version": "1.4.7", + "bundled": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "optional": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "optional": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "bundled": true, + "optional": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "optional": true + }, + "semver": { + "version": "5.7.1", + "bundled": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "tar": { + "version": "4.4.13", + "bundled": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "yallist": { + "version": "3.1.1", + "bundled": true, + "optional": true + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "jest-jasmine2": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz", + "integrity": "sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==", + "requires": { + "@babel/traverse": "^7.1.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "co": "^4.6.0", + "expect": "^24.9.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0", + "throat": "^4.0.0" + } + }, + "jest-leak-detector": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz", + "integrity": "sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==", + "requires": { + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-matcher-utils": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz", + "integrity": "sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==", + "requires": { + "chalk": "^2.0.1", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-message-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.9.0.tgz", + "integrity": "sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/stack-utils": "^1.0.1", + "chalk": "^2.0.1", + "micromatch": "^3.1.10", + "slash": "^2.0.0", + "stack-utils": "^1.0.1" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "jest-mock": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.9.0.tgz", + "integrity": "sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w==", + "requires": { + "@jest/types": "^24.9.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", + "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==" + }, + "jest-regex-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.9.0.tgz", + "integrity": "sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA==" + }, + "jest-resolve": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.9.0.tgz", + "integrity": "sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ==", + "requires": { + "@jest/types": "^24.9.0", + "browser-resolve": "^1.11.3", + "chalk": "^2.0.1", + "jest-pnp-resolver": "^1.2.1", + "realpath-native": "^1.1.0" + } + }, + "jest-resolve-dependencies": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz", + "integrity": "sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g==", + "requires": { + "@jest/types": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-snapshot": "^24.9.0" + } + }, + "jest-runner": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.9.0.tgz", + "integrity": "sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg==", + "requires": { + "@jest/console": "^24.7.1", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.4.2", + "exit": "^0.1.2", + "graceful-fs": "^4.1.15", + "jest-config": "^24.9.0", + "jest-docblock": "^24.3.0", + "jest-haste-map": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-leak-detector": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.6.0", + "source-map-support": "^0.5.6", + "throat": "^4.0.0" + } + }, + "jest-runtime": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.9.0.tgz", + "integrity": "sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==", + "requires": { + "@jest/console": "^24.7.1", + "@jest/environment": "^24.9.0", + "@jest/source-map": "^24.3.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.1.15", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "realpath-native": "^1.1.0", + "slash": "^2.0.0", + "strip-bom": "^3.0.0", + "yargs": "^13.3.0" + } + }, + "jest-serializer": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-24.9.0.tgz", + "integrity": "sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==" + }, + "jest-snapshot": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.9.0.tgz", + "integrity": "sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew==", + "requires": { + "@babel/types": "^7.0.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "expect": "^24.9.0", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "pretty-format": "^24.9.0", + "semver": "^6.2.0" + } + }, + "jest-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz", + "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==", + "requires": { + "@jest/console": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/source-map": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "callsites": "^3.0.0", + "chalk": "^2.0.1", + "graceful-fs": "^4.1.15", + "is-ci": "^2.0.0", + "mkdirp": "^0.5.1", + "slash": "^2.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "jest-validate": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", + "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", + "requires": { + "@jest/types": "^24.9.0", + "camelcase": "^5.3.1", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "leven": "^3.1.0", + "pretty-format": "^24.9.0" + } + }, + "jest-watch-typeahead": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/jest-watch-typeahead/-/jest-watch-typeahead-0.4.0.tgz", + "integrity": "sha512-bJR/HPNgOQnkmttg1OkBIrYFAYuxFxExtgQh67N2qPvaWGVC8TCkedRNPKBfmZfVXFD3u2sCH+9OuS5ApBfCgA==", + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^2.4.1", + "jest-watcher": "^24.3.0", + "slash": "^3.0.0", + "string-length": "^3.1.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "string-length": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz", + "integrity": "sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA==", + "requires": { + "astral-regex": "^1.0.0", + "strip-ansi": "^5.2.0" + } + } + } + }, + "jest-watcher": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.9.0.tgz", + "integrity": "sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw==", + "requires": { + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "jest-util": "^24.9.0", + "string-length": "^2.0.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==" + } + } + }, + "jest-worker": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", + "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "js-base64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz", + "integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==", + "dev": true + }, + "js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "jsdom": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", + "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "requires": { + "abab": "^2.0.0", + "acorn": "^5.5.3", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": "^1.0.0", + "data-urls": "^1.0.0", + "domexception": "^1.0.1", + "escodegen": "^1.9.1", + "html-encoding-sniffer": "^1.0.2", + "left-pad": "^1.3.0", + "nwsapi": "^2.0.7", + "parse5": "4.0.0", + "pn": "^1.1.0", + "request": "^2.87.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.3.4", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.3", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^6.4.1", + "ws": "^5.2.0", + "xml-name-validator": "^3.0.0" + }, + "dependencies": { + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" + } + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "requires": { + "jsonify": "~0.0.0" + } + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "json3": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz", + "integrity": "sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==" + }, + "json5": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", + "requires": { + "minimist": "^1.2.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jsx-ast-utils": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.3.tgz", + "integrity": "sha512-EdIHFMm+1BPynpKOpdPqiOsvnIrInRGJD7bzPZdPkjitQEqpdpUuFpq4T0npZFKTiB3RhWFdGN+oqOJIdhDhQA==", + "requires": { + "array-includes": "^3.0.3", + "object.assign": "^4.1.0" + } + }, + "killable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", + "integrity": "sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg==" + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==" + }, + "last-call-webpack-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz", + "integrity": "sha512-7KI2l2GIZa9p2spzPIVZBYyNKkN+e/SQPpnjlTiPhdbDW3F86tdKKELxKpzJ5sgU19wQWsACULZmpTPYHeWO5w==", + "requires": { + "lodash": "^4.17.5", + "webpack-sources": "^1.1.0" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "left-pad": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==" + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==" + }, + "levenary": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/levenary/-/levenary-1.1.0.tgz", + "integrity": "sha512-VHcwhO0UTpUW7rLPN2/OiWJdgA1e9BqEDALhrgCe/F+uUJnep6CoUsTzMeP8Rh0NGr9uKquXxqe7lwLZo509nQ==", + "requires": { + "leven": "^3.1.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "libsodium": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.6.tgz", + "integrity": "sha512-hPb/04sEuLcTRdWDtd+xH3RXBihpmbPCsKW/Jtf4PsvdyKh+D6z2D2gvp/5BfoxseP+0FCOg66kE+0oGUE/loQ==" + }, + "libsodium-wrappers": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.6.tgz", + "integrity": "sha512-OUO2CWW5bHdLr6hkKLHIKI4raEkZrf3QHkhXsJ1yCh6MZ3JDA7jFD3kCATNquuGSG6MjjPHQIQms0y0gBDzjQg==", + "requires": { + "libsodium": "0.7.6" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "loader-fs-cache": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/loader-fs-cache/-/loader-fs-cache-1.0.2.tgz", + "integrity": "sha512-70IzT/0/L+M20jUlEqZhZyArTU6VKLRTYRDAYN26g4jfzpJqjipLL3/hgYpySqI9PwsVRHHFja0LfEmsx9X2Cw==", + "requires": { + "find-cache-dir": "^0.1.1", + "mkdirp": "0.5.1" + }, + "dependencies": { + "find-cache-dir": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz", + "integrity": "sha1-yN765XyKUqinhPnjHFfHQumToLk=", + "requires": { + "commondir": "^1.0.1", + "mkdirp": "^0.5.1", + "pkg-dir": "^1.0.0" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "pkg-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", + "requires": { + "find-up": "^1.0.0" + } + } + } + }, + "loader-runner": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", + "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==" + }, + "loader-utils": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz", + "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==", + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^2.0.0", + "json5": "^1.0.1" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=" + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" + }, + "lodash.template": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", + "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", + "requires": { + "lodash._reinterpolate": "^3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", + "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", + "requires": { + "lodash._reinterpolate": "^3.0.0" + } + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" + }, + "loglevel": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.6.tgz", + "integrity": "sha512-Sgr5lbboAUBo3eXCSPL4/KoVz3ROKquOjcctxmHIt+vol2DrqTQe3SwkKKuYhEiWB5kYa13YyopJ69deJ1irzQ==" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lower-case": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", + "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=" + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "makeerror": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "requires": { + "tmpl": "1.0.x" + } + }, + "mamacro": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", + "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==" + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "requires": { + "p-defer": "^1.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "requires": { + "object-visit": "^1.0.0" + } + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "mdn-data": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz", + "integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==" + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, + "memoize-one": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.1.1.tgz", + "integrity": "sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA==" + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "merge-anything": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/merge-anything/-/merge-anything-2.4.4.tgz", + "integrity": "sha512-l5XlriUDJKQT12bH+rVhAHjwIuXWdAIecGwsYjv2LJo+dA1AeRTmeQS+3QBpO6lEthBMDi2IUMpLC1yyRvGlwQ==", + "requires": { + "is-what": "^3.3.1" + } + }, + "merge-deep": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.2.tgz", + "integrity": "sha512-T7qC8kg4Zoti1cFd8Cr0M+qaZfOwjlPDEdZIIPPB2JZctjaPM4fX+i7HOId69tAti2fvO6X5ldfYUONDODsrkA==", + "requires": { + "arr-union": "^3.1.0", + "clone-deep": "^0.2.4", + "kind-of": "^3.0.2" + } + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "merge2": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", + "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "microevent.ts": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/microevent.ts/-/microevent.ts-0.1.1.tgz", + "integrity": "sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g==" + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "requires": { + "mime-db": "1.43.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "mini-css-extract-plugin": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz", + "integrity": "sha512-MNpRGbNA52q6U92i0qbVpQNsgk7LExy41MdAlG84FeytfDOtRIf/mCHdEgG8rpTKOaNKiqUnZdlptF469hxqOw==", + "requires": { + "loader-utils": "^1.1.0", + "normalize-url": "1.9.1", + "schema-utils": "^1.0.0", + "webpack-sources": "^1.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mississippi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", + "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mixin-object": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", + "integrity": "sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=", + "requires": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "dependencies": { + "for-in": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", + "integrity": "sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=" + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "monaco-editor": { + "version": "npm:@ligolang/monaco-editor@0.18.1", + "resolved": "https://registry.npmjs.org/@ligolang/monaco-editor/-/monaco-editor-0.18.1.tgz", + "integrity": "sha512-1JEjF5w7AbD8zqoak9Bf8RnGqGCU4OgcKn3hFHPhYQ2TrO+Ufv0Co0oU53pyv+QeGwSgEEQf5YhUqyyUAjG8Rg==" + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "multicast-dns": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", + "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", + "requires": { + "dns-packet": "^1.3.1", + "thunky": "^1.0.2" + } + }, + "multicast-dns-service-types": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", + "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=" + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + } + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" + }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + }, + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==" + }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "no-case": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", + "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", + "requires": { + "lower-case": "^1.1.1" + } + }, + "node-forge": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", + "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==" + }, + "node-gyp": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", + "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", + "dev": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "dependencies": { + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true + } + } + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=" + }, + "node-libs-browser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", + "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==", + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^3.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.1", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.11.0", + "vm-browserify": "^1.0.1" + }, + "dependencies": { + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "util": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", + "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + } + } + }, + "node-modules-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", + "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=" + }, + "node-notifier": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz", + "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==", + "requires": { + "growly": "^1.3.0", + "is-wsl": "^1.1.0", + "semver": "^5.5.0", + "shellwords": "^0.1.1", + "which": "^1.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "node-releases": { + "version": "1.1.47", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.47.tgz", + "integrity": "sha512-k4xjVPx5FpwBUj0Gw7uvFOTF4Ep8Hok1I6qjwL3pLfwe7Y0REQSAqOwwv9TWBCUtMHxcXfY4PgRLRozcChvTcA==", + "requires": { + "semver": "^6.3.0" + } + }, + "node-sass": { + "version": "4.13.1", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.1.tgz", + "integrity": "sha512-TTWFx+ZhyDx1Biiez2nB0L3YrCZ/8oHagaDalbuBSlqXgUPsdkUSzJsVxeDO9LtPB49+Fh3WQl3slABo6AotNw==", + "dev": true, + "requires": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash": "^4.17.15", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.13.2", + "node-gyp": "^3.8.0", + "npmlog": "^4.0.0", + "request": "^2.88.0", + "sass-graph": "^2.2.4", + "stdout-stream": "^1.4.0", + "true-case-path": "^1.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cross-spawn": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", + "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=" + }, + "normalize-url": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz", + "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", + "requires": { + "object-assign": "^4.0.1", + "prepend-http": "^1.0.0", + "query-string": "^4.1.0", + "sort-keys": "^1.0.0" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "requires": { + "boolbase": "~1.0.0" + } + }, + "num2fraction": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=" + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "nwsapi": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", + "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "object-hash": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-1.3.1.tgz", + "integrity": "sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==" + }, + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==" + }, + "object-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.0.2.tgz", + "integrity": "sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ==" + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object-path": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.4.tgz", + "integrity": "sha1-NwrnUvvzfePqcKhhwju6iRVpGUk=" + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "requires": { + "isobject": "^3.0.0" + } + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.entries": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.1.tgz", + "integrity": "sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, + "object.fromentries": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.2.tgz", + "integrity": "sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + } + }, + "object.values": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", + "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, + "obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "open": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-6.4.0.tgz", + "integrity": "sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==", + "requires": { + "is-wsl": "^1.1.0" + } + }, + "opn": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/opn/-/opn-5.5.0.tgz", + "integrity": "sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA==", + "requires": { + "is-wsl": "^1.1.0" + } + }, + "optimize-css-assets-webpack-plugin": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.3.tgz", + "integrity": "sha512-q9fbvCRS6EYtUKKSwI87qm2IxlyJK5b4dygW1rKUBT6mMDhdG5e5bZT63v6tnJR9F9FB/H5a0HTmtw+laUBxKA==", + "requires": { + "cssnano": "^4.1.10", + "last-call-webpack-plugin": "^3.0.0" + } + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "original": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", + "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==", + "requires": { + "url-parse": "^1.4.3" + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" + }, + "p-each-series": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-1.0.0.tgz", + "integrity": "sha1-kw89Et0fUOdDRFeiLNbwSsatf3E=", + "requires": { + "p-reduce": "^1.0.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==" + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==" + }, + "p-reduce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz", + "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=" + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "pako": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", + "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" + }, + "parallel-transform": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz", + "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==", + "requires": { + "cyclist": "^1.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "param-case": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", + "integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=", + "requires": { + "no-case": "^2.2.0" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "requires": { + "callsites": "^3.0.0" + }, + "dependencies": { + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + } + } + }, + "parse-asn1": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", + "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==" + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "requires": { + "pify": "^3.0.0" + } + }, + "pbkdf2": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "picomatch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz", + "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==" + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, + "pirates": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", + "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "requires": { + "node-modules-regexp": "^1.0.0" + } + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "requires": { + "find-up": "^3.0.0" + } + }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "requires": { + "find-up": "^2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + } + } + }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" + }, + "pnp-webpack-plugin": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/pnp-webpack-plugin/-/pnp-webpack-plugin-1.5.0.tgz", + "integrity": "sha512-jd9olUr9D7do+RN8Wspzhpxhgp1n6Vd0NtQ4SFkmIACZoEL1nkyAdW9Ygrinjec0vgDcWjscFQQ1gDW8rsfKTg==", + "requires": { + "ts-pnp": "^1.1.2" + } + }, + "polished": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/polished/-/polished-1.9.3.tgz", + "integrity": "sha512-4NmSD7fMFlM8roNxs7YXPv7UFRbYzb0gufR5zBxJLRzY54+zFsavxBo6zsQzP9ep6Hh3pC2pTyrpSTBEaB6IkQ==" + }, + "portfinder": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.25.tgz", + "integrity": "sha512-6ElJnHBbxVA1XSLgBp7G1FiCkQdlqGzuF7DswL5tcea+E8UpuvPU7beVAjjRwCioTS9ZluNbu+ZyRvgTsmqEBg==", + "requires": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.1" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" + }, + "postcss": { + "version": "7.0.26", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.26.tgz", + "integrity": "sha512-IY4oRjpXWYshuTDFxMVkJDtWIk2LhsTlu8bZnbEJA4+bYT16Lvpo8Qv6EvDumhYRgzjZl489pmsY3qVgJQ08nA==", + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-attribute-case-insensitive": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-attribute-case-insensitive/-/postcss-attribute-case-insensitive-4.0.1.tgz", + "integrity": "sha512-L2YKB3vF4PetdTIthQVeT+7YiSzMoNMLLYxPXXppOOP7NoazEAy45sh2LvJ8leCQjfBcfkYQs8TtCcQjeZTp8A==", + "requires": { + "postcss": "^7.0.2", + "postcss-selector-parser": "^5.0.0" + }, + "dependencies": { + "cssesc": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz", + "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==" + }, + "postcss-selector-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz", + "integrity": "sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ==", + "requires": { + "cssesc": "^2.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-browser-comments": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-browser-comments/-/postcss-browser-comments-2.0.0.tgz", + "integrity": "sha512-xGG0UvoxwBc4Yx4JX3gc0RuDl1kc4bVihCzzk6UC72YPfq5fu3c717Nu8Un3nvnq1BJ31gBnFXIG/OaUTnpHgA==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-calc": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-7.0.1.tgz", + "integrity": "sha512-oXqx0m6tb4N3JGdmeMSc/i91KppbYsFZKdH0xMOqK8V1rJlzrKlTdokz8ozUXLVejydRN6u2IddxpcijRj2FqQ==", + "requires": { + "css-unit-converter": "^1.1.1", + "postcss": "^7.0.5", + "postcss-selector-parser": "^5.0.0-rc.4", + "postcss-value-parser": "^3.3.1" + }, + "dependencies": { + "cssesc": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz", + "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==" + }, + "postcss-selector-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz", + "integrity": "sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ==", + "requires": { + "cssesc": "^2.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-color-functional-notation": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/postcss-color-functional-notation/-/postcss-color-functional-notation-2.0.1.tgz", + "integrity": "sha512-ZBARCypjEDofW4P6IdPVTLhDNXPRn8T2s1zHbZidW6rPaaZvcnCS2soYFIQJrMZSxiePJ2XIYTlcb2ztr/eT2g==", + "requires": { + "postcss": "^7.0.2", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-color-gray": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-color-gray/-/postcss-color-gray-5.0.0.tgz", + "integrity": "sha512-q6BuRnAGKM/ZRpfDascZlIZPjvwsRye7UDNalqVz3s7GDxMtqPY6+Q871liNxsonUw8oC61OG+PSaysYpl1bnw==", + "requires": { + "@csstools/convert-colors": "^1.4.0", + "postcss": "^7.0.5", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-color-hex-alpha": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/postcss-color-hex-alpha/-/postcss-color-hex-alpha-5.0.3.tgz", + "integrity": "sha512-PF4GDel8q3kkreVXKLAGNpHKilXsZ6xuu+mOQMHWHLPNyjiUBOr75sp5ZKJfmv1MCus5/DWUGcK9hm6qHEnXYw==", + "requires": { + "postcss": "^7.0.14", + "postcss-values-parser": "^2.0.1" + } + }, + "postcss-color-mod-function": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/postcss-color-mod-function/-/postcss-color-mod-function-3.0.3.tgz", + "integrity": "sha512-YP4VG+xufxaVtzV6ZmhEtc+/aTXH3d0JLpnYfxqTvwZPbJhWqp8bSY3nfNzNRFLgB4XSaBA82OE4VjOOKpCdVQ==", + "requires": { + "@csstools/convert-colors": "^1.4.0", + "postcss": "^7.0.2", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-color-rebeccapurple": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-color-rebeccapurple/-/postcss-color-rebeccapurple-4.0.1.tgz", + "integrity": "sha512-aAe3OhkS6qJXBbqzvZth2Au4V3KieR5sRQ4ptb2b2O8wgvB3SJBsdG+jsn2BZbbwekDG8nTfcCNKcSfe/lEy8g==", + "requires": { + "postcss": "^7.0.2", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-colormin": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-4.0.3.tgz", + "integrity": "sha512-WyQFAdDZpExQh32j0U0feWisZ0dmOtPl44qYmJKkq9xFWY3p+4qnRzCHeNrkeRhwPHz9bQ3mo0/yVkaply0MNw==", + "requires": { + "browserslist": "^4.0.0", + "color": "^3.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-convert-values": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-4.0.1.tgz", + "integrity": "sha512-Kisdo1y77KUC0Jmn0OXU/COOJbzM8cImvw1ZFsBgBgMgb1iL23Zs/LXRe3r+EZqM3vGYKdQ2YJVQ5VkJI+zEJQ==", + "requires": { + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-custom-media": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/postcss-custom-media/-/postcss-custom-media-7.0.8.tgz", + "integrity": "sha512-c9s5iX0Ge15o00HKbuRuTqNndsJUbaXdiNsksnVH8H4gdc+zbLzr/UasOwNG6CTDpLFekVY4672eWdiiWu2GUg==", + "requires": { + "postcss": "^7.0.14" + } + }, + "postcss-custom-properties": { + "version": "8.0.11", + "resolved": "https://registry.npmjs.org/postcss-custom-properties/-/postcss-custom-properties-8.0.11.tgz", + "integrity": "sha512-nm+o0eLdYqdnJ5abAJeXp4CEU1c1k+eB2yMCvhgzsds/e0umabFrN6HoTy/8Q4K5ilxERdl/JD1LO5ANoYBeMA==", + "requires": { + "postcss": "^7.0.17", + "postcss-values-parser": "^2.0.1" + } + }, + "postcss-custom-selectors": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/postcss-custom-selectors/-/postcss-custom-selectors-5.1.2.tgz", + "integrity": "sha512-DSGDhqinCqXqlS4R7KGxL1OSycd1lydugJ1ky4iRXPHdBRiozyMHrdu0H3o7qNOCiZwySZTUI5MV0T8QhCLu+w==", + "requires": { + "postcss": "^7.0.2", + "postcss-selector-parser": "^5.0.0-rc.3" + }, + "dependencies": { + "cssesc": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz", + "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==" + }, + "postcss-selector-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz", + "integrity": "sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ==", + "requires": { + "cssesc": "^2.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-dir-pseudo-class": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-dir-pseudo-class/-/postcss-dir-pseudo-class-5.0.0.tgz", + "integrity": "sha512-3pm4oq8HYWMZePJY+5ANriPs3P07q+LW6FAdTlkFH2XqDdP4HeeJYMOzn0HYLhRSjBO3fhiqSwwU9xEULSrPgw==", + "requires": { + "postcss": "^7.0.2", + "postcss-selector-parser": "^5.0.0-rc.3" + }, + "dependencies": { + "cssesc": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz", + "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==" + }, + "postcss-selector-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz", + "integrity": "sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ==", + "requires": { + "cssesc": "^2.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-discard-comments": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-4.0.2.tgz", + "integrity": "sha512-RJutN259iuRf3IW7GZyLM5Sw4GLTOH8FmsXBnv8Ab/Tc2k4SR4qbV4DNbyyY4+Sjo362SyDmW2DQ7lBSChrpkg==", + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-discard-duplicates": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz", + "integrity": "sha512-ZNQfR1gPNAiXZhgENFfEglF93pciw0WxMkJeVmw8eF+JZBbMD7jp6C67GqJAXVZP2BWbOztKfbsdmMp/k8c6oQ==", + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-discard-empty": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-4.0.1.tgz", + "integrity": "sha512-B9miTzbznhDjTfjvipfHoqbWKwd0Mj+/fL5s1QOz06wufguil+Xheo4XpOnc4NqKYBCNqqEzgPv2aPBIJLox0w==", + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-discard-overridden": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-4.0.1.tgz", + "integrity": "sha512-IYY2bEDD7g1XM1IDEsUT4//iEYCxAmP5oDSFMVU/JVvT7gh+l4fmjciLqGgwjdWpQIdb0Che2VX00QObS5+cTg==", + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-double-position-gradients": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postcss-double-position-gradients/-/postcss-double-position-gradients-1.0.0.tgz", + "integrity": "sha512-G+nV8EnQq25fOI8CH/B6krEohGWnF5+3A6H/+JEpOncu5dCnkS1QQ6+ct3Jkaepw1NGVqqOZH6lqrm244mCftA==", + "requires": { + "postcss": "^7.0.5", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-env-function": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/postcss-env-function/-/postcss-env-function-2.0.2.tgz", + "integrity": "sha512-rwac4BuZlITeUbiBq60h/xbLzXY43qOsIErngWa4l7Mt+RaSkT7QBjXVGTcBHupykkblHMDrBFh30zchYPaOUw==", + "requires": { + "postcss": "^7.0.2", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-flexbugs-fixes": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-flexbugs-fixes/-/postcss-flexbugs-fixes-4.1.0.tgz", + "integrity": "sha512-jr1LHxQvStNNAHlgco6PzY308zvLklh7SJVYuWUwyUQncofaAlD2l+P/gxKHOdqWKe7xJSkVLFF/2Tp+JqMSZA==", + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-focus-visible": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-focus-visible/-/postcss-focus-visible-4.0.0.tgz", + "integrity": "sha512-Z5CkWBw0+idJHSV6+Bgf2peDOFf/x4o+vX/pwcNYrWpXFrSfTkQ3JQ1ojrq9yS+upnAlNRHeg8uEwFTgorjI8g==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-focus-within": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-focus-within/-/postcss-focus-within-3.0.0.tgz", + "integrity": "sha512-W0APui8jQeBKbCGZudW37EeMCjDeVxKgiYfIIEo8Bdh5SpB9sxds/Iq8SEuzS0Q4YFOlG7EPFulbbxujpkrV2w==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-font-variant": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-font-variant/-/postcss-font-variant-4.0.0.tgz", + "integrity": "sha512-M8BFYKOvCrI2aITzDad7kWuXXTm0YhGdP9Q8HanmN4EF1Hmcgs1KK5rSHylt/lUJe8yLxiSwWAHdScoEiIxztg==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-gap-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-gap-properties/-/postcss-gap-properties-2.0.0.tgz", + "integrity": "sha512-QZSqDaMgXCHuHTEzMsS2KfVDOq7ZFiknSpkrPJY6jmxbugUPTuSzs/vuE5I3zv0WAS+3vhrlqhijiprnuQfzmg==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-image-set-function": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/postcss-image-set-function/-/postcss-image-set-function-3.0.1.tgz", + "integrity": "sha512-oPTcFFip5LZy8Y/whto91L9xdRHCWEMs3e1MdJxhgt4jy2WYXfhkng59fH5qLXSCPN8k4n94p1Czrfe5IOkKUw==", + "requires": { + "postcss": "^7.0.2", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-initial": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/postcss-initial/-/postcss-initial-3.0.2.tgz", + "integrity": "sha512-ugA2wKonC0xeNHgirR4D3VWHs2JcU08WAi1KFLVcnb7IN89phID6Qtg2RIctWbnvp1TM2BOmDtX8GGLCKdR8YA==", + "requires": { + "lodash.template": "^4.5.0", + "postcss": "^7.0.2" + } + }, + "postcss-lab-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/postcss-lab-function/-/postcss-lab-function-2.0.1.tgz", + "integrity": "sha512-whLy1IeZKY+3fYdqQFuDBf8Auw+qFuVnChWjmxm/UhHWqNHZx+B99EwxTvGYmUBqe3Fjxs4L1BoZTJmPu6usVg==", + "requires": { + "@csstools/convert-colors": "^1.4.0", + "postcss": "^7.0.2", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-load-config": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-2.1.0.tgz", + "integrity": "sha512-4pV3JJVPLd5+RueiVVB+gFOAa7GWc25XQcMp86Zexzke69mKf6Nx9LRcQywdz7yZI9n1udOxmLuAwTBypypF8Q==", + "requires": { + "cosmiconfig": "^5.0.0", + "import-cwd": "^2.0.0" + } + }, + "postcss-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-3.0.0.tgz", + "integrity": "sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA==", + "requires": { + "loader-utils": "^1.1.0", + "postcss": "^7.0.0", + "postcss-load-config": "^2.0.0", + "schema-utils": "^1.0.0" + } + }, + "postcss-logical": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-logical/-/postcss-logical-3.0.0.tgz", + "integrity": "sha512-1SUKdJc2vuMOmeItqGuNaC+N8MzBWFWEkAnRnLpFYj1tGGa7NqyVBujfRtgNa2gXR+6RkGUiB2O5Vmh7E2RmiA==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-media-minmax": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-media-minmax/-/postcss-media-minmax-4.0.0.tgz", + "integrity": "sha512-fo9moya6qyxsjbFAYl97qKO9gyre3qvbMnkOZeZwlsW6XYFsvs2DMGDlchVLfAd8LHPZDxivu/+qW2SMQeTHBw==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-merge-longhand": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-4.0.11.tgz", + "integrity": "sha512-alx/zmoeXvJjp7L4mxEMjh8lxVlDFX1gqWHzaaQewwMZiVhLo42TEClKaeHbRf6J7j82ZOdTJ808RtN0ZOZwvw==", + "requires": { + "css-color-names": "0.0.4", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0", + "stylehacks": "^4.0.0" + } + }, + "postcss-merge-rules": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-4.0.3.tgz", + "integrity": "sha512-U7e3r1SbvYzO0Jr3UT/zKBVgYYyhAz0aitvGIYOYK5CPmkNih+WDSsS5tvPrJ8YMQYlEMvsZIiqmn7HdFUaeEQ==", + "requires": { + "browserslist": "^4.0.0", + "caniuse-api": "^3.0.0", + "cssnano-util-same-parent": "^4.0.0", + "postcss": "^7.0.0", + "postcss-selector-parser": "^3.0.0", + "vendors": "^1.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "requires": { + "dot-prop": "^4.1.1", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-minify-font-values": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-4.0.2.tgz", + "integrity": "sha512-j85oO6OnRU9zPf04+PZv1LYIYOprWm6IA6zkXkrJXyRveDEuQggG6tvoy8ir8ZwjLxLuGfNkCZEQG7zan+Hbtg==", + "requires": { + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-minify-gradients": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-4.0.2.tgz", + "integrity": "sha512-qKPfwlONdcf/AndP1U8SJ/uzIJtowHlMaSioKzebAXSG4iJthlWC9iSWznQcX4f66gIWX44RSA841HTHj3wK+Q==", + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "is-color-stop": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-minify-params": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz", + "integrity": "sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhPet/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg==", + "requires": { + "alphanum-sort": "^1.0.0", + "browserslist": "^4.0.0", + "cssnano-util-get-arguments": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0", + "uniqs": "^2.0.0" + } + }, + "postcss-minify-selectors": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-4.0.2.tgz", + "integrity": "sha512-D5S1iViljXBj9kflQo4YutWnJmwm8VvIsU1GeXJGiG9j8CIg9zs4voPMdQDUmIxetUOh60VilsNzCiAFTOqu3g==", + "requires": { + "alphanum-sort": "^1.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-selector-parser": "^3.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "requires": { + "dot-prop": "^4.1.1", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-modules-extract-imports": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz", + "integrity": "sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ==", + "requires": { + "postcss": "^7.0.5" + } + }, + "postcss-modules-local-by-default": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-2.0.6.tgz", + "integrity": "sha512-oLUV5YNkeIBa0yQl7EYnxMgy4N6noxmiwZStaEJUSe2xPMcdNc8WmBQuQCx18H5psYbVxz8zoHk0RAAYZXP9gA==", + "requires": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^6.0.0", + "postcss-value-parser": "^3.3.1" + } + }, + "postcss-modules-scope": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-2.1.1.tgz", + "integrity": "sha512-OXRUPecnHCg8b9xWvldG/jUpRIGPNRka0r4D4j0ESUU2/5IOnpsjfPPmDprM3Ih8CgZ8FXjWqaniK5v4rWt3oQ==", + "requires": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^6.0.0" + } + }, + "postcss-modules-values": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-2.0.0.tgz", + "integrity": "sha512-Ki7JZa7ff1N3EIMlPnGTZfUMe69FFwiQPnVSXC9mnn3jozCRBYIxiZd44yJOV2AmabOo4qFf8s0dC/+lweG7+w==", + "requires": { + "icss-replace-symbols": "^1.1.0", + "postcss": "^7.0.6" + } + }, + "postcss-nesting": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-nesting/-/postcss-nesting-7.0.1.tgz", + "integrity": "sha512-FrorPb0H3nuVq0Sff7W2rnc3SmIcruVC6YwpcS+k687VxyxO33iE1amna7wHuRVzM8vfiYofXSBHNAZ3QhLvYg==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-normalize": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize/-/postcss-normalize-7.0.1.tgz", + "integrity": "sha512-NOp1fwrG+6kVXWo7P9SizCHX6QvioxFD/hZcI2MLxPmVnFJFC0j0DDpIuNw2tUDeCFMni59gCVgeJ1/hYhj2OQ==", + "requires": { + "@csstools/normalize.css": "^9.0.1", + "browserslist": "^4.1.1", + "postcss": "^7.0.2", + "postcss-browser-comments": "^2.0.0" + } + }, + "postcss-normalize-charset": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-4.0.1.tgz", + "integrity": "sha512-gMXCrrlWh6G27U0hF3vNvR3w8I1s2wOBILvA87iNXaPvSNo5uZAMYsZG7XjCUf1eVxuPfyL4TJ7++SGZLc9A3g==", + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-normalize-display-values": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.2.tgz", + "integrity": "sha512-3F2jcsaMW7+VtRMAqf/3m4cPFhPD3EFRgNs18u+k3lTJJlVe7d0YPO+bnwqo2xg8YiRpDXJI2u8A0wqJxMsQuQ==", + "requires": { + "cssnano-util-get-match": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-normalize-positions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-4.0.2.tgz", + "integrity": "sha512-Dlf3/9AxpxE+NF1fJxYDeggi5WwV35MXGFnnoccP/9qDtFrTArZ0D0R+iKcg5WsUd8nUYMIl8yXDCtcrT8JrdA==", + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-normalize-repeat-style": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.2.tgz", + "integrity": "sha512-qvigdYYMpSuoFs3Is/f5nHdRLJN/ITA7huIoCyqqENJe9PvPmLhNLMu7QTjPdtnVf6OcYYO5SHonx4+fbJE1+Q==", + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "cssnano-util-get-match": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-normalize-string": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-4.0.2.tgz", + "integrity": "sha512-RrERod97Dnwqq49WNz8qo66ps0swYZDSb6rM57kN2J+aoyEAJfZ6bMx0sx/F9TIEX0xthPGCmeyiam/jXif0eA==", + "requires": { + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-normalize-timing-functions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.2.tgz", + "integrity": "sha512-acwJY95edP762e++00Ehq9L4sZCEcOPyaHwoaFOhIwWCDfik6YvqsYNxckee65JHLKzuNSSmAdxwD2Cud1Z54A==", + "requires": { + "cssnano-util-get-match": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-normalize-unicode": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.1.tgz", + "integrity": "sha512-od18Uq2wCYn+vZ/qCOeutvHjB5jm57ToxRaMeNuf0nWVHaP9Hua56QyMF6fs/4FSUnVIw0CBPsU0K4LnBPwYwg==", + "requires": { + "browserslist": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-normalize-url": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-4.0.1.tgz", + "integrity": "sha512-p5oVaF4+IHwu7VpMan/SSpmpYxcJMtkGppYf0VbdH5B6hN8YNmVyJLuY9FmLQTzY3fag5ESUUHDqM+heid0UVA==", + "requires": { + "is-absolute-url": "^2.0.0", + "normalize-url": "^3.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "normalize-url": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", + "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==" + } + } + }, + "postcss-normalize-whitespace": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.2.tgz", + "integrity": "sha512-tO8QIgrsI3p95r8fyqKV+ufKlSHh9hMJqACqbv2XknufqEDhDvbguXGBBqxw9nsQoXWf0qOqppziKJKHMD4GtA==", + "requires": { + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-ordered-values": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-4.1.2.tgz", + "integrity": "sha512-2fCObh5UanxvSxeXrtLtlwVThBvHn6MQcu4ksNT2tsaV2Fg76R2CV98W7wNSlX+5/pFwEyaDwKLLoEV7uRybAw==", + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-overflow-shorthand": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-overflow-shorthand/-/postcss-overflow-shorthand-2.0.0.tgz", + "integrity": "sha512-aK0fHc9CBNx8jbzMYhshZcEv8LtYnBIRYQD5i7w/K/wS9c2+0NSR6B3OVMu5y0hBHYLcMGjfU+dmWYNKH0I85g==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-page-break": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-page-break/-/postcss-page-break-2.0.0.tgz", + "integrity": "sha512-tkpTSrLpfLfD9HvgOlJuigLuk39wVTbbd8RKcy8/ugV2bNBUW3xU+AIqyxhDrQr1VUj1RmyJrBn1YWrqUm9zAQ==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-place": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-place/-/postcss-place-4.0.1.tgz", + "integrity": "sha512-Zb6byCSLkgRKLODj/5mQugyuj9bvAAw9LqJJjgwz5cYryGeXfFZfSXoP1UfveccFmeq0b/2xxwcTEVScnqGxBg==", + "requires": { + "postcss": "^7.0.2", + "postcss-values-parser": "^2.0.0" + } + }, + "postcss-preset-env": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/postcss-preset-env/-/postcss-preset-env-6.7.0.tgz", + "integrity": "sha512-eU4/K5xzSFwUFJ8hTdTQzo2RBLbDVt83QZrAvI07TULOkmyQlnYlpwep+2yIK+K+0KlZO4BvFcleOCCcUtwchg==", + "requires": { + "autoprefixer": "^9.6.1", + "browserslist": "^4.6.4", + "caniuse-lite": "^1.0.30000981", + "css-blank-pseudo": "^0.1.4", + "css-has-pseudo": "^0.10.0", + "css-prefers-color-scheme": "^3.1.1", + "cssdb": "^4.4.0", + "postcss": "^7.0.17", + "postcss-attribute-case-insensitive": "^4.0.1", + "postcss-color-functional-notation": "^2.0.1", + "postcss-color-gray": "^5.0.0", + "postcss-color-hex-alpha": "^5.0.3", + "postcss-color-mod-function": "^3.0.3", + "postcss-color-rebeccapurple": "^4.0.1", + "postcss-custom-media": "^7.0.8", + "postcss-custom-properties": "^8.0.11", + "postcss-custom-selectors": "^5.1.2", + "postcss-dir-pseudo-class": "^5.0.0", + "postcss-double-position-gradients": "^1.0.0", + "postcss-env-function": "^2.0.2", + "postcss-focus-visible": "^4.0.0", + "postcss-focus-within": "^3.0.0", + "postcss-font-variant": "^4.0.0", + "postcss-gap-properties": "^2.0.0", + "postcss-image-set-function": "^3.0.1", + "postcss-initial": "^3.0.0", + "postcss-lab-function": "^2.0.1", + "postcss-logical": "^3.0.0", + "postcss-media-minmax": "^4.0.0", + "postcss-nesting": "^7.0.0", + "postcss-overflow-shorthand": "^2.0.0", + "postcss-page-break": "^2.0.0", + "postcss-place": "^4.0.1", + "postcss-pseudo-class-any-link": "^6.0.0", + "postcss-replace-overflow-wrap": "^3.0.0", + "postcss-selector-matches": "^4.0.0", + "postcss-selector-not": "^4.0.0" + } + }, + "postcss-pseudo-class-any-link": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-pseudo-class-any-link/-/postcss-pseudo-class-any-link-6.0.0.tgz", + "integrity": "sha512-lgXW9sYJdLqtmw23otOzrtbDXofUdfYzNm4PIpNE322/swES3VU9XlXHeJS46zT2onFO7V1QFdD4Q9LiZj8mew==", + "requires": { + "postcss": "^7.0.2", + "postcss-selector-parser": "^5.0.0-rc.3" + }, + "dependencies": { + "cssesc": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz", + "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==" + }, + "postcss-selector-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz", + "integrity": "sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ==", + "requires": { + "cssesc": "^2.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-reduce-initial": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-4.0.3.tgz", + "integrity": "sha512-gKWmR5aUulSjbzOfD9AlJiHCGH6AEVLaM0AV+aSioxUDd16qXP1PCh8d1/BGVvpdWn8k/HiK7n6TjeoXN1F7DA==", + "requires": { + "browserslist": "^4.0.0", + "caniuse-api": "^3.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0" + } + }, + "postcss-reduce-transforms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.2.tgz", + "integrity": "sha512-EEVig1Q2QJ4ELpJXMZR8Vt5DQx8/mo+dGWSR7vWXqcob2gQLyQGsionYcGKATXvQzMPn6DSN1vTN7yFximdIAg==", + "requires": { + "cssnano-util-get-match": "^4.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + } + }, + "postcss-replace-overflow-wrap": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-replace-overflow-wrap/-/postcss-replace-overflow-wrap-3.0.0.tgz", + "integrity": "sha512-2T5hcEHArDT6X9+9dVSPQdo7QHzG4XKclFT8rU5TzJPDN7RIRTbO9c4drUISOVemLj03aezStHCR2AIcr8XLpw==", + "requires": { + "postcss": "^7.0.2" + } + }, + "postcss-safe-parser": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-4.0.1.tgz", + "integrity": "sha512-xZsFA3uX8MO3yAda03QrG3/Eg1LN3EPfjjf07vke/46HERLZyHrTsQ9E1r1w1W//fWEhtYNndo2hQplN2cVpCQ==", + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-selector-matches": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-matches/-/postcss-selector-matches-4.0.0.tgz", + "integrity": "sha512-LgsHwQR/EsRYSqlwdGzeaPKVT0Ml7LAT6E75T8W8xLJY62CE4S/l03BWIt3jT8Taq22kXP08s2SfTSzaraoPww==", + "requires": { + "balanced-match": "^1.0.0", + "postcss": "^7.0.2" + } + }, + "postcss-selector-not": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-selector-not/-/postcss-selector-not-4.0.0.tgz", + "integrity": "sha512-W+bkBZRhqJaYN8XAnbbZPLWMvZD1wKTu0UxtFKdhtGjWYmxhkUneoeOhRJKdAE5V7ZTlnbHfCR+6bNwK9e1dTQ==", + "requires": { + "balanced-match": "^1.0.0", + "postcss": "^7.0.2" + } + }, + "postcss-selector-parser": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz", + "integrity": "sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==", + "requires": { + "cssesc": "^3.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + }, + "postcss-svgo": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-4.0.2.tgz", + "integrity": "sha512-C6wyjo3VwFm0QgBy+Fu7gCYOkCmgmClghO+pjcxvrcBKtiKt0uCF+hvbMO1fyv5BMImRK90SMb+dwUnfbGd+jw==", + "requires": { + "is-svg": "^3.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0", + "svgo": "^1.0.0" + } + }, + "postcss-unique-selectors": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-4.0.1.tgz", + "integrity": "sha512-+JanVaryLo9QwZjKrmJgkI4Fn8SBgRO6WXQBJi7KiAVPlmxikB5Jzc4EvXMT2H0/m0RjrVVm9rGNhZddm/8Spg==", + "requires": { + "alphanum-sort": "^1.0.0", + "postcss": "^7.0.0", + "uniqs": "^2.0.0" + } + }, + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==" + }, + "postcss-values-parser": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/postcss-values-parser/-/postcss-values-parser-2.0.1.tgz", + "integrity": "sha512-2tLuBsA6P4rYTNKCXYG/71C7j1pU6pK503suYOmn4xYrQIzW+opD+7FAFNuGSdZC/3Qfy334QbeMu7MEb8gOxg==", + "requires": { + "flatten": "^1.0.2", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" + }, + "pretty-bytes": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.3.0.tgz", + "integrity": "sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg==" + }, + "pretty-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", + "integrity": "sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM=", + "requires": { + "renderkid": "^2.0.1", + "utila": "~0.4" + } + }, + "pretty-format": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz", + "integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==", + "requires": { + "@jest/types": "^24.9.0", + "ansi-regex": "^4.0.0", + "ansi-styles": "^3.2.0", + "react-is": "^16.8.4" + } + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + }, + "promise": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/promise/-/promise-8.0.3.tgz", + "integrity": "sha512-HeRDUL1RJiLhyA0/grn+PTShlBAcLuh/1BJGtrvjwbvRDCTLLMEz9rOGCV+R3vHY4MixIuoMEd9Yq/XvsTPcjw==", + "requires": { + "asap": "~2.0.6" + } + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=" + }, + "prompts": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.0.tgz", + "integrity": "sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg==", + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.3" + } + }, + "prop-types": { + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", + "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.8.1" + } + }, + "prop-types-exact": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/prop-types-exact/-/prop-types-exact-1.2.0.tgz", + "integrity": "sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA==", + "requires": { + "has": "^1.0.3", + "object.assign": "^4.1.0", + "reflect.ownkeys": "^0.2.0" + } + }, + "proxy-addr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", + "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.0" + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", + "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" + }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + }, + "dependencies": { + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "requires": { + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" + }, + "querystringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", + "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==" + }, + "raf": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "requires": { + "performance-now": "^2.1.0" + } + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dependencies": { + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + } + } + }, + "react": { + "version": "16.12.0", + "resolved": "https://registry.npmjs.org/react/-/react-16.12.0.tgz", + "integrity": "sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2" + } + }, + "react-app-polyfill": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-1.0.5.tgz", + "integrity": "sha512-RcbV6+msbvZJZUIK/LX3UafPtoaDSJgUWu4sqBxHKTVmBsnlU2QWCKJRBRmgjxu+ivW/GPINbPWRM4Ppa6Lbgw==", + "requires": { + "core-js": "^3.4.1", + "object-assign": "^4.1.1", + "promise": "^8.0.3", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.3", + "whatwg-fetch": "^3.0.0" + } + }, + "react-dev-utils": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-9.1.0.tgz", + "integrity": "sha512-X2KYF/lIGyGwP/F/oXgGDF24nxDA2KC4b7AFto+eqzc/t838gpSGiaU8trTqHXOohuLxxc5qi1eDzsl9ucPDpg==", + "requires": { + "@babel/code-frame": "7.5.5", + "address": "1.1.2", + "browserslist": "4.7.0", + "chalk": "2.4.2", + "cross-spawn": "6.0.5", + "detect-port-alt": "1.1.6", + "escape-string-regexp": "1.0.5", + "filesize": "3.6.1", + "find-up": "3.0.0", + "fork-ts-checker-webpack-plugin": "1.5.0", + "global-modules": "2.0.0", + "globby": "8.0.2", + "gzip-size": "5.1.1", + "immer": "1.10.0", + "inquirer": "6.5.0", + "is-root": "2.1.0", + "loader-utils": "1.2.3", + "open": "^6.3.0", + "pkg-up": "2.0.0", + "react-error-overlay": "^6.0.3", + "recursive-readdir": "2.2.2", + "shell-quote": "1.7.2", + "sockjs-client": "1.4.0", + "strip-ansi": "5.2.0", + "text-table": "0.2.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==" + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "browserslist": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.7.0.tgz", + "integrity": "sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA==", + "requires": { + "caniuse-lite": "^1.0.30000989", + "electron-to-chromium": "^1.3.247", + "node-releases": "^1.1.29" + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "inquirer": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.0.tgz", + "integrity": "sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA==", + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + } + } + }, + "react-dom": { + "version": "16.12.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.12.0.tgz", + "integrity": "sha512-LMxFfAGrcS3kETtQaCkTKjMiifahaMySFDn71fZUNpPHZQEzmk/GiAeIT8JSOrHB23fnuCOMruL2a8NYlw+8Gw==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2", + "scheduler": "^0.18.0" + } + }, + "react-error-overlay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.4.tgz", + "integrity": "sha512-ueZzLmHltszTshDMwyfELDq8zOA803wQ1ZuzCccXa1m57k1PxSHfflPD5W9YIiTXLs0JTLzoj6o1LuM5N6zzNA==" + }, + "react-is": { + "version": "16.12.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.12.0.tgz", + "integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==" + }, + "react-outside-click-handler": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/react-outside-click-handler/-/react-outside-click-handler-1.3.0.tgz", + "integrity": "sha512-Te/7zFU0oHpAnctl//pP3hEAeobfeHMyygHB8MnjP6sX5OR8KHT1G3jmLsV3U9RnIYo+Yn+peJYWu+D5tUS8qQ==", + "requires": { + "airbnb-prop-types": "^2.15.0", + "consolidated-events": "^1.1.1 || ^2.0.0", + "document.contains": "^1.0.1", + "object.values": "^1.1.0", + "prop-types": "^15.7.2" + } + }, + "react-redux": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.1.3.tgz", + "integrity": "sha512-uI1wca+ECG9RoVkWQFF4jDMqmaw0/qnvaSvOoL/GA4dNxf6LoV8sUAcNDvE5NWKs4hFpn0t6wswNQnY3f7HT3w==", + "requires": { + "@babel/runtime": "^7.5.5", + "hoist-non-react-statics": "^3.3.0", + "invariant": "^2.2.4", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-is": "^16.9.0" + } + }, + "react-scripts": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-3.2.0.tgz", + "integrity": "sha512-6LzuKbE2B4eFQG6i1FnTScn9HDcWBfXXnOwW9xKFPJ/E3rK8i1ufbOZ0ocKyRPxJAKdN7iqg3i7lt0+oxkSVOA==", + "requires": { + "@babel/core": "7.6.0", + "@svgr/webpack": "4.3.2", + "@typescript-eslint/eslint-plugin": "^2.2.0", + "@typescript-eslint/parser": "^2.2.0", + "babel-eslint": "10.0.3", + "babel-jest": "^24.9.0", + "babel-loader": "8.0.6", + "babel-plugin-named-asset-import": "^0.3.4", + "babel-preset-react-app": "^9.0.2", + "camelcase": "^5.2.0", + "case-sensitive-paths-webpack-plugin": "2.2.0", + "css-loader": "2.1.1", + "dotenv": "6.2.0", + "dotenv-expand": "5.1.0", + "eslint": "^6.1.0", + "eslint-config-react-app": "^5.0.2", + "eslint-loader": "3.0.2", + "eslint-plugin-flowtype": "3.13.0", + "eslint-plugin-import": "2.18.2", + "eslint-plugin-jsx-a11y": "6.2.3", + "eslint-plugin-react": "7.14.3", + "eslint-plugin-react-hooks": "^1.6.1", + "file-loader": "3.0.1", + "fs-extra": "7.0.1", + "fsevents": "2.0.7", + "html-webpack-plugin": "4.0.0-beta.5", + "identity-obj-proxy": "3.0.0", + "is-wsl": "^1.1.0", + "jest": "24.9.0", + "jest-environment-jsdom-fourteen": "0.1.0", + "jest-resolve": "24.9.0", + "jest-watch-typeahead": "0.4.0", + "mini-css-extract-plugin": "0.8.0", + "optimize-css-assets-webpack-plugin": "5.0.3", + "pnp-webpack-plugin": "1.5.0", + "postcss-flexbugs-fixes": "4.1.0", + "postcss-loader": "3.0.0", + "postcss-normalize": "7.0.1", + "postcss-preset-env": "6.7.0", + "postcss-safe-parser": "4.0.1", + "react-app-polyfill": "^1.0.4", + "react-dev-utils": "^9.1.0", + "resolve": "1.12.0", + "resolve-url-loader": "3.1.0", + "sass-loader": "7.2.0", + "semver": "6.3.0", + "style-loader": "1.0.0", + "terser-webpack-plugin": "1.4.1", + "ts-pnp": "1.1.4", + "url-loader": "2.1.0", + "webpack": "4.41.0", + "webpack-dev-server": "3.2.1", + "webpack-manifest-plugin": "2.1.1", + "workbox-webpack-plugin": "4.3.1" + } + }, + "react-spinners-kit": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/react-spinners-kit/-/react-spinners-kit-1.9.1.tgz", + "integrity": "sha512-QtAvSD7b1WkThY3pRKu6Sr+DZafnEufoOvug/uHprkKyZK6bg6TG5LC3Sy3JaRh6A/HACIcTNEWG+Ls0YDoSHg==", + "requires": { + "polished": "^1.9.3", + "prop-types": "^15.6.2", + "react": "^16.12.0", + "react-dom": "^16.12.0", + "styled-components": "^4.4.1" + } + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + }, + "readable-stream": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", + "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "realpath-native": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.1.0.tgz", + "integrity": "sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA==", + "requires": { + "util.promisify": "^1.0.0" + } + }, + "recursive-readdir": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", + "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==", + "requires": { + "minimatch": "3.0.4" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "redux": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz", + "integrity": "sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==", + "requires": { + "loose-envify": "^1.4.0", + "symbol-observable": "^1.2.0" + } + }, + "redux-thunk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz", + "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw==" + }, + "reflect.ownkeys": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz", + "integrity": "sha1-dJrO7H8/34tj+SegSAnpDFwLNGA=" + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==" + }, + "regenerate-unicode-properties": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz", + "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==", + "requires": { + "regenerate": "^1.4.0" + } + }, + "regenerator-runtime": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" + }, + "regenerator-transform": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.1.tgz", + "integrity": "sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ==", + "requires": { + "private": "^0.1.6" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regex-parser": { + "version": "2.2.10", + "resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.10.tgz", + "integrity": "sha512-8t6074A68gHfU8Neftl0Le6KTDwfGAj7IyjPIMSfikI2wJUTHDMaIq42bUsfVnj8mhx0R+45rdUXHGpN164avA==" + }, + "regexp.prototype.flags": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", + "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==" + }, + "regexpu-core": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.6.0.tgz", + "integrity": "sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg==", + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.1.0", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" + } + }, + "regjsgen": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.1.tgz", + "integrity": "sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg==" + }, + "regjsparser": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.2.tgz", + "integrity": "sha512-E9ghzUtoLwDekPT0DYCp+c4h+bvuUpe6rRHCTYn6eGoqj1LgKXxT6I0Il4WbjhQkOghzi/V+y03bPKvbllL93Q==", + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=" + } + } + }, + "relateurl": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=" + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" + }, + "renderkid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-2.0.3.tgz", + "integrity": "sha512-z8CLQp7EZBPCwCnncgf9C4XAi3WR0dv+uWu/PjIyhhAb5d6IJ/QZqlHFprHeKT+59//V6BNUsLbvN8+2LarxGA==", + "requires": { + "css-select": "^1.1.0", + "dom-converter": "^0.2", + "htmlparser2": "^3.3.0", + "strip-ansi": "^3.0.0", + "utila": "^0.4.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + } + } + }, + "request-promise-core": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", + "requires": { + "lodash": "^4.17.15" + } + }, + "request-promise-native": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", + "requires": { + "request-promise-core": "1.1.3", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + }, + "resolve-url-loader": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-3.1.0.tgz", + "integrity": "sha512-2QcrA+2QgVqsMJ1Hn5NnJXIGCX1clQ1F6QJTqOeiaDw9ACo1G2k+8/shq3mtqne03HOFyskAClqfxKyFBriXZg==", + "requires": { + "adjust-sourcemap-loader": "2.0.0", + "camelcase": "5.0.0", + "compose-function": "3.0.3", + "convert-source-map": "1.6.0", + "es6-iterator": "2.0.3", + "loader-utils": "1.2.3", + "postcss": "7.0.14", + "rework": "1.0.1", + "rework-visit": "1.0.0", + "source-map": "0.6.1" + }, + "dependencies": { + "camelcase": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", + "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==" + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "postcss": { + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.14.tgz", + "integrity": "sha512-NsbD6XUUMZvBxtQAJuWDJeeC4QFsmWsfozWxCJPWf3M55K9iu2iMDaKqyoOdTJ1R4usBXuxlVFAIo8rZPQD4Bg==", + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, + "rework": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rework/-/rework-1.0.1.tgz", + "integrity": "sha1-MIBqhBNCtUUQqkEQhQzUhTQUSqc=", + "requires": { + "convert-source-map": "^0.3.3", + "css": "^2.0.0" + }, + "dependencies": { + "convert-source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-0.3.5.tgz", + "integrity": "sha1-8dgClQr33SYxof6+BZZVDIarMZA=" + } + } + }, + "rework-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rework-visit/-/rework-visit-1.0.0.tgz", + "integrity": "sha1-mUWygD8hni96ygCtuLyfZA+ELJo=" + }, + "rgb-regex": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz", + "integrity": "sha1-wODWiC3w4jviVKR16O3UGRX+rrE=" + }, + "rgba-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rgba-regex/-/rgba-regex-1.0.0.tgz", + "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=" + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rsvp": { + "version": "4.8.5", + "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", + "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==" + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "requires": { + "is-promise": "^2.1.0" + } + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "requires": { + "aproba": "^1.1.1" + } + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sane": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", + "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", + "requires": { + "@cnakazawa/watch": "^1.0.3", + "anymatch": "^2.0.0", + "capture-exit": "^2.0.0", + "exec-sh": "^0.3.2", + "execa": "^1.0.0", + "fb-watchman": "^2.0.0", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "sass-graph": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz", + "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", + "dev": true, + "requires": { + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "^1.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", + "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.0" + } + }, + "yargs-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", + "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "dev": true, + "requires": { + "camelcase": "^3.0.0" + } + } + } + }, + "sass-loader": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-7.2.0.tgz", + "integrity": "sha512-h8yUWaWtsbuIiOCgR9fd9c2lRXZ2uG+h8Dzg/AGNj+Hg/3TO8+BBAW9mEP+mh8ei+qBKqSJ0F1FLlYjNBc61OA==", + "requires": { + "clone-deep": "^4.0.1", + "loader-utils": "^1.0.1", + "neo-async": "^2.5.0", + "pify": "^4.0.1", + "semver": "^5.5.0" + }, + "dependencies": { + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "requires": { + "kind-of": "^6.0.2" + } + } + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "saxes": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", + "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", + "requires": { + "xmlchars": "^2.1.1" + } + }, + "scheduler": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.18.0.tgz", + "integrity": "sha512-agTSHR1Nbfi6ulI0kYNK0203joW2Y5W4po4l+v03tOoiJKpTBbxpNhWDvqc/4IcOw+KLmSiQLTasZ4cab2/UWQ==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "scss-tokenizer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", + "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", + "dev": true, + "requires": { + "js-base64": "^2.1.8", + "source-map": "^0.4.2" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=" + }, + "selfsigned": { + "version": "1.10.7", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", + "integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==", + "requires": { + "node-forge": "0.9.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, + "serialize-javascript": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz", + "integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==" + }, + "serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + } + } + }, + "serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + }, + "setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shallow-clone": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-0.1.2.tgz", + "integrity": "sha1-WQnodLp3EG1zrEFM/sH/yofZcGA=", + "requires": { + "is-extendable": "^0.1.1", + "kind-of": "^2.0.1", + "lazy-cache": "^0.2.3", + "mixin-object": "^2.0.1" + }, + "dependencies": { + "kind-of": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-2.0.1.tgz", + "integrity": "sha1-AY7HpM5+OobLkUG+UZ0kyPqpgbU=", + "requires": { + "is-buffer": "^1.0.2" + } + }, + "lazy-cache": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.7.tgz", + "integrity": "sha1-f+3fLctu23fRHvHRF6tf/fCrG2U=" + } + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "shell-quote": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", + "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==" + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + } + } + }, + "sisteransi": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.4.tgz", + "integrity": "sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig==" + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==" + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + } + } + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "requires": { + "kind-of": "^3.2.0" + } + }, + "sockjs": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.19.tgz", + "integrity": "sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw==", + "requires": { + "faye-websocket": "^0.10.0", + "uuid": "^3.0.1" + }, + "dependencies": { + "faye-websocket": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", + "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", + "requires": { + "websocket-driver": ">=0.5.1" + } + } + } + }, + "sockjs-client": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.4.0.tgz", + "integrity": "sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g==", + "requires": { + "debug": "^3.2.5", + "eventsource": "^1.0.7", + "faye-websocket": "~0.11.1", + "inherits": "^2.0.3", + "json3": "^3.3.2", + "url-parse": "^1.4.3" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "requires": { + "is-plain-obj": "^1.0.0" + } + }, + "source-list-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==" + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "source-map-resolve": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==" + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==" + }, + "spdy": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.1.tgz", + "integrity": "sha512-HeZS3PBdMA+sZSu0qwpCxl3DeALD5ASx8pAX0jZdKXSpPWbQ6SYGnlg3BBmYLx5LtiZrmkAZfErCm2oECBcioA==", + "requires": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "requires": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "requires": { + "figgy-pudding": "^3.5.1" + } + }, + "stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==" + }, + "stack-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", + "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==" + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "stdout-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", + "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + }, + "stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "stream-each": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "stream-shift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "string-length": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "requires": { + "astral-regex": "^1.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "string.prototype.trimleft": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz", + "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==", + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimright": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz", + "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==", + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "stringify-object": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", + "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==", + "requires": { + "get-own-enumerable-property-symbols": "^3.0.0", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "strip-comments": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/strip-comments/-/strip-comments-1.0.2.tgz", + "integrity": "sha512-kL97alc47hoyIQSV165tTt9rG5dn4w1dNnBhOQ3bOU1Nc1hel09jnXANaHJ7vzHLd4Ju8kseDGzlev96pghLFw==", + "requires": { + "babel-extract-comments": "^1.0.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==" + }, + "style-loader": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-1.0.0.tgz", + "integrity": "sha512-B0dOCFwv7/eY31a5PCieNwMgMhVGFe9w+rh7s/Bx8kfFkrth9zfTZquoYvdw8URgiqxObQKcpW51Ugz1HjfdZw==", + "requires": { + "loader-utils": "^1.2.3", + "schema-utils": "^2.0.1" + }, + "dependencies": { + "schema-utils": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.6.4.tgz", + "integrity": "sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ==", + "requires": { + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1" + } + } + } + }, + "styled-components": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-4.4.1.tgz", + "integrity": "sha512-RNqj14kYzw++6Sr38n7197xG33ipEOktGElty4I70IKzQF1jzaD1U4xQ+Ny/i03UUhHlC5NWEO+d8olRCDji6g==", + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@emotion/is-prop-valid": "^0.8.1", + "@emotion/unitless": "^0.7.0", + "babel-plugin-styled-components": ">= 1", + "css-to-react-native": "^2.2.2", + "memoize-one": "^5.0.0", + "merge-anything": "^2.2.4", + "prop-types": "^15.5.4", + "react-is": "^16.6.0", + "stylis": "^3.5.0", + "stylis-rule-sheet": "^0.0.10", + "supports-color": "^5.5.0" + } + }, + "stylehacks": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", + "integrity": "sha512-7GlLk9JwlElY4Y6a/rmbH2MhVlTyVmiJd1PfTCqFaIBEGMYNsrO/v3SeGTdhBThLg4Z+NbOk/qFMwCa+J+3p/g==", + "requires": { + "browserslist": "^4.0.0", + "postcss": "^7.0.0", + "postcss-selector-parser": "^3.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "requires": { + "dot-prop": "^4.1.1", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "stylis": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.4.tgz", + "integrity": "sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q==" + }, + "stylis-rule-sheet": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz", + "integrity": "sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "svg-parser": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/svg-parser/-/svg-parser-2.0.3.tgz", + "integrity": "sha512-fnCWiifNhK8i2Z7b9R5tbNahpxrRdAaQbnoxKlT2KrSCj9Kq/yBSgulCRgBJRhy1dPnSY5slg5ehPUnzpEcHlg==" + }, + "svgo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz", + "integrity": "sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw==", + "requires": { + "chalk": "^2.4.1", + "coa": "^2.0.2", + "css-select": "^2.0.0", + "css-select-base-adapter": "^0.1.1", + "css-tree": "1.0.0-alpha.37", + "csso": "^4.0.2", + "js-yaml": "^3.13.1", + "mkdirp": "~0.5.1", + "object.values": "^1.1.0", + "sax": "~1.2.4", + "stable": "^0.1.8", + "unquote": "~1.1.1", + "util.promisify": "~1.0.0" + } + }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" + }, + "symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" + }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "tapable": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", + "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==" + }, + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, + "terser": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.6.3.tgz", + "integrity": "sha512-Lw+ieAXmY69d09IIc/yqeBqXpEQIpDGZqT34ui1QWXIUpR2RjbqEkT8X7Lgex19hslSqcWM5iMN2kM11eMsESQ==", + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "terser-webpack-plugin": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz", + "integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==", + "requires": { + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^1.7.0", + "source-map": "^0.6.1", + "terser": "^4.1.2", + "webpack-sources": "^1.4.0", + "worker-farm": "^1.7.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "requires": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" + }, + "throat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=" + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "thunky": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" + }, + "timers-browserify": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", + "integrity": "sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ==", + "requires": { + "setimmediate": "^1.0.4" + } + }, + "timsort": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", + "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "tmpl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=" + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "requires": { + "kind-of": "^3.0.2" + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "^2.1.0" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "true-case-path": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", + "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", + "dev": true, + "requires": { + "glob": "^7.1.2" + } + }, + "ts-pnp": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.4.tgz", + "integrity": "sha512-1J/vefLC+BWSo+qe8OnJQfWTYRS6ingxjwqmHMqaMxXMj7kFtKLgAaYW3JeX3mktjgUL+etlU8/B4VUAUI9QGw==" + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "requires": { + "tslib": "^1.8.1" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==" + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "typescript": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz", + "integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==" + }, + "uglify-js": { + "version": "3.4.10", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.10.tgz", + "integrity": "sha512-Y2VsbPVs0FIshJztycsO2SfPk7/KAF/T72qzv9u5EpQ4kB2hQoHlhNQTsNyy6ul7lQtqJN/AoWeS23OzEiEFxw==", + "requires": { + "commander": "~2.19.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==" + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "requires": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz", + "integrity": "sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==" + }, + "unicode-property-aliases-ecmascript": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz", + "integrity": "sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw==" + }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=" + }, + "uniqs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=" + }, + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "unquote": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", + "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=" + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + } + } + }, + "upath": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==" + }, + "upper-case": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", + "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=" + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + } + } + }, + "url-loader": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-2.1.0.tgz", + "integrity": "sha512-kVrp/8VfEm5fUt+fl2E0FQyrpmOYgMEkBsv8+UDP1wFhszECq5JyGF33I7cajlVY90zRZ6MyfgKXngLvHYZX8A==", + "requires": { + "loader-utils": "^1.2.3", + "mime": "^2.4.4", + "schema-utils": "^2.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.6.4.tgz", + "integrity": "sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ==", + "requires": { + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1" + } + } + } + }, + "url-parse": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", + "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "requires": { + "inherits": "2.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "util.promisify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", + "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.2", + "has-symbols": "^1.0.1", + "object.getownpropertydescriptors": "^2.1.0" + } + }, + "utila": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", + "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "vendors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.3.tgz", + "integrity": "sha512-fOi47nsJP5Wqefa43kyWSg80qF+Q3XA6MUkgi7Hp1HQaKDQW4cQrK2D0P7mmbFtsV1N89am55Yru/nyEwRubcw==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vm-browserify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" + }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "requires": { + "browser-process-hrtime": "^0.1.2" + } + }, + "w3c-xmlserializer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", + "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", + "requires": { + "domexception": "^1.0.1", + "webidl-conversions": "^4.0.2", + "xml-name-validator": "^3.0.0" + } + }, + "walker": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "requires": { + "makeerror": "1.0.x" + } + }, + "watchpack": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", + "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "requires": { + "chokidar": "^2.0.2", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0" + } + }, + "wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "webpack": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.41.0.tgz", + "integrity": "sha512-yNV98U4r7wX1VJAj5kyMsu36T8RPPQntcb5fJLOsMz/pt/WrKC0Vp1bAlqPLkA1LegSwQwf6P+kAbyhRKVQ72g==", + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-module-context": "1.8.5", + "@webassemblyjs/wasm-edit": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5", + "acorn": "^6.2.1", + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^4.1.0", + "eslint-scope": "^4.0.3", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^2.4.0", + "loader-utils": "^1.2.3", + "memory-fs": "^0.4.1", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.1", + "neo-async": "^2.6.1", + "node-libs-browser": "^2.2.1", + "schema-utils": "^1.0.0", + "tapable": "^1.1.3", + "terser-webpack-plugin": "^1.4.1", + "watchpack": "^1.6.0", + "webpack-sources": "^1.4.1" + }, + "dependencies": { + "acorn": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", + "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==" + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "webpack-dev-middleware": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz", + "integrity": "sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw==", + "requires": { + "memory-fs": "^0.4.1", + "mime": "^2.4.4", + "mkdirp": "^0.5.1", + "range-parser": "^1.2.1", + "webpack-log": "^2.0.0" + } + }, + "webpack-dev-server": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.2.1.tgz", + "integrity": "sha512-sjuE4mnmx6JOh9kvSbPYw3u/6uxCLHNWfhWaIPwcXWsvWOPN+nc5baq4i9jui3oOBRXGonK9+OI0jVkaz6/rCw==", + "requires": { + "ansi-html": "0.0.7", + "bonjour": "^3.5.0", + "chokidar": "^2.0.0", + "compression": "^1.5.2", + "connect-history-api-fallback": "^1.3.0", + "debug": "^4.1.1", + "del": "^3.0.0", + "express": "^4.16.2", + "html-entities": "^1.2.0", + "http-proxy-middleware": "^0.19.1", + "import-local": "^2.0.0", + "internal-ip": "^4.2.0", + "ip": "^1.1.5", + "killable": "^1.0.0", + "loglevel": "^1.4.1", + "opn": "^5.1.0", + "portfinder": "^1.0.9", + "schema-utils": "^1.0.0", + "selfsigned": "^1.9.1", + "semver": "^5.6.0", + "serve-index": "^1.7.2", + "sockjs": "0.3.19", + "sockjs-client": "1.3.0", + "spdy": "^4.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^6.1.0", + "url": "^0.11.0", + "webpack-dev-middleware": "^3.5.1", + "webpack-log": "^2.0.0", + "yargs": "12.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "decamelize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "requires": { + "xregexp": "4.0.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" + }, + "http-proxy-middleware": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz", + "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==", + "requires": { + "http-proxy": "^1.17.0", + "is-glob": "^4.0.0", + "lodash": "^4.17.11", + "micromatch": "^3.1.10" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "sockjs-client": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.3.0.tgz", + "integrity": "sha512-R9jxEzhnnrdxLCNln0xg5uGHqMnkhPSTzUZH2eXcR03S/On9Yvoq2wyUZILRUhZCNVu2PmwWVoyuiPz8th8zbg==", + "requires": { + "debug": "^3.2.5", + "eventsource": "^1.0.7", + "faye-websocket": "~0.11.1", + "inherits": "^2.0.3", + "json3": "^3.3.2", + "url-parse": "^1.4.3" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "yargs": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", + "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", + "requires": { + "cliui": "^4.0.0", + "decamelize": "^2.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^10.1.0" + } + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "webpack-log": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz", + "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==", + "requires": { + "ansi-colors": "^3.0.0", + "uuid": "^3.3.2" + } + }, + "webpack-manifest-plugin": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/webpack-manifest-plugin/-/webpack-manifest-plugin-2.1.1.tgz", + "integrity": "sha512-2zqJ6mvc3yoiqfDjghAIpljhLSDh/G7vqGrzYcYqqRCd/ZZZCAuc/YPE5xG0LGpLgDJRhUNV1H+znyyhIxahzA==", + "requires": { + "fs-extra": "^7.0.0", + "lodash": ">=3.5 <5", + "object.entries": "^1.1.0", + "tapable": "^1.0.0" + } + }, + "webpack-sources": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", + "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "websocket-driver": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.3.tgz", + "integrity": "sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg==", + "requires": { + "http-parser-js": ">=0.4.0 <0.4.11", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", + "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==" + }, + "whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", + "requires": { + "iconv-lite": "0.4.24" + } + }, + "whatwg-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", + "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + }, + "whatwg-mimetype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" + }, + "whatwg-url": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", + "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + }, + "workbox-background-sync": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-background-sync/-/workbox-background-sync-4.3.1.tgz", + "integrity": "sha512-1uFkvU8JXi7L7fCHVBEEnc3asPpiAL33kO495UMcD5+arew9IbKW2rV5lpzhoWcm/qhGB89YfO4PmB/0hQwPRg==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-broadcast-update": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-broadcast-update/-/workbox-broadcast-update-4.3.1.tgz", + "integrity": "sha512-MTSfgzIljpKLTBPROo4IpKjESD86pPFlZwlvVG32Kb70hW+aob4Jxpblud8EhNb1/L5m43DUM4q7C+W6eQMMbA==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-build": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-build/-/workbox-build-4.3.1.tgz", + "integrity": "sha512-UHdwrN3FrDvicM3AqJS/J07X0KXj67R8Cg0waq1MKEOqzo89ap6zh6LmaLnRAjpB+bDIz+7OlPye9iii9KBnxw==", + "requires": { + "@babel/runtime": "^7.3.4", + "@hapi/joi": "^15.0.0", + "common-tags": "^1.8.0", + "fs-extra": "^4.0.2", + "glob": "^7.1.3", + "lodash.template": "^4.4.0", + "pretty-bytes": "^5.1.0", + "stringify-object": "^3.3.0", + "strip-comments": "^1.0.2", + "workbox-background-sync": "^4.3.1", + "workbox-broadcast-update": "^4.3.1", + "workbox-cacheable-response": "^4.3.1", + "workbox-core": "^4.3.1", + "workbox-expiration": "^4.3.1", + "workbox-google-analytics": "^4.3.1", + "workbox-navigation-preload": "^4.3.1", + "workbox-precaching": "^4.3.1", + "workbox-range-requests": "^4.3.1", + "workbox-routing": "^4.3.1", + "workbox-strategies": "^4.3.1", + "workbox-streams": "^4.3.1", + "workbox-sw": "^4.3.1", + "workbox-window": "^4.3.1" + }, + "dependencies": { + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } + } + }, + "workbox-cacheable-response": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-cacheable-response/-/workbox-cacheable-response-4.3.1.tgz", + "integrity": "sha512-Rp5qlzm6z8IOvnQNkCdO9qrDgDpoPNguovs0H8C+wswLuPgSzSp9p2afb5maUt9R1uTIwOXrVQMmPfPypv+npw==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-core": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-core/-/workbox-core-4.3.1.tgz", + "integrity": "sha512-I3C9jlLmMKPxAC1t0ExCq+QoAMd0vAAHULEgRZ7kieCdUd919n53WC0AfvokHNwqRhGn+tIIj7vcb5duCjs2Kg==" + }, + "workbox-expiration": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-expiration/-/workbox-expiration-4.3.1.tgz", + "integrity": "sha512-vsJLhgQsQouv9m0rpbXubT5jw0jMQdjpkum0uT+d9tTwhXcEZks7qLfQ9dGSaufTD2eimxbUOJfWLbNQpIDMPw==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-google-analytics": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-google-analytics/-/workbox-google-analytics-4.3.1.tgz", + "integrity": "sha512-xzCjAoKuOb55CBSwQrbyWBKqp35yg1vw9ohIlU2wTy06ZrYfJ8rKochb1MSGlnoBfXGWss3UPzxR5QL5guIFdg==", + "requires": { + "workbox-background-sync": "^4.3.1", + "workbox-core": "^4.3.1", + "workbox-routing": "^4.3.1", + "workbox-strategies": "^4.3.1" + } + }, + "workbox-navigation-preload": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-navigation-preload/-/workbox-navigation-preload-4.3.1.tgz", + "integrity": "sha512-K076n3oFHYp16/C+F8CwrRqD25GitA6Rkd6+qAmLmMv1QHPI2jfDwYqrytOfKfYq42bYtW8Pr21ejZX7GvALOw==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-precaching": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-precaching/-/workbox-precaching-4.3.1.tgz", + "integrity": "sha512-piSg/2csPoIi/vPpp48t1q5JLYjMkmg5gsXBQkh/QYapCdVwwmKlU9mHdmy52KsDGIjVaqEUMFvEzn2LRaigqQ==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-range-requests": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-range-requests/-/workbox-range-requests-4.3.1.tgz", + "integrity": "sha512-S+HhL9+iTFypJZ/yQSl/x2Bf5pWnbXdd3j57xnb0V60FW1LVn9LRZkPtneODklzYuFZv7qK6riZ5BNyc0R0jZA==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-routing": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-routing/-/workbox-routing-4.3.1.tgz", + "integrity": "sha512-FkbtrODA4Imsi0p7TW9u9MXuQ5P4pVs1sWHK4dJMMChVROsbEltuE79fBoIk/BCztvOJ7yUpErMKa4z3uQLX+g==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-strategies": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-strategies/-/workbox-strategies-4.3.1.tgz", + "integrity": "sha512-F/+E57BmVG8dX6dCCopBlkDvvhg/zj6VDs0PigYwSN23L8hseSRwljrceU2WzTvk/+BSYICsWmRq5qHS2UYzhw==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-streams": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-streams/-/workbox-streams-4.3.1.tgz", + "integrity": "sha512-4Kisis1f/y0ihf4l3u/+ndMkJkIT4/6UOacU3A4BwZSAC9pQ9vSvJpIi/WFGQRH/uPXvuVjF5c2RfIPQFSS2uA==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "workbox-sw": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-sw/-/workbox-sw-4.3.1.tgz", + "integrity": "sha512-0jXdusCL2uC5gM3yYFT6QMBzKfBr2XTk0g5TPAV4y8IZDyVNDyj1a8uSXy3/XrvkVTmQvLN4O5k3JawGReXr9w==" + }, + "workbox-webpack-plugin": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-webpack-plugin/-/workbox-webpack-plugin-4.3.1.tgz", + "integrity": "sha512-gJ9jd8Mb8wHLbRz9ZvGN57IAmknOipD3W4XNE/Lk/4lqs5Htw4WOQgakQy/o/4CoXQlMCYldaqUg+EJ35l9MEQ==", + "requires": { + "@babel/runtime": "^7.0.0", + "json-stable-stringify": "^1.0.1", + "workbox-build": "^4.3.1" + } + }, + "workbox-window": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/workbox-window/-/workbox-window-4.3.1.tgz", + "integrity": "sha512-C5gWKh6I58w3GeSc0wp2Ne+rqVw8qwcmZnQGpjiek8A2wpbxSJb1FdCoQVO+jDJs35bFgo/WETgl1fqgsxN0Hg==", + "requires": { + "workbox-core": "^4.3.1" + } + }, + "worker-farm": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", + "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==", + "requires": { + "errno": "~0.1.7" + } + }, + "worker-rpc": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/worker-rpc/-/worker-rpc-0.1.1.tgz", + "integrity": "sha512-P1WjMrUB3qgJNI9jfmpZ/htmBEjFh//6l/5y8SD9hg1Ef5zTTVVoRjTrTEzPrNBQvmhMxkoTsjOXN10GWU7aCg==", + "requires": { + "microevent.ts": "~0.1.1" + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "requires": { + "mkdirp": "^0.5.1" + } + }, + "write-file-atomic": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.1.tgz", + "integrity": "sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg==", + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" + }, + "xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" + }, + "xregexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", + "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yaml": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.7.2.tgz", + "integrity": "sha512-qXROVp90sb83XtAoqE8bP9RwAkTTZbugRUTm5YeFCBfNRPEp2YzTeqWiz7m5OORHzEvrA/qcGS8hp/E+MMROYw==", + "requires": { + "@babel/runtime": "^7.6.3" + } + }, + "yamljs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", + "integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "glob": "^7.0.5" + } + }, + "yargs": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } +} diff --git a/tools/webide/packages/client/package.json b/tools/webide/packages/client/package.json new file mode 100644 index 000000000..457ee3139 --- /dev/null +++ b/tools/webide/packages/client/package.json @@ -0,0 +1,61 @@ +{ + "name": "client", + "version": "0.1.0", + "private": true, + "dependencies": { + "@fortawesome/fontawesome-svg-core": "^1.2.25", + "@fortawesome/free-solid-svg-icons": "^5.11.2", + "@fortawesome/react-fontawesome": "^0.1.6", + "@taquito/taquito": "^5.1.0-beta.1", + "@taquito/tezbridge-signer": "^5.1.0-beta.1", + "@types/jest": "24.0.18", + "@types/node": "12.7.12", + "@types/react": "16.9.5", + "@types/react-dom": "16.9.1", + "@types/react-outside-click-handler": "^1.2.0", + "axios": "^0.19.0", + "http-proxy-middleware": "^0.20.0", + "monaco-editor": "npm:@ligolang/monaco-editor@0.18.1", + "react": "^16.10.2", + "react-dom": "^16.10.2", + "react-outside-click-handler": "^1.3.0", + "react-redux": "^7.1.1", + "react-scripts": "3.2.0", + "react-spinners-kit": "^1.9.0", + "redux": "^4.0.4", + "redux-devtools": "^3.5.0", + "redux-thunk": "^2.3.0", + "styled-components": "^4.4.0", + "typescript": "3.6.4" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "postbuild": "node package-examples.js", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "devDependencies": { + "@types/glob": "^7.1.1", + "@types/react-redux": "^7.1.4", + "@types/styled-components": "^4.1.19", + "glob": "^7.1.6", + "node-sass": "^4.12.0", + "yamljs": "^0.3.0" + } +} diff --git a/tools/webide/packages/client/public/index.html b/tools/webide/packages/client/public/index.html new file mode 100644 index 000000000..1ac8ec87b --- /dev/null +++ b/tools/webide/packages/client/public/index.html @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + LIGO Playground + + + +
+ + + diff --git a/tools/webide/packages/client/public/logo.svg b/tools/webide/packages/client/public/logo.svg new file mode 100644 index 000000000..53cd25eeb --- /dev/null +++ b/tools/webide/packages/client/public/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tools/webide/packages/client/public/manifest.json b/tools/webide/packages/client/public/manifest.json new file mode 100644 index 000000000..a20852d60 --- /dev/null +++ b/tools/webide/packages/client/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "LIGO Playground", + "name": "The LIGO Playground for learning LIGO", + "icons": [ + { + "src": "logo.svg", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/svg+xml" + }, + { + "src": "logo.svg", + "type": "image/svg+xml", + "sizes": "192x192" + }, + { + "src": "logo.svg", + "type": "image/svg+xml", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/tools/webide/packages/client/public/robots.txt b/tools/webide/packages/client/public/robots.txt new file mode 100644 index 000000000..01b0f9a10 --- /dev/null +++ b/tools/webide/packages/client/public/robots.txt @@ -0,0 +1,2 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * diff --git a/tools/webide/packages/client/src/App.test.tsx b/tools/webide/packages/client/src/App.test.tsx new file mode 100644 index 000000000..a754b201b --- /dev/null +++ b/tools/webide/packages/client/src/App.test.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; + +it('renders without crashing', () => { + const div = document.createElement('div'); + ReactDOM.render(, div); + ReactDOM.unmountComponentAtNode(div); +}); diff --git a/tools/webide/packages/client/src/App.tsx b/tools/webide/packages/client/src/App.tsx new file mode 100644 index 000000000..fb269a6ee --- /dev/null +++ b/tools/webide/packages/client/src/App.tsx @@ -0,0 +1,55 @@ +import React from 'react'; +import { Provider } from 'react-redux'; +import styled from 'styled-components'; + +import { EditorComponent } from './components/editor'; +import { Examples } from './components/examples'; +import { FloatButtonComponent } from './components/float-button'; +import { HeaderComponent } from './components/header'; +import { TabsPanelComponent } from './components/tabs-panel'; +import configureStore from './configure-store'; + +const store = configureStore(); + +const Container = styled.div` + display: flex; + padding: 0.5em 1em; +`; + +const FeedbackContainer = styled.div` + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-end; + + right: 1em; + bottom: 1em; + position: absolute; +`; + +const App: React.FC = () => { + return ( + + + + + + + + + + + + + ); +}; + +export default App; diff --git a/tools/webide/packages/client/src/components/checkbox.tsx b/tools/webide/packages/client/src/components/checkbox.tsx new file mode 100644 index 000000000..8f69ddaa0 --- /dev/null +++ b/tools/webide/packages/client/src/components/checkbox.tsx @@ -0,0 +1,58 @@ +import { faCheck } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useState } from 'react'; +import styled, { css } from 'styled-components'; + +const Container = styled.div<{ checked: boolean }>` + display: flex; + justify-content: center; + align-items: center; + + height: 2.5em; + width: 2.5em; + background: var(--blue_trans2); + + cursor: pointer; +`; + +const CheckIcon = ({ visible, ...props }: { visible: boolean }) => ( + +); + +const Check = styled(CheckIcon)` + pointer-events: none; + opacity: 1; + transform: scale(1); + transition: transform 0.2s ease-in; + color: var(--orange); + + ${props => + !props.visible && + css` + transition: scale(1); + opacity: 0; + `} +`; + +export const CheckboxComponent = (props: { + checked: boolean; + onChanged: (value: boolean) => void; + className?: string; +}) => { + const [isChecked, setChecked] = useState(props.checked); + + return ( + { + const newState = !isChecked; + + setChecked(newState); + props.onChanged(newState); + }} + > + + + ); +}; diff --git a/tools/webide/packages/client/src/components/command-select.tsx b/tools/webide/packages/client/src/components/command-select.tsx new file mode 100644 index 000000000..767063858 --- /dev/null +++ b/tools/webide/packages/client/src/components/command-select.tsx @@ -0,0 +1,146 @@ +import { faCaretDown } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useState } from 'react'; +import OutsideClickHandler from 'react-outside-click-handler'; +import styled, { css } from 'styled-components'; + +import { Command } from '../redux/types'; + +const Container = styled.div` + flex: 2; + display: flex; + position: relative; + min-width: 8em; + z-index: 2; +`; + +const Header = styled.div` + cursor: pointer; + user-select: none; + + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + min-height: 2em; + padding: 0 0.5em; + + border: 1px solid var(--blue_trans1); +`; + +const ArrowIcon = ({ rotate, ...props }: { rotate: boolean }) => ( + +); + +const Arrow = styled(ArrowIcon)` + pointer-events: none; + color: var(--blue_trans1); + transition: transform 0.15s ease-in; + + ${(props: { rotate: boolean }) => + props.rotate && + css` + transform: rotate(180deg); + `}; +`; + +const List = styled.ul` + position: absolute; + list-style-type: none; + background-color: white; + width: 100%; + margin: 0; + padding: 0; + box-shadow: 1px 3px 10px 0px rgba(153, 153, 153, 0.4); + border-radius: 3px; + + visibility: hidden; + opacity: 0; + transition: opacity 0.15s ease-in; + + ${(props: { visible: boolean }) => + props.visible && + css` + visibility: visible; + opacity: 1; + `} +`; + +const Option = styled.li` + cursor: pointer; + user-select: none; + + display: flex; + align-items: center; + justify-content: space-between; + height: 2em; + padding: 0 0.5em; + + &:first-child { + border-radius: 3px 3px 0 0; + } + + &:last-child { + border-radius: 0 0 3px 3px; + } + + &:hover { + background-color: var(--blue_trans2); + font-weight: 600; + } +`; + +export const CommandSelectComponent = (props: { + selected: Command; + onChange?: (value: Command) => void; +}) => { + const OPTIONS = { + [Command.Compile]: 'Compile', + [Command.Deploy]: 'Deploy', + [Command.DryRun]: 'Dry Run', + [Command.EvaluateFunction]: 'Evaluate Function', + [Command.EvaluateValue]: 'Evaluate Value' + }; + + const moveOptionToTop = (option: Command) => { + return Object.keys(OPTIONS).reduce((list, entry) => { + if (entry === option) { + list.unshift(entry); + } else { + list.push(entry as Command); + } + return list; + }, [] as Command[]); + }; + + const [opened, open] = useState(false); + + const selectOption = (option: Command) => { + if (props.selected !== option && props.onChange) { + props.onChange(option); + } + open(false); + }; + + return ( + + open(false)}> + + {moveOptionToTop(props.selected).map(option => ( + + ))} + + +
open(true)}> + {OPTIONS[props.selected]} + +
+
+ ); +}; diff --git a/tools/webide/packages/client/src/components/compile-pane.tsx b/tools/webide/packages/client/src/components/compile-pane.tsx new file mode 100644 index 000000000..cd938c0b3 --- /dev/null +++ b/tools/webide/packages/client/src/components/compile-pane.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import styled from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeEntrypointAction, CompileState } from '../redux/compile'; +import { Group, Input, Label } from './inputs'; + +const Container = styled.div``; + +export const CompilePaneComponent = () => { + const dispatch = useDispatch(); + const entrypoint = useSelector( + state => state.compile.entrypoint + ); + + return ( + + + + + dispatch({ ...new ChangeEntrypointAction(ev.target.value) }) + } + > + + + ); +}; diff --git a/tools/webide/packages/client/src/components/configure-tab.tsx b/tools/webide/packages/client/src/components/configure-tab.tsx new file mode 100644 index 000000000..160297861 --- /dev/null +++ b/tools/webide/packages/client/src/components/configure-tab.tsx @@ -0,0 +1,142 @@ +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import styled, { css } from 'styled-components'; + +import { CompileAction } from '../redux/actions/compile'; +import { DeployAction } from '../redux/actions/deploy'; +import { DryRunAction } from '../redux/actions/dry-run'; +import { EvaluateFunctionAction } from '../redux/actions/evaluate-function'; +import { EvaluateValueAction } from '../redux/actions/evaluate-value'; +import { AppState } from '../redux/app'; +import { ChangeDispatchedAction, ChangeSelectedAction, CommandState } from '../redux/command'; +import { Command } from '../redux/types'; +import { CommandSelectComponent } from './command-select'; +import { CompilePaneComponent } from './compile-pane'; +import { DeployPaneComponent } from './deploy-pane'; +import { DryRunPaneComponent } from './dry-run-pane'; +import { EvaluateFunctionPaneComponent } from './evaluate-function-pane'; +import { EvaluateValuePaneComponent } from './evaluate-value-pane'; + +const Container = styled.div<{ visible?: boolean }>` + position: absolute; + box-sizing: border-box; + width: 100%; + height: 100%; + padding: 1em 1em 0 1em; + + display: flex; + flex-direction: column; + + transform: translateX(-100%); + transition: transform 0.2s ease-in; + + ${props => + props.visible && + css` + transform: translateX(0px); + `} +`; + +const CommonActionsGroup = styled.div` + display: flex; + align-items: center; +`; + +const RunButton = styled.div` + cursor: pointer; + user-select: none; + + display: flex; + justify-content: center; + align-items: center; + flex: 1; + min-height: 2em; + min-width: 3em; + margin-left: 1em; + + color: white; + background-color: var(--orange); +`; + +const CommandPaneContainer = styled.div` + padding-top: 1em; +`; + +function createAction(command: Command) { + switch (command) { + case Command.Compile: + return new CompileAction(); + case Command.DryRun: + return new DryRunAction(); + case Command.Deploy: + return new DeployAction(); + case Command.EvaluateValue: + return new EvaluateValueAction(); + case Command.EvaluateFunction: + return new EvaluateFunctionAction(); + default: + throw new Error('Unsupported command'); + } +} + +export const ConfigureTabComponent = (props: { + selected?: boolean; + onRun?: () => void; +}) => { + const dispatchedAction = useSelector< + AppState, + CommandState['dispatchedAction'] + >(state => state.command.dispatchedAction); + + const command = useSelector( + state => state.command.selected + ); + + const dispatch = useDispatch(); + + return ( + + + { + dispatch({ ...new ChangeSelectedAction(command) }); + }} + > + { + if (dispatchedAction) { + dispatchedAction.cancel(); + } + + const newAction = createAction(command); + dispatch(newAction.getAction()); + dispatch({ ...new ChangeDispatchedAction(newAction) }); + + props.onRun!(); + }} + > + Run + + + + {(command === Command.Compile && ( + + )) || + (command === Command.DryRun && ( + + )) || + (command === Command.Deploy && ( + + )) || + (command === Command.EvaluateFunction && ( + + )) || + (command === Command.EvaluateValue && ( + + ))} + + + ); +}; diff --git a/tools/webide/packages/client/src/components/deploy-pane.tsx b/tools/webide/packages/client/src/components/deploy-pane.tsx new file mode 100644 index 000000000..3dfc37153 --- /dev/null +++ b/tools/webide/packages/client/src/components/deploy-pane.tsx @@ -0,0 +1,69 @@ +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import styled from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeEntrypointAction, ChangeStorageAction, DeployState, UseTezBridgeAction } from '../redux/deploy'; +import { CheckboxComponent } from './checkbox'; +import { Group, HGroup, Input, Label, Textarea } from './inputs'; + +const Container = styled.div``; + +const Checkbox = styled(CheckboxComponent)` + margin-right: 0.3em; +`; + +const Hint = styled.span` + font-style: italic; + font-size: 0.8em; +`; + +export const DeployPaneComponent = () => { + const dispatch = useDispatch(); + const entrypoint = useSelector( + state => state.deploy.entrypoint + ); + const storage = useSelector( + state => state.deploy.storage + ); + const useTezBridge = useSelector( + state => state.deploy.useTezBridge + ); + + return ( + + + + + dispatch({ ...new ChangeEntrypointAction(ev.target.value) }) + } + > + + + + + +
+ dispatch({ ...new UseTezBridgeAction(!value) })} + > + +
+
+ ); +}; diff --git a/tools/webide/packages/client/src/components/dry-run-pane.tsx b/tools/webide/packages/client/src/components/dry-run-pane.tsx new file mode 100644 index 000000000..45522127d --- /dev/null +++ b/tools/webide/packages/client/src/components/dry-run-pane.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import styled from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeEntrypointAction, ChangeParametersAction, ChangeStorageAction, DryRunState } from '../redux/dry-run'; +import { Group, Input, Label, Textarea } from './inputs'; + +const Container = styled.div``; + +export const DryRunPaneComponent = () => { + const dispatch = useDispatch(); + const entrypoint = useSelector( + state => state.dryRun.entrypoint + ); + const parameters = useSelector( + state => state.dryRun.parameters + ); + const storage = useSelector( + state => state.dryRun.storage + ); + + return ( + + + + + dispatch({ ...new ChangeEntrypointAction(ev.target.value) }) + } + > + + + + + + + + + + + ); +}; diff --git a/tools/webide/packages/client/src/components/editor.tsx b/tools/webide/packages/client/src/components/editor.tsx new file mode 100644 index 000000000..dd3624a73 --- /dev/null +++ b/tools/webide/packages/client/src/components/editor.tsx @@ -0,0 +1,32 @@ +import React from 'react'; +import styled from 'styled-components'; + +import { MonacoComponent } from './monaco'; +import { ShareComponent } from './share'; +import { SyntaxSelectComponent } from './syntax-select'; + +const Container = styled.div` + flex: 2; +`; + +const Header = styled.div` + flex: 1; + display: flex; + justify-content: space-between; + align-items: center; + + min-height: 2.5em; + border-bottom: 5px solid var(--blue_trans1); +`; + +export const EditorComponent = () => { + return ( + +
+ + +
+ +
+ ); +}; diff --git a/tools/webide/packages/client/src/components/evaluate-function-pane.tsx b/tools/webide/packages/client/src/components/evaluate-function-pane.tsx new file mode 100644 index 000000000..fb467094f --- /dev/null +++ b/tools/webide/packages/client/src/components/evaluate-function-pane.tsx @@ -0,0 +1,45 @@ +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import styled from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeEntrypointAction, ChangeParametersAction, EvaluateFunctionState } from '../redux/evaluate-function'; +import { Group, Input, Label, Textarea } from './inputs'; + +const Container = styled.div``; + +export const EvaluateFunctionPaneComponent = () => { + const dispatch = useDispatch(); + const entrypoint = useSelector( + state => state.evaluateFunction.entrypoint + ); + const parameters = useSelector( + state => state.evaluateFunction.parameters + ); + + return ( + + + + + dispatch({ ...new ChangeEntrypointAction(ev.target.value) }) + } + > + + + + + + + ); +}; diff --git a/tools/webide/packages/client/src/components/evaluate-value-pane.tsx b/tools/webide/packages/client/src/components/evaluate-value-pane.tsx new file mode 100644 index 000000000..9db29ec19 --- /dev/null +++ b/tools/webide/packages/client/src/components/evaluate-value-pane.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import styled from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeEntrypointAction, EvaluateValueState } from '../redux/evaluate-value'; +import { Group, Input, Label } from './inputs'; + +const Container = styled.div``; + +export const EvaluateValuePaneComponent = () => { + const dispatch = useDispatch(); + const entrypoint = useSelector( + state => state.evaluateValue.entrypoint + ); + + return ( + + + + + dispatch({ ...new ChangeEntrypointAction(ev.target.value) }) + } + > + + + ); +}; diff --git a/tools/webide/packages/client/src/components/examples.tsx b/tools/webide/packages/client/src/components/examples.tsx new file mode 100644 index 000000000..59c193b54 --- /dev/null +++ b/tools/webide/packages/client/src/components/examples.tsx @@ -0,0 +1,107 @@ +import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import styled from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeSelectedAction, ExamplesState } from '../redux/examples'; +import { getExample } from '../services/api'; + +const bgColor = 'transparent'; +const borderSize = '5px'; +const verticalPadding = '0.8em'; + +const Container = styled.div` + flex: 0.5; + display: flex; + flex-direction: column; +`; + +const MenuItem = styled.div<{ selected: boolean }>` + padding: ${verticalPadding} 0 ${verticalPadding} 1em; + height: 1.5em; + display: flex; + align-items: center; + cursor: pointer; + background-color: ${props => + props.selected ? 'var(--blue_trans1)' : bgColor}; + border-left: ${`${borderSize} solid ${bgColor}`}; + border-left-color: ${props => (props.selected ? 'var(--blue)' : bgColor)}; + + :first-child { + margin-top: ${props => (props.selected ? '0' : `-${borderSize}`)}; + } + + :hover { + background-color: ${props => + props.selected ? 'var(--blue_trans1)' : 'var(--blue_trans2)'}; + border-left: ${`${borderSize} solid ${bgColor}`}; + border-left-color: ${props => + props.selected ? 'var(--blue)' : 'transparent'}; + :first-child { + margin-top: ${props => (props.selected ? '0' : `-${borderSize}`)}; + padding-top: ${props => + props.selected + ? `${verticalPadding}` + : `calc(${verticalPadding} - ${borderSize})`}; + border-top: ${props => + props.selected ? '' : `${borderSize} solid var(--blue_opaque1)`}; + } + } +`; + +const MenuContainer = styled.div` + display: flex; + flex-direction: column; + overflow-y: auto; + height: var(--content_height); + box-sizing: border-box; +`; + +const Header = styled.div<{ firstChildSelected: boolean }>` + border-bottom: ${props => + props.firstChildSelected ? '' : '5px solid var(--blue_trans1)'}; + min-height: 2.5em; + padding: 0 10px; + display: flex; + align-items: center; +`; + +export const Examples = () => { + const examples = useSelector( + (state: AppState) => state.examples.list + ); + const selectedExample = useSelector( + (state: AppState) => state.examples.selected + ); + const dispatch = useDispatch(); + + return ( + +
+ Examples +
+ + {examples.map(example => { + return ( + { + const response = await getExample(example.id); + + dispatch({ ...new ChangeSelectedAction(response) }); + }} + > + {example.name} + + ); + })} + +
+ ); +}; diff --git a/tools/webide/packages/client/src/components/float-button.tsx b/tools/webide/packages/client/src/components/float-button.tsx new file mode 100644 index 000000000..cff64cb30 --- /dev/null +++ b/tools/webide/packages/client/src/components/float-button.tsx @@ -0,0 +1,83 @@ +import React, { useState } from 'react'; +import styled, { css } from 'styled-components'; + +const Container = styled.div` + display: flex; + align-items: center; + justify-content: center; +`; + +const Button = styled.a` + margin: 0.1em; + width: 1.5em; + height: 1.5em; + border-radius: 50%; + + display: flex; + justify-content: center; + align-items: center; + font-size: 1.5em; + font-weight: bolder; + text-decoration: none; + + color: rgba(255, 255, 255, 0.85); + background-color: var(--button_float); + box-shadow: 1px 3px 15px 0px rgba(153, 153, 153, 0.4); + cursor: pointer; + user-select: none; + transform-origin: center center; + transition: all 0.2s ease; + + &:hover { + box-shadow: var(--box-shadow); + background-color: var(--blue); + color: rgb(255, 255, 255); + transform: scale(1.2); + } +`; + +const Tooltip = styled.div<{ visible?: boolean }>` + position: absolute; + pointer-events: none; + z-index: 3; + white-space: nowrap; + transform: translateX(-6.5em); + + font-size: var(--font_sub_size); + color: var(--tooltip_foreground); + background-color: var(--tooltip_background); + border-radius: 6px; + padding: 5px 10px; + opacity: 0; + transition: opacity 0.2s ease 0.2s; + + ${props => + props.visible && + css` + opacity: 1; + `} +`; + +export const FloatButtonComponent = (props: { + tooltip: string; + text: string; + href: string; + className?: string; +}) => { + const [isTooltipShowing, setShowTooltip] = useState(false); + + return ( + + {props.tooltip} + + + ); +}; diff --git a/tools/webide/packages/client/src/components/header.tsx b/tools/webide/packages/client/src/components/header.tsx new file mode 100644 index 000000000..0298fe0dd --- /dev/null +++ b/tools/webide/packages/client/src/components/header.tsx @@ -0,0 +1,68 @@ +import React from 'react'; +import styled, { css } from 'styled-components'; + +const Container = styled.div` + display: flex; + justify-content: space-between; + align-items: center; + + padding: 0.5em 1em; + font-family: 'DM Sans', 'Open Sans', sans-serif; + box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.3); +`; + +const Group = styled.div` + display: flex; + align-items: center; +`; + +const Logo = styled.div` + font-size: 1.25em; +`; + +const Link = styled.a` + text-decoration: none; + color: black; + padding: 0.5em 1em; + + &:hover { + color: #3aa0ff; + } + + ${(props: { versionStyle?: boolean }) => + props.versionStyle && + css` + background-color: #efefef; + font-weight: 600; + margin-left: 3em; + + &:hover { + color: black; + } + `} +`; + +export const HeaderComponent = () => { + return ( + + + + LIGO + + + next + + + + Docs + + Tutorials + + Blog + + Contribute + + + + ); +}; diff --git a/tools/webide/packages/client/src/components/inputs.tsx b/tools/webide/packages/client/src/components/inputs.tsx new file mode 100644 index 000000000..cd68c6d8d --- /dev/null +++ b/tools/webide/packages/client/src/components/inputs.tsx @@ -0,0 +1,47 @@ +import styled from 'styled-components'; + +export const Group = styled.div` + display: flex; + flex-direction: column; +`; + +export const HGroup = styled.div` + display: flex; + align-items: center; +`; + +export const Label = styled.label` + font-size: 1em; + color: rgba(153, 153, 153, 1); +`; + +export const Input = styled.input` + margin: 0.3em 0 0.7em 0; + background-color: #eff7ff; + border-style: none; + border-bottom: 5px solid #e1f1ff; + padding: 0.5em; + font-size: 1em; + font-family: Menlo, Monaco, 'Courier New', monospace; + outline: none; + + &:focus { + background-color: #e1f1ff; + } +`; + +export const Textarea = styled.textarea` + resize: vertical; + margin: 0.3em 0 0.7em 0; + background-color: #eff7ff; + border-style: none; + border-bottom: 5px solid #e1f1ff; + padding: 0.5em; + font-size: 1em; + font-family: Menlo, Monaco, 'Courier New', monospace; + outline: none; + + &:focus { + background-color: #e1f1ff; + } +`; diff --git a/tools/webide/packages/client/src/components/monaco.tsx b/tools/webide/packages/client/src/components/monaco.tsx new file mode 100644 index 000000000..8aef9ad33 --- /dev/null +++ b/tools/webide/packages/client/src/components/monaco.tsx @@ -0,0 +1,86 @@ +import * as monaco from 'monaco-editor'; +import React, { useEffect, useRef } from 'react'; +import { useDispatch, useStore } from 'react-redux'; +import styled from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeCodeAction } from '../redux/editor'; + +const Container = styled.div` + height: var(--content_height); + + /* This font size is used to calcuate code font size */ + font-size: 0.8em; +`; + +export const MonacoComponent = () => { + let containerRef = useRef(null); + const store = useStore(); + const dispatch = useDispatch(); + + useEffect(() => { + const cleanupFunc: Array<() => void> = []; + const { editor: editorState } = store.getState(); + const model = monaco.editor.createModel( + editorState.code, + editorState.language + ); + + monaco.editor.defineTheme('ligoTheme', { + base: 'vs', + inherit: true, + rules: [], + colors: { + 'editor.background': '#eff7ff', + 'editor.lineHighlightBackground': '#cee3ff', + 'editorLineNumber.foreground': '#888' + } + }); + + monaco.editor.setTheme('ligoTheme'); + + const htmlElement = (containerRef.current as unknown) as HTMLElement; + const fontSize = window + .getComputedStyle(htmlElement, null) + .getPropertyValue('font-size'); + + const editor = monaco.editor.create(htmlElement, { + fontSize: parseFloat(fontSize), + model: model, + automaticLayout: true, + minimap: { + enabled: false + } + }); + + const { dispose } = editor.onDidChangeModelContent(() => { + dispatch({ ...new ChangeCodeAction(editor.getValue()) }); + }); + + cleanupFunc.push(dispose); + + cleanupFunc.push( + store.subscribe(() => { + const { editor: editorState }: AppState = store.getState(); + + if (editorState.code !== editor.getValue()) { + editor.setValue(editorState.code); + } + + if (editorState.language !== model.getModeId()) { + if (editorState.language === 'reasonligo') { + monaco.editor.setModelLanguage(model, 'javascript'); + } else { + monaco.editor.setModelLanguage(model, editorState.language); + } + } + }) + ); + + return function cleanUp() { + cleanupFunc.forEach(f => f()); + }; + }, [store, dispatch]); + + return ; +}; diff --git a/tools/webide/packages/client/src/components/output-tab.tsx b/tools/webide/packages/client/src/components/output-tab.tsx new file mode 100644 index 000000000..9322ebd0c --- /dev/null +++ b/tools/webide/packages/client/src/components/output-tab.tsx @@ -0,0 +1,149 @@ +import React, { useEffect, useRef, useState } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { PushSpinner } from 'react-spinners-kit'; +import styled, { css } from 'styled-components'; + +import { AppState } from '../redux/app'; +import { CommandState } from '../redux/command'; +import { DoneLoadingAction, LoadingState } from '../redux/loading'; +import { ResultState } from '../redux/result'; + +const Container = styled.div<{ visible?: boolean }>` + position: absolute; + box-sizing: border-box; + width: 100%; + height: 100%; + + font-family: Menlo, Monaco, 'Courier New', monospace; + overflow: scroll; + display: flex; + + transform: translateX(100%); + transition: transform 0.2s ease-in; + + ${props => + props.visible && + css` + transform: translateX(0px); + `} +`; + +const CancelButton = styled.div` + display: flex; + justify-content: center; + align-items: center; + color: white; + background-color: #fc683a; + cursor: pointer; + user-select: none; + margin: 1em; + padding: 0.5em 1em; +`; + +const Output = styled.div` + flex: 1; + padding: 0.8em; + display: flex; + + /* This font size is used to calcuate spinner size */ + font-size: 1em; +`; + +const LoadingContainer = styled.div` + flex: 1; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +`; + +const LoadingMessage = styled.div` + padding: 1em 0; +`; + +const Pre = styled.pre` + margin: 0; +`; + +export const OutputTabComponent = (props: { + selected?: boolean; + onCancel?: () => void; +}) => { + const output = useSelector( + state => state.result.output + ); + const contract = useSelector( + state => state.result.contract + ); + + const loading = useSelector(state => state.loading); + + const dispatchedAction = useSelector< + AppState, + CommandState['dispatchedAction'] + >(state => state.command.dispatchedAction); + + const dispatch = useDispatch(); + + const outputRef = useRef(null); + const [spinnerSize, setSpinnerSize] = useState(50); + + useEffect(() => { + const htmlElement = (outputRef.current as unknown) as HTMLElement; + const fontSize = window + .getComputedStyle(htmlElement, null) + .getPropertyValue('font-size'); + + setSpinnerSize(parseFloat(fontSize) * 3); + }, [setSpinnerSize]); + + return ( + + + {loading.loading && ( + + + {loading.message} + { + if (dispatchedAction) { + dispatchedAction.cancel(); + } + + dispatch({ ...new DoneLoadingAction() }); + + if (props.onCancel) { + props.onCancel(); + } + }} + > + Cancel + + + )} + {!loading.loading && + ((output.length !== 0 &&
{output}
) || + (contract.length !== 0 && ( + + The contract was successfully deployed to the babylonnet test + network. +
+
+ The address of your new contract is: {contract} +
+
+ View your new contract using{' '} + + Better Call Dev + + ! +
+ )))} +
+
+ ); +}; diff --git a/tools/webide/packages/client/src/components/share.tsx b/tools/webide/packages/client/src/components/share.tsx new file mode 100644 index 000000000..fb919ad3f --- /dev/null +++ b/tools/webide/packages/client/src/components/share.tsx @@ -0,0 +1,200 @@ +import { faCopy } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useEffect, useRef, useState } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { Dispatch } from 'redux'; +import styled, { css } from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeShareLinkAction, ShareState } from '../redux/share'; +import { share } from '../services/api'; + +const Container = styled.div` + display: flex; + justify-content: flex-end; + align-items: center; +`; + +const Button = styled.div<{ clicked?: boolean }>` + cursor: pointer; + user-select: none; + + z-index: 1; + display: flex; + justify-content: center; + align-items: center; + + height: 2em; + width: 6em; + color: var(--blue); + background-color: white; + border-radius: 1em; + transition: width 0.3s ease-in; + + ${props => + props.clicked && + css` + width: 2em; + background-color: white; + `} + + &:hover { + background-color: var(--blue_opaque1); + } +`; + +const Label = styled.span<{ visible?: boolean }>` + pointer-events: none; + opacity: 1; + transition: opacity 0.3s ease-in; + + ${props => + !props.visible && + css` + opacity: 0; + `} +`; + +const CopyIcon = ({ visible, ...props }: { visible: boolean }) => ( + +); + +const Copy = styled(CopyIcon)` + position: absolute; + pointer-events: none; + opacity: 1; + transition: opacity 0.3s ease-in; + + ${props => + !props.visible && + css` + opacity: 0; + `} +`; + +const Input = styled.input<{ visible?: boolean }>` + position: absolute; + background-color: var(--blue); + border-radius: 1em; + + opacity: 0; + height: 2em; + width: 2em; + transform: translateX(-0.3em); + border: none; + padding: 0 1em; + font-size: 1em; + color: white; + + transition: width 0.3s ease-in; + outline: none; + ${props => + props.visible && + css` + opacity: 1; + width: 25em; + `} +`; + +const Tooltip = styled.div<{ visible?: boolean }>` + position: absolute; + pointer-events: none; + z-index: 3; + transform: translateY(2.5em); + font-size: var(--font_sub_size); + color: var(--tooltip_foreground); + background-color: var(--tooltip_background); + border-radius: 6px; + padding: 5px 10px; + opacity: 0; + transition: opacity 0.2s ease 0.2s; + + ${props => + props.visible && + css` + opacity: 1; + `} +`; + +const shareAction = () => { + return async function(dispatch: Dispatch, getState: () => AppState) { + try { + const { hash } = await share(getState()); + dispatch({ ...new ChangeShareLinkAction(hash) }); + } catch (ex) {} + }; +}; + +function copy(element: HTMLInputElement): boolean { + element.select(); + element.setSelectionRange(0, 99999); + return document.execCommand('copy'); +} + +export const ShareComponent = () => { + const inputEl = useRef(null); + const dispatch = useDispatch(); + const shareLink = useSelector( + state => state.share.link + ); + const [clicked, setClicked] = useState(false); + const [isTooltipShowing, setShowTooltip] = useState(false); + + const SHARE_TOOLTIP = 'Share code'; + const COPY_TOOLTIP = 'Copy link'; + const COPIED_TOOLTIP = 'Copied!'; + const [tooltipMessage, setTooltipMessage] = useState(SHARE_TOOLTIP); + + useEffect(() => { + if (shareLink) { + if (inputEl.current && copy(inputEl.current)) { + setTooltipMessage(COPIED_TOOLTIP); + setShowTooltip(true); + } else { + setClicked(true); + setTooltipMessage(COPY_TOOLTIP); + } + } else { + setClicked(false); + setShowTooltip(false); + setTooltipMessage(SHARE_TOOLTIP); + } + }, [shareLink]); + + return ( + + + + + ); +}; diff --git a/tools/webide/packages/client/src/components/syntax-select.tsx b/tools/webide/packages/client/src/components/syntax-select.tsx new file mode 100644 index 000000000..e24ec4a70 --- /dev/null +++ b/tools/webide/packages/client/src/components/syntax-select.tsx @@ -0,0 +1,148 @@ +import { faCaretDown } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useState } from 'react'; +import OutsideClickHandler from 'react-outside-click-handler'; +import { useDispatch, useSelector } from 'react-redux'; +import styled, { css } from 'styled-components'; + +import { AppState } from '../redux/app'; +import { ChangeLanguageAction, EditorState } from '../redux/editor'; +import { Language } from '../redux/types'; + +const Container = styled.div` + display: flex; + position: relative; + z-index: 2; + min-width: 10em; +`; + +const Header = styled.div` + cursor: pointer; + user-select: none; + + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + height: 2em; + padding: 0 0.5em; + + border: 1px solid var(--blue_trans1); +`; + +const ArrowIcon = ({ rotate, ...props }: { rotate: boolean }) => ( + +); + +const Arrow = styled(ArrowIcon)` + margin-left: 0.5em; + pointer-events: none; + color: var(--blue_trans1); + transition: transform 0.15s ease-in; + + ${(props: { rotate: boolean }) => + props.rotate && + css` + transform: rotate(180deg); + `}; +`; + +const List = styled.ul` + position: absolute; + list-style-type: none; + background-color: white; + width: 100%; + margin: 0; + padding: 0; + box-shadow: 1px 3px 10px 0px rgba(153, 153, 153, 0.4); + border-radius: 3px; + + visibility: hidden; + opacity: 0; + transition: opacity 0.15s ease-in; + + ${(props: { visible: boolean }) => + props.visible && + css` + visibility: visible; + opacity: 1; + `} +`; + +const Option = styled.li` + cursor: pointer; + user-select: none; + + display: flex; + align-items: center; + justify-content: space-between; + height: 2em; + padding: 0 0.5em; + + &:first-child { + border-radius: 3px 3px 0 0; + } + + &:last-child { + border-radius: 0 0 3px 3px; + } + + &:hover { + background-color: var(--blue_trans2); + font-weight: 600; + } +`; + +export const SyntaxSelectComponent = () => { + const OPTIONS = { + [Language.PascaLigo]: 'PascaLIGO', + [Language.CameLigo]: 'CameLIGO', + [Language.ReasonLIGO]: 'ReasonLIGO' + }; + + const moveOptionToTop = (option: Language) => { + return Object.keys(OPTIONS).reduce((list, entry) => { + if (entry === option) { + list.unshift(entry); + } else { + list.push(entry as Language); + } + return list; + }, [] as Language[]); + }; + + const language = useSelector( + state => state.editor.language + ); + const dispatch = useDispatch(); + const [opened, open] = useState(false); + + const selectOption = (option: Language) => { + if (language !== option) { + dispatch({ ...new ChangeLanguageAction(option) }); + } + open(false); + }; + + return ( + + open(false)}> + + {moveOptionToTop(language).map(option => ( + + ))} + + +
open(true)}> + {OPTIONS[language]} + +
+
+ ); +}; diff --git a/tools/webide/packages/client/src/components/tabs-panel.tsx b/tools/webide/packages/client/src/components/tabs-panel.tsx new file mode 100644 index 000000000..436ace1fc --- /dev/null +++ b/tools/webide/packages/client/src/components/tabs-panel.tsx @@ -0,0 +1,94 @@ +import React, { useState } from 'react'; +import styled, { css } from 'styled-components'; + +import { ConfigureTabComponent } from './configure-tab'; +import { OutputTabComponent } from './output-tab'; + +const Container = styled.div` + flex: 1; + display: flex; + flex-direction: column; +`; + +const Header = styled.div` + display: flex; + border-bottom: 5px solid var(--blue_trans1); + min-height: 2.5em; +`; + +const Label = styled.span` + cursor: pointer; + user-select: none; + flex: 1; + display: flex; + justify-content: center; + align-items: center; + + &:hover { + color: var(--orange); + } +`; + +const Tab = styled.div<{ selected?: boolean }>` + flex: 1; + display: flex; + flex-direction: column; +`; + +const Underline = styled.div<{ selectedTab: number }>` + position: relative; + top: -5px; + background-color: var(--orange); + height: 5px; + margin-bottom: -5px; + width: calc(100% / 2); + transition: transform 0.2s ease-in; + + ${props => + css` + transform: translateX(calc(${props.selectedTab} * 100%)); + `} +`; + +const Content = styled.div` + position: relative; + width: 100%; + height: 100%; + overflow: hidden; +`; + +export const TabsPanelComponent = () => { + const TABS = [ + { index: 0, label: 'Configure', id: 'configure-tab' }, + { index: 1, label: 'Output', id: 'output-tab' } + ]; + + const [selectedTab, selectTab] = useState(TABS[0]); + + return ( + +
+ {TABS.map(tab => ( + + + + ))} +
+ + + { + selectTab(TABS[1]); + }} + > + { + selectTab(TABS[0]); + }} + > + +
+ ); +}; diff --git a/tools/webide/packages/client/src/components/toggle.tsx b/tools/webide/packages/client/src/components/toggle.tsx new file mode 100644 index 000000000..a1a0b3954 --- /dev/null +++ b/tools/webide/packages/client/src/components/toggle.tsx @@ -0,0 +1,83 @@ +import { faCheck } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useState } from 'react'; +import styled, { css } from 'styled-components'; + +const Container = styled.div<{ checked: boolean }>` + position: relative; + height: 2em; + width: 3.5em; + border-radius: 1em; + background-color: var(--blue_trans1); + border: 1px solid var(--blue); + transition: background-color 0.2s ease-in; + + ${props => + props.checked && + css` + background-color: var(--blue); + `}; +`; + +const Button = styled.div<{ checked: boolean }>` + display: flex; + justify-content: center; + align-items: center; + position: absolute; + + height: 2em; + width: 2em; + background-color: white; + border-radius: 50%; + cursor: pointer; + right: calc(1.5em); + transition: right 0.2s ease-in; + + ${props => + props.checked && + css` + right: 0; + `}; +`; + +const CheckIcon = ({ visible, ...props }: { visible: boolean }) => ( + +); + +const Check = styled(CheckIcon)` + position: absolute; + pointer-events: none; + opacity: 1; + transition: opacity 0.2s ease-in; + color: var(--blue); + + ${props => + !props.visible && + css` + opacity: 0; + `} +`; + +export const ToggleComponent = (props: { + checked: boolean; + onChanged: (value: boolean) => void; + className?: string; +}) => { + const [isChecked, setChecked] = useState(props.checked); + + return ( + + + + ); +}; diff --git a/tools/webide/packages/client/src/configure-store.ts b/tools/webide/packages/client/src/configure-store.ts new file mode 100644 index 000000000..80a8459d2 --- /dev/null +++ b/tools/webide/packages/client/src/configure-store.ts @@ -0,0 +1,31 @@ +import { applyMiddleware, createStore, Middleware } from 'redux'; +import ReduxThunk from 'redux-thunk'; + +import rootReducer, { AppState } from './redux/app'; + +declare var defaultServerState: AppState | undefined; + +export default function configureStore() { + const store = createStore( + rootReducer, + { + ...(typeof defaultServerState === 'undefined' ? {} : defaultServerState) + }, + applyMiddleware(ReduxThunk, cleanRouteOnAction) + ); + + return store; +} + +const cleanRouteOnAction: Middleware = store => next => action => { + const { share } = store.getState(); + next(action); + const state = store.getState(); + if ( + share.link !== undefined && + state.share.link === undefined && + window.location.pathname !== '/' + ) { + window.history.replaceState({}, document.title, '/'); + } +}; diff --git a/tools/webide/packages/client/src/index.css b/tools/webide/packages/client/src/index.css new file mode 100644 index 000000000..5dfa73718 --- /dev/null +++ b/tools/webide/packages/client/src/index.css @@ -0,0 +1,79 @@ +:root { + /* Note: the LIGO header should be ripped from the main ligolang.org homepage. Specs not included here :-) */ + /* width of all colored bands: 4px */ + --orange: #fc683a; + --orange_trans: #fedace; + + --blue: rgba(14, 116, 255, 1); + --button_float: rgba(14, 116, 255, 0.85); + --blue_trans1: rgba(14, 116, 255, 0.15); /* #e1f1ff; */ + --blue_opaque1: #dbeaff; + --blue_trans2: rgba(14, 116, 255, 0.08); /* #eff7ff; */ + + --grey: #888; + + --box-shadow: 1px 3px 10px 0px rgba(153, 153, 153, 0.4); /* or #999999 */ + --border_radius: 3px; + + /* text, where 1rem = 16px */ + --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + --font_weight: 400; + + --font_menu_hover: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', + 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + --font_menu_size: 1rem; + --font_menu_color: rgba(0, 0, 0, 1); + + --font_sub_size: 0.8em; + --font_sub_color: rgba(51, 51, 51, 1); /* or #333333; */ + + --font_label: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', + 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + --font_label_size: 0.8rem; + --font_label_color: rgba(153, 153, 153, 1); /* or #999999 */ + + --font_code: Consolas, source-code-pro, Menlo, Monaco, 'Courier New', + monospace; + --font_code_size: 0.8rem; + --font_code_color: rgba(51, 51, 51, 1); /* or #333333; */ + + /* filler text for empty panel */ + --font_ghost: 2rem; + --font_ghost_weight: 700; + --font_ghost_color: rgba(153, 153, 153, 0.5); /* or #CFCFCF */ + + --content_height: 85vh; + + --tooltip_foreground: white; + --tooltip_background: rgba(0, 0, 0, 0.75) /*#404040*/; +} + +body { + margin: 0; + font-size: 1.1vw; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} + +.monaco-editor .current-line ~ .line-numbers { + color: var(--orange); + border-left: 4px solid var(--blue); +} + +.monaco-editor .margin-view-overlays .current-line, +.monaco-editor .view-overlays .current-line { + background-color: var(--blue_trans1); + color: var(--blue); +} diff --git a/tools/webide/packages/client/src/index.tsx b/tools/webide/packages/client/src/index.tsx new file mode 100644 index 000000000..87d1be551 --- /dev/null +++ b/tools/webide/packages/client/src/index.tsx @@ -0,0 +1,12 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.css'; +import App from './App'; +import * as serviceWorker from './serviceWorker'; + +ReactDOM.render(, document.getElementById('root')); + +// If you want your app to work offline and load faster, you can change +// unregister() to register() below. Note this comes with some pitfalls. +// Learn more about service workers: https://bit.ly/CRA-PWA +serviceWorker.unregister(); diff --git a/tools/webide/packages/client/src/react-app-env.d.ts b/tools/webide/packages/client/src/react-app-env.d.ts new file mode 100644 index 000000000..6431bc5fc --- /dev/null +++ b/tools/webide/packages/client/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/tools/webide/packages/client/src/redux/actions/cancellable.ts b/tools/webide/packages/client/src/redux/actions/cancellable.ts new file mode 100644 index 000000000..81b884a9c --- /dev/null +++ b/tools/webide/packages/client/src/redux/actions/cancellable.ts @@ -0,0 +1,13 @@ +export abstract class CancellableAction { + private cancelled = false; + + cancel() { + this.cancelled = true; + } + + isCancelled() { + return this.cancelled; + } + + abstract getAction(): any; +} diff --git a/tools/webide/packages/client/src/redux/actions/compile.ts b/tools/webide/packages/client/src/redux/actions/compile.ts new file mode 100644 index 000000000..33566d6fc --- /dev/null +++ b/tools/webide/packages/client/src/redux/actions/compile.ts @@ -0,0 +1,39 @@ +import { Dispatch } from 'redux'; + +import { compileContract, getErrorMessage } from '../../services/api'; +import { AppState } from '../app'; +import { DoneLoadingAction, UpdateLoadingAction } from '../loading'; +import { ChangeOutputAction } from '../result'; +import { CancellableAction } from './cancellable'; + +export class CompileAction extends CancellableAction { + getAction() { + return async (dispatch: Dispatch, getState: () => AppState) => { + dispatch({ ...new UpdateLoadingAction('Compiling contract...') }); + + try { + const { editor, compile: compileState } = getState(); + const michelsonCode = await compileContract( + editor.language, + editor.code, + compileState.entrypoint + ); + + if (this.isCancelled()) { + return; + } + + dispatch({ ...new ChangeOutputAction(michelsonCode.result) }); + } catch (ex) { + if (this.isCancelled()) { + return; + } + dispatch({ + ...new ChangeOutputAction(`Error: ${getErrorMessage(ex)}`) + }); + } + + dispatch({ ...new DoneLoadingAction() }); + }; + } +} diff --git a/tools/webide/packages/client/src/redux/actions/deploy.ts b/tools/webide/packages/client/src/redux/actions/deploy.ts new file mode 100644 index 000000000..e8b8c2d9e --- /dev/null +++ b/tools/webide/packages/client/src/redux/actions/deploy.ts @@ -0,0 +1,99 @@ +import { Tezos } from '@taquito/taquito'; +import { TezBridgeSigner } from '@taquito/tezbridge-signer'; +import { Dispatch } from 'redux'; + +import { compileContract, compileExpression, deploy, getErrorMessage } from '../../services/api'; +import { AppState } from '../app'; +import { MichelsonFormat } from '../compile'; +import { DoneLoadingAction, UpdateLoadingAction } from '../loading'; +import { ChangeContractAction, ChangeOutputAction } from '../result'; +import { CancellableAction } from './cancellable'; + +Tezos.setProvider({ + rpc: 'https://api.tez.ie/rpc/babylonnet', + signer: new TezBridgeSigner() +}); + +export class DeployAction extends CancellableAction { + async deployWithTezBridge(dispatch: Dispatch, getState: () => AppState) { + dispatch({ ...new UpdateLoadingAction('Compiling contract...') }); + + const { editor: editorState, deploy: deployState } = getState(); + + const michelsonCode = await compileContract( + editorState.language, + editorState.code, + deployState.entrypoint, + MichelsonFormat.Json + ); + + if (this.isCancelled()) { + return; + } + + dispatch({ ...new UpdateLoadingAction('Compiling storage...') }); + const michelsonStorage = await compileExpression( + editorState.language, + deployState.storage, + MichelsonFormat.Json + ); + + if (this.isCancelled()) { + return; + } + + dispatch({ ...new UpdateLoadingAction('Waiting for TezBridge signer...') }); + + const op = await Tezos.contract.originate({ + code: JSON.parse(michelsonCode.result), + init: JSON.parse(michelsonStorage.result) + }); + + if (this.isCancelled()) { + return; + } + + dispatch({ ...new UpdateLoadingAction('Deploying to babylon network...') }); + return await op.contract(); + } + + async deployOnServerSide(dispatch: Dispatch, getState: () => AppState) { + dispatch({ ...new UpdateLoadingAction('Deploying to babylon network...') }); + + const { editor: editorState, deploy: deployState } = getState(); + + return await deploy( + editorState.language, + editorState.code, + deployState.entrypoint, + deployState.storage + ); + } + + getAction() { + return async (dispatch: Dispatch, getState: () => AppState) => { + const { deploy } = getState(); + + try { + const contract = deploy.useTezBridge + ? await this.deployWithTezBridge(dispatch, getState) + : await this.deployOnServerSide(dispatch, getState); + + if (!contract || this.isCancelled()) { + return; + } + + dispatch({ ...new ChangeContractAction(contract.address) }); + } catch (ex) { + if (this.isCancelled()) { + return; + } + dispatch({ + ...new ChangeOutputAction(`Error: ${getErrorMessage(ex)}`) + }); + } + + dispatch({ ...new DoneLoadingAction() }); + }; + } +} diff --git a/tools/webide/packages/client/src/redux/actions/dry-run.ts b/tools/webide/packages/client/src/redux/actions/dry-run.ts new file mode 100644 index 000000000..9b51a58ff --- /dev/null +++ b/tools/webide/packages/client/src/redux/actions/dry-run.ts @@ -0,0 +1,41 @@ +import { Dispatch } from 'redux'; + +import { dryRun, getErrorMessage } from '../../services/api'; +import { AppState } from '../app'; +import { DoneLoadingAction, UpdateLoadingAction } from '../loading'; +import { ChangeOutputAction } from '../result'; +import { CancellableAction } from './cancellable'; + +export class DryRunAction extends CancellableAction { + getAction() { + return async (dispatch: Dispatch, getState: () => AppState) => { + dispatch({ + ...new UpdateLoadingAction('Waiting for dry run results...') + }); + + try { + const { editor, dryRun: dryRunState } = getState(); + const result = await dryRun( + editor.language, + editor.code, + dryRunState.entrypoint, + dryRunState.parameters, + dryRunState.storage + ); + if (this.isCancelled()) { + return; + } + dispatch({ ...new ChangeOutputAction(result.output) }); + } catch (ex) { + if (this.isCancelled()) { + return; + } + dispatch({ + ...new ChangeOutputAction(`Error: ${getErrorMessage(ex)}`) + }); + } + + dispatch({ ...new DoneLoadingAction() }); + }; + } +} diff --git a/tools/webide/packages/client/src/redux/actions/evaluate-function.ts b/tools/webide/packages/client/src/redux/actions/evaluate-function.ts new file mode 100644 index 000000000..85871ebda --- /dev/null +++ b/tools/webide/packages/client/src/redux/actions/evaluate-function.ts @@ -0,0 +1,43 @@ +import { Dispatch } from 'redux'; + +import { getErrorMessage, runFunction } from '../../services/api'; +import { AppState } from '../app'; +import { DoneLoadingAction, UpdateLoadingAction } from '../loading'; +import { ChangeOutputAction } from '../result'; +import { CancellableAction } from './cancellable'; + +export class EvaluateFunctionAction extends CancellableAction { + getAction() { + return async (dispatch: Dispatch, getState: () => AppState) => { + const { editor, evaluateFunction: evaluateFunctionState } = getState(); + + dispatch({ + ...new UpdateLoadingAction( + `Evaluating ${evaluateFunctionState.entrypoint} ${evaluateFunctionState.parameters}...` + ) + }); + + try { + const result = await runFunction( + editor.language, + editor.code, + evaluateFunctionState.entrypoint, + evaluateFunctionState.parameters + ); + if (this.isCancelled()) { + return; + } + dispatch({ ...new ChangeOutputAction(result.output) }); + } catch (ex) { + if (this.isCancelled()) { + return; + } + dispatch({ + ...new ChangeOutputAction(`Error: ${getErrorMessage(ex)}`) + }); + } + + dispatch({ ...new DoneLoadingAction() }); + }; + } +} diff --git a/tools/webide/packages/client/src/redux/actions/evaluate-value.ts b/tools/webide/packages/client/src/redux/actions/evaluate-value.ts new file mode 100644 index 000000000..16f46696d --- /dev/null +++ b/tools/webide/packages/client/src/redux/actions/evaluate-value.ts @@ -0,0 +1,44 @@ +import { Dispatch } from 'redux'; + +import { evaluateValue, getErrorMessage } from '../../services/api'; +import { AppState } from '../app'; +import { DoneLoadingAction, UpdateLoadingAction } from '../loading'; +import { ChangeOutputAction } from '../result'; +import { CancellableAction } from './cancellable'; + +export class EvaluateValueAction extends CancellableAction { + getAction() { + return async (dispatch: Dispatch, getState: () => AppState) => { + const { editor, evaluateValue: evaluateValueState } = getState(); + + dispatch({ + ...new UpdateLoadingAction( + `Evaluating "${evaluateValueState.entrypoint}" entrypoint...` + ) + }); + + try { + const result = await evaluateValue( + editor.language, + editor.code, + evaluateValueState.entrypoint + ); + + if (this.isCancelled()) { + return; + } + + dispatch({ ...new ChangeOutputAction(result.code) }); + } catch (ex) { + if (this.isCancelled()) { + return; + } + dispatch({ + ...new ChangeOutputAction(`Error: ${getErrorMessage(ex)}`) + }); + } + + dispatch({ ...new DoneLoadingAction() }); + }; + } +} diff --git a/tools/webide/packages/client/src/redux/app.ts b/tools/webide/packages/client/src/redux/app.ts new file mode 100644 index 000000000..e7829d8c9 --- /dev/null +++ b/tools/webide/packages/client/src/redux/app.ts @@ -0,0 +1,41 @@ +import { combineReducers } from 'redux'; + +import command, { CommandState } from './command'; +import compile, { CompileState } from './compile'; +import deploy, { DeployState } from './deploy'; +import dryRun, { DryRunState } from './dry-run'; +import editor, { EditorState } from './editor'; +import evaluateFunction, { EvaluateFunctionState } from './evaluate-function'; +import evaluateValue, { EvaluateValueState } from './evaluate-value'; +import examples, { ExamplesState } from './examples'; +import loading, { LoadingState } from './loading'; +import result, { ResultState } from './result'; +import share, { ShareState } from './share'; + +export interface AppState { + editor: EditorState; + share: ShareState; + compile: CompileState; + dryRun: DryRunState; + deploy: DeployState; + evaluateFunction: EvaluateFunctionState; + evaluateValue: EvaluateValueState; + result: ResultState; + command: CommandState; + examples: ExamplesState; + loading: LoadingState; +} + +export default combineReducers({ + editor, + share, + compile, + dryRun, + deploy, + evaluateFunction, + evaluateValue, + result, + command, + examples, + loading +}); diff --git a/tools/webide/packages/client/src/redux/command.ts b/tools/webide/packages/client/src/redux/command.ts new file mode 100644 index 000000000..24d9c19c4 --- /dev/null +++ b/tools/webide/packages/client/src/redux/command.ts @@ -0,0 +1,45 @@ +import { CancellableAction } from './actions/cancellable'; +import { Command } from './types'; + +export enum ActionType { + ChangeSelected = 'command-change-selected', + ChangeDispatchedAction = 'command-change-dispatched-action' +} + +export interface CommandState { + selected: Command; + dispatchedAction: CancellableAction | null; +} + +export class ChangeSelectedAction { + public readonly type = ActionType.ChangeSelected; + constructor(public payload: CommandState['selected']) {} +} + +export class ChangeDispatchedAction { + public readonly type = ActionType.ChangeDispatchedAction; + constructor(public payload: CommandState['dispatchedAction']) {} +} + +type Action = ChangeSelectedAction | ChangeDispatchedAction; + +const DEFAULT_STATE: CommandState = { + selected: Command.Compile, + dispatchedAction: null +}; + +export default (state = DEFAULT_STATE, action: Action): CommandState => { + switch (action.type) { + case ActionType.ChangeSelected: + return { + ...state, + selected: action.payload + }; + case ActionType.ChangeDispatchedAction: + return { + ...state, + dispatchedAction: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/compile.ts b/tools/webide/packages/client/src/redux/compile.ts new file mode 100644 index 000000000..2c4564362 --- /dev/null +++ b/tools/webide/packages/client/src/redux/compile.ts @@ -0,0 +1,41 @@ +import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples'; + +export enum MichelsonFormat { + Text = 'text', + Json = 'json' +} + +export enum ActionType { + ChangeEntrypoint = 'compile-change-entrypoint' +} + +export interface CompileState { + entrypoint: string; +} + +export class ChangeEntrypointAction { + public readonly type = ActionType.ChangeEntrypoint; + constructor(public payload: CompileState['entrypoint']) {} +} + +type Action = ChangeEntrypointAction | ChangeSelectedExampleAction; + +const DEFAULT_STATE: CompileState = { + entrypoint: '' +}; + +export default (state = DEFAULT_STATE, action: Action): CompileState => { + switch (action.type) { + case ExamplesActionType.ChangeSelected: + return { + ...state, + ...(!action.payload ? DEFAULT_STATE : action.payload.compile) + }; + case ActionType.ChangeEntrypoint: + return { + ...state, + entrypoint: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/deploy.ts b/tools/webide/packages/client/src/redux/deploy.ts new file mode 100644 index 000000000..817127d94 --- /dev/null +++ b/tools/webide/packages/client/src/redux/deploy.ts @@ -0,0 +1,66 @@ +import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples'; + +export enum ActionType { + ChangeEntrypoint = 'deploy-change-entrypoint', + ChangeStorage = 'deploy-change-storage', + UseTezBridge = 'deploy-use-tezbridge' +} + +export interface DeployState { + entrypoint: string; + storage: string; + useTezBridge: boolean; +} + +export class ChangeEntrypointAction { + public readonly type = ActionType.ChangeEntrypoint; + constructor(public payload: DeployState['entrypoint']) {} +} + +export class ChangeStorageAction { + public readonly type = ActionType.ChangeStorage; + constructor(public payload: DeployState['storage']) {} +} + +export class UseTezBridgeAction { + public readonly type = ActionType.UseTezBridge; + constructor(public payload: DeployState['useTezBridge']) {} +} + +type Action = + | ChangeEntrypointAction + | ChangeStorageAction + | UseTezBridgeAction + | ChangeSelectedExampleAction; + +const DEFAULT_STATE: DeployState = { + entrypoint: '', + storage: '', + useTezBridge: false +}; + +export default (state = DEFAULT_STATE, action: Action): DeployState => { + switch (action.type) { + case ExamplesActionType.ChangeSelected: + return { + ...state, + ...(!action.payload ? DEFAULT_STATE : action.payload.deploy) + }; + case ActionType.ChangeEntrypoint: + return { + ...state, + entrypoint: action.payload + }; + case ActionType.ChangeStorage: + return { + ...state, + storage: action.payload + }; + case ActionType.UseTezBridge: + return { + ...state, + useTezBridge: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/dry-run.ts b/tools/webide/packages/client/src/redux/dry-run.ts new file mode 100644 index 000000000..4a9ab95c6 --- /dev/null +++ b/tools/webide/packages/client/src/redux/dry-run.ts @@ -0,0 +1,66 @@ +import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples'; + +export enum ActionType { + ChangeEntrypoint = 'dry-run-change-entrypoint', + ChangeParameters = 'dry-run-change-parameters', + ChangeStorage = 'dry-run-change-storage' +} + +export interface DryRunState { + entrypoint: string; + parameters: string; + storage: string; +} + +export class ChangeEntrypointAction { + public readonly type = ActionType.ChangeEntrypoint; + constructor(public payload: DryRunState['entrypoint']) {} +} + +export class ChangeParametersAction { + public readonly type = ActionType.ChangeParameters; + constructor(public payload: DryRunState['parameters']) {} +} + +export class ChangeStorageAction { + public readonly type = ActionType.ChangeStorage; + constructor(public payload: DryRunState['storage']) {} +} + +type Action = + | ChangeEntrypointAction + | ChangeParametersAction + | ChangeStorageAction + | ChangeSelectedExampleAction; + +const DEFAULT_STATE: DryRunState = { + entrypoint: '', + parameters: '', + storage: '' +}; + +export default (state = DEFAULT_STATE, action: Action): DryRunState => { + switch (action.type) { + case ExamplesActionType.ChangeSelected: + return { + ...state, + ...(!action.payload ? DEFAULT_STATE : action.payload.dryRun) + }; + case ActionType.ChangeEntrypoint: + return { + ...state, + entrypoint: action.payload + }; + case ActionType.ChangeParameters: + return { + ...state, + parameters: action.payload + }; + case ActionType.ChangeStorage: + return { + ...state, + storage: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/editor.ts b/tools/webide/packages/client/src/redux/editor.ts new file mode 100644 index 000000000..f1582dd01 --- /dev/null +++ b/tools/webide/packages/client/src/redux/editor.ts @@ -0,0 +1,53 @@ +import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples'; +import { Language } from './types'; + +export enum ActionType { + ChangeLanguage = 'editor-change-language', + ChangeCode = 'editor-change-code' +} + +export interface EditorState { + language: Language; + code: string; +} + +export class ChangeLanguageAction { + public readonly type = ActionType.ChangeLanguage; + constructor(public payload: EditorState['language']) {} +} + +export class ChangeCodeAction { + public readonly type = ActionType.ChangeCode; + constructor(public payload: EditorState['code']) {} +} + +type Action = + | ChangeCodeAction + | ChangeLanguageAction + | ChangeSelectedExampleAction; + +const DEFAULT_STATE: EditorState = { + language: Language.CameLigo, + code: '' +}; + +export default (state = DEFAULT_STATE, action: Action): EditorState => { + switch (action.type) { + case ExamplesActionType.ChangeSelected: + return { + ...state, + ...(!action.payload ? DEFAULT_STATE : action.payload.editor) + }; + case ActionType.ChangeLanguage: + return { + ...state, + language: action.payload + }; + case ActionType.ChangeCode: + return { + ...state, + code: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/evaluate-function.ts b/tools/webide/packages/client/src/redux/evaluate-function.ts new file mode 100644 index 000000000..1fe0a0c44 --- /dev/null +++ b/tools/webide/packages/client/src/redux/evaluate-function.ts @@ -0,0 +1,55 @@ +import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples'; + +export enum ActionType { + ChangeEntrypoint = 'evaluate-function-change-entrypoint', + ChangeParameters = 'evaluate-function-change-parameters' +} + +export interface EvaluateFunctionState { + entrypoint: string; + parameters: string; +} + +export class ChangeEntrypointAction { + public readonly type = ActionType.ChangeEntrypoint; + constructor(public payload: EvaluateFunctionState['entrypoint']) {} +} + +export class ChangeParametersAction { + public readonly type = ActionType.ChangeParameters; + constructor(public payload: EvaluateFunctionState['parameters']) {} +} + +type Action = + | ChangeEntrypointAction + | ChangeParametersAction + | ChangeSelectedExampleAction; + +const DEFAULT_STATE: EvaluateFunctionState = { + entrypoint: '', + parameters: '' +}; + +export default ( + state = DEFAULT_STATE, + action: Action +): EvaluateFunctionState => { + switch (action.type) { + case ExamplesActionType.ChangeSelected: + return { + ...state, + ...(!action.payload ? DEFAULT_STATE : action.payload.evaluateFunction) + }; + case ActionType.ChangeEntrypoint: + return { + ...state, + entrypoint: action.payload + }; + case ActionType.ChangeParameters: + return { + ...state, + parameters: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/evaluate-value.ts b/tools/webide/packages/client/src/redux/evaluate-value.ts new file mode 100644 index 000000000..8a026a53b --- /dev/null +++ b/tools/webide/packages/client/src/redux/evaluate-value.ts @@ -0,0 +1,36 @@ +import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples'; + +export enum ActionType { + ChangeEntrypoint = 'evaluate-value-change-entrypoint' +} + +export interface EvaluateValueState { + entrypoint: string; +} + +export class ChangeEntrypointAction { + public readonly type = ActionType.ChangeEntrypoint; + constructor(public payload: EvaluateValueState['entrypoint']) {} +} + +type Action = ChangeEntrypointAction | ChangeSelectedExampleAction; + +const DEFAULT_STATE: EvaluateValueState = { + entrypoint: '' +}; + +export default (state = DEFAULT_STATE, action: Action): EvaluateValueState => { + switch (action.type) { + case ExamplesActionType.ChangeSelected: + return { + ...state, + ...(!action.payload ? DEFAULT_STATE : action.payload.evaluateValue) + }; + case ActionType.ChangeEntrypoint: + return { + ...state, + entrypoint: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/example.ts b/tools/webide/packages/client/src/redux/example.ts new file mode 100644 index 000000000..12a799555 --- /dev/null +++ b/tools/webide/packages/client/src/redux/example.ts @@ -0,0 +1,17 @@ +import { CompileState } from './compile'; +import { DeployState } from './deploy'; +import { DryRunState } from './dry-run'; +import { EditorState } from './editor'; +import { EvaluateFunctionState } from './evaluate-function'; +import { EvaluateValueState } from './evaluate-value'; + +export interface ExampleState { + id: string; + name: string; + editor: EditorState; + compile: CompileState; + dryRun: DryRunState; + deploy: DeployState; + evaluateFunction: EvaluateFunctionState; + evaluateValue: EvaluateValueState; +} diff --git a/tools/webide/packages/client/src/redux/examples.ts b/tools/webide/packages/client/src/redux/examples.ts new file mode 100644 index 000000000..98bc0a481 --- /dev/null +++ b/tools/webide/packages/client/src/redux/examples.ts @@ -0,0 +1,38 @@ +import { ExampleState } from './example'; + +export enum ActionType { + ChangeSelected = 'examples-change-selected' +} + +export interface ExampleItem { + id: string; + name: string; +} + +export interface ExamplesState { + selected: ExampleState | null; + list: ExampleItem[]; +} + +export class ChangeSelectedAction { + public readonly type = ActionType.ChangeSelected; + constructor(public payload: ExamplesState['selected']) {} +} + +type Action = ChangeSelectedAction; + +export const DEFAULT_STATE: ExamplesState = { + selected: null, + list: [] +}; + +export default (state = DEFAULT_STATE, action: Action): ExamplesState => { + switch (action.type) { + case ActionType.ChangeSelected: + return { + ...state, + selected: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/loading.ts b/tools/webide/packages/client/src/redux/loading.ts new file mode 100644 index 000000000..24e07e837 --- /dev/null +++ b/tools/webide/packages/client/src/redux/loading.ts @@ -0,0 +1,42 @@ +export enum ActionType { + UpdateLoading = 'loading-update-loading', + DoneLoading = 'loading-done-loading' +} + +export interface LoadingState { + loading: boolean; + message: string; +} + +export class UpdateLoadingAction { + public readonly type = ActionType.UpdateLoading; + constructor(public payload: LoadingState['message']) {} +} + +export class DoneLoadingAction { + public readonly type = ActionType.DoneLoading; +} + +type Action = UpdateLoadingAction | DoneLoadingAction; + +export const DEFAULT_STATE: LoadingState = { + loading: false, + message: '' +}; + +export default (state = DEFAULT_STATE, action: Action): LoadingState => { + switch (action.type) { + case ActionType.UpdateLoading: + return { + ...state, + loading: true, + message: action.payload + }; + case ActionType.DoneLoading: + return { + ...state, + ...DEFAULT_STATE + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/result.ts b/tools/webide/packages/client/src/redux/result.ts new file mode 100644 index 000000000..54315a948 --- /dev/null +++ b/tools/webide/packages/client/src/redux/result.ts @@ -0,0 +1,43 @@ +export enum ActionType { + ChangeOutput = 'result-change-output', + ChangeContract = 'result-change-contract' +} + +export interface ResultState { + output: string; + contract: string; +} + +export class ChangeOutputAction { + public readonly type = ActionType.ChangeOutput; + constructor(public payload: ResultState['output']) {} +} + +export class ChangeContractAction { + public readonly type = ActionType.ChangeContract; + constructor(public payload: ResultState['contract']) {} +} + +type Action = ChangeOutputAction | ChangeContractAction; + +const DEFAULT_STATE: ResultState = { + output: '', + contract: '' +}; + +export default (state = DEFAULT_STATE, action: Action): ResultState => { + switch (action.type) { + case ActionType.ChangeOutput: + return { + ...state, + output: action.payload + }; + case ActionType.ChangeContract: + return { + ...state, + output: DEFAULT_STATE.output, + contract: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/share.ts b/tools/webide/packages/client/src/redux/share.ts new file mode 100644 index 000000000..103601add --- /dev/null +++ b/tools/webide/packages/client/src/redux/share.ts @@ -0,0 +1,82 @@ +import { ActionType as CompileActionType, ChangeEntrypointAction as ChangeCompileEntrypointAction } from './compile'; +import { + ActionType as DeployActionType, + ChangeEntrypointAction as ChangeDeployEntrypointAction, + ChangeStorageAction as ChangeDeployStorageAction, + UseTezBridgeAction, +} from './deploy'; +import { + ActionType as DryRunActionType, + ChangeEntrypointAction as ChangeDryRunEntrypointAction, + ChangeParametersAction as ChangeDryRunParametersAction, + ChangeStorageAction as ChangeDryRunStorageAction, +} from './dry-run'; +import { ActionType as EditorActionType, ChangeCodeAction, ChangeLanguageAction } from './editor'; +import { + ActionType as EvaluateFunctionActionType, + ChangeEntrypointAction as ChangeEvaluateFunctionEntrypointAction, + ChangeParametersAction as ChangeEvaluateFunctionParametersAction, +} from './evaluate-function'; +import { + ActionType as EvaluateValueActionType, + ChangeEntrypointAction as ChangeEvaluateValueEntrypointAction, +} from './evaluate-value'; + +export enum ActionType { + ChangeShareLink = 'share-change-link' +} + +export interface ShareState { + link: string; +} + +export class ChangeShareLinkAction { + public readonly type = ActionType.ChangeShareLink; + constructor(public payload: ShareState['link']) {} +} + +type Action = + | ChangeShareLinkAction + | ChangeCodeAction + | ChangeLanguageAction + | ChangeCompileEntrypointAction + | ChangeDeployEntrypointAction + | ChangeDeployStorageAction + | UseTezBridgeAction + | ChangeDryRunEntrypointAction + | ChangeDryRunParametersAction + | ChangeDryRunStorageAction + | ChangeEvaluateFunctionEntrypointAction + | ChangeEvaluateFunctionParametersAction + | ChangeEvaluateValueEntrypointAction; + +const DEFAULT_STATE: ShareState = { + link: '' +}; + +export default (state = DEFAULT_STATE, action: Action): ShareState => { + switch (action.type) { + case EditorActionType.ChangeCode: + case EditorActionType.ChangeLanguage: + case CompileActionType.ChangeEntrypoint: + case DeployActionType.ChangeEntrypoint: + case DeployActionType.ChangeStorage: + case DeployActionType.UseTezBridge: + case DryRunActionType.ChangeEntrypoint: + case DryRunActionType.ChangeParameters: + case DryRunActionType.ChangeStorage: + case EvaluateFunctionActionType.ChangeEntrypoint: + case EvaluateFunctionActionType.ChangeParameters: + case EvaluateValueActionType.ChangeEntrypoint: + return { + ...state, + ...DEFAULT_STATE + }; + case ActionType.ChangeShareLink: + return { + ...state, + link: action.payload + }; + } + return state; +}; diff --git a/tools/webide/packages/client/src/redux/types.ts b/tools/webide/packages/client/src/redux/types.ts new file mode 100644 index 000000000..29484403f --- /dev/null +++ b/tools/webide/packages/client/src/redux/types.ts @@ -0,0 +1,13 @@ +export enum Language { + PascaLigo = 'pascaligo', + CameLigo = 'cameligo', + ReasonLIGO = 'reasonligo' +} + +export enum Command { + Compile = 'compile', + DryRun = 'dry-run', + EvaluateValue = 'evaluate-value', + EvaluateFunction = 'evaluate-function', + Deploy = 'deploy' +} diff --git a/tools/webide/packages/client/src/serviceWorker.ts b/tools/webide/packages/client/src/serviceWorker.ts new file mode 100644 index 000000000..b3793f855 --- /dev/null +++ b/tools/webide/packages/client/src/serviceWorker.ts @@ -0,0 +1,143 @@ +// This optional code is used to register a service worker. +// register() is not called by default. + +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on subsequent visits to a page, after all the +// existing tabs open on the page have been closed, since previously cached +// resources are updated in the background. + +// To learn more about the benefits of this model and instructions on how to +// opt-in, read https://bit.ly/CRA-PWA + +const isLocalhost = Boolean( + window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.1/8 is considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) +); + +type Config = { + onSuccess?: (registration: ServiceWorkerRegistration) => void; + onUpdate?: (registration: ServiceWorkerRegistration) => void; +}; + +export function register(config?: Config) { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + // The URL constructor is available in all browsers that support SW. + const publicUrl = new URL( + (process as { env: { [key: string]: string } }).env.PUBLIC_URL, + window.location.href + ); + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebook/create-react-app/issues/2374 + return; + } + + window.addEventListener('load', () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + + if (isLocalhost) { + // This is running on localhost. Let's check if a service worker still exists or not. + checkValidServiceWorker(swUrl, config); + + // Add some additional logging to localhost, pointing developers to the + // service worker/PWA documentation. + navigator.serviceWorker.ready.then(() => { + console.log( + 'This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://bit.ly/CRA-PWA' + ); + }); + } else { + // Is not localhost. Just register service worker + registerValidSW(swUrl, config); + } + }); + } +} + +function registerValidSW(swUrl: string, config?: Config) { + navigator.serviceWorker + .register(swUrl) + .then(registration => { + registration.onupdatefound = () => { + const installingWorker = registration.installing; + if (installingWorker == null) { + return; + } + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the updated precached content has been fetched, + // but the previous service worker will still serve the older + // content until all client tabs are closed. + console.log( + 'New content is available and will be used when all ' + + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' + ); + + // Execute callback + if (config && config.onUpdate) { + config.onUpdate(registration); + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); + + // Execute callback + if (config && config.onSuccess) { + config.onSuccess(registration); + } + } + } + }; + }; + }) + .catch(error => { + console.error('Error during service worker registration:', error); + }); +} + +function checkValidServiceWorker(swUrl: string, config?: Config) { + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl) + .then(response => { + // Ensure service worker exists, and that we really are getting a JS file. + const contentType = response.headers.get('content-type'); + if ( + response.status === 404 || + (contentType != null && contentType.indexOf('javascript') === -1) + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then(registration => { + registration.unregister().then(() => { + window.location.reload(); + }); + }); + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl, config); + } + }) + .catch(() => { + console.log( + 'No internet connection found. App is running in offline mode.' + ); + }); +} + +export function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready.then(registration => { + registration.unregister(); + }); + } +} diff --git a/tools/webide/packages/client/src/services/api.ts b/tools/webide/packages/client/src/services/api.ts new file mode 100644 index 000000000..ba197802b --- /dev/null +++ b/tools/webide/packages/client/src/services/api.ts @@ -0,0 +1,132 @@ +import axios from 'axios'; + +import { AppState } from '../redux/app'; +import { Language } from '../redux/types'; + +export async function getExample(id: string) { + const response = await axios.get(`/static/examples/${id}`); + return response.data; +} + +export async function compileContract( + syntax: Language, + code: string, + entrypoint: string, + format?: string +) { + const response = await axios.post('/api/compile-contract', { + syntax, + code, + entrypoint, + format + }); + return response.data; +} + +export async function compileExpression( + syntax: Language, + expression: string, + format?: string +) { + const response = await axios.post('/api/compile-expression', { + syntax, + expression, + format + }); + return response.data; +} + +export async function dryRun( + syntax: Language, + code: string, + entrypoint: string, + parameters: string, + storage: string +) { + // For whatever reason, storage set by examples is not treated as a string. So we convert it here. + storage = `${storage}`; + + const response = await axios.post('/api/dry-run', { + syntax, + code, + entrypoint, + parameters, + storage + }); + return response.data; +} + +export async function share({ + editor, + compile, + dryRun, + deploy, + evaluateValue, + evaluateFunction +}: Partial) { + const response = await axios.post('/api/share', { + editor, + compile, + dryRun, + deploy, + evaluateValue, + evaluateFunction + }); + return response.data; +} + +export async function deploy( + syntax: Language, + code: string, + entrypoint: string, + storage: string +) { + // For whatever reason, storage set by examples is not treated as a string. So we convert it here. + storage = `${storage}`; + + const response = await axios.post('/api/deploy', { + syntax, + code, + entrypoint, + storage + }); + return response.data; +} + +export async function evaluateValue( + syntax: Language, + code: string, + entrypoint: string +) { + const response = await axios.post('/api/evaluate-value', { + syntax, + code, + entrypoint + }); + return response.data; +} + +export async function runFunction( + syntax: Language, + code: string, + entrypoint: string, + parameters: string +) { + const response = await axios.post('/api/run-function', { + syntax, + code, + entrypoint, + parameters + }); + return response.data; +} + +export function getErrorMessage(ex: any): string { + if (ex.response && ex.response.data) { + return ex.response.data.error; + } else if (ex instanceof Error) { + return ex.message; + } + + return JSON.stringify(ex); +} diff --git a/tools/webide/packages/client/src/setupProxy.js b/tools/webide/packages/client/src/setupProxy.js new file mode 100644 index 000000000..b50059100 --- /dev/null +++ b/tools/webide/packages/client/src/setupProxy.js @@ -0,0 +1,11 @@ +const proxy = require('http-proxy-middleware'); + +module.exports = function(app) { + app.use( + '/api', + proxy({ + target: 'http://localhost:8080', + changeOrigin: true + }) + ); +}; diff --git a/tools/webide/packages/client/tsconfig.json b/tools/webide/packages/client/tsconfig.json new file mode 100644 index 000000000..af10394b4 --- /dev/null +++ b/tools/webide/packages/client/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react" + }, + "include": ["src"] +} diff --git a/tools/webide/packages/e2e/Dockerfile b/tools/webide/packages/e2e/Dockerfile new file mode 100644 index 000000000..a4f0daefd --- /dev/null +++ b/tools/webide/packages/e2e/Dockerfile @@ -0,0 +1,12 @@ +FROM alekzonder/puppeteer:latest as puppeteer + +WORKDIR /app + +COPY package.json package.json +COPY package-lock.json package-lock.json +COPY jest-puppeteer.config.js jest-puppeteer.config.js +COPY test test + +RUN npm ci + +ENTRYPOINT [ "npm", "run", "test" ] diff --git a/tools/webide/packages/e2e/docker-compose.yml b/tools/webide/packages/e2e/docker-compose.yml new file mode 100644 index 000000000..1899d9c26 --- /dev/null +++ b/tools/webide/packages/e2e/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3' +services: + webide: + image: "${WEBIDE_IMAGE}" + environment: + - DATA_DIR=/tmp + volumes: + - /tmp:/tmp + logging: + driver: none + e2e: + build: . + environment: + - API_HOST=http://webide:8080 + volumes: + - /tmp:/tmp + depends_on: + - webide diff --git a/tools/webide/packages/e2e/jest-puppeteer.config.js b/tools/webide/packages/e2e/jest-puppeteer.config.js new file mode 100644 index 000000000..3560bddd6 --- /dev/null +++ b/tools/webide/packages/e2e/jest-puppeteer.config.js @@ -0,0 +1,13 @@ +module.exports = { + launch: { + args: [ + '--no-sandbox', + '--disable-setuid-sandbox' + ], + defaultViewport: { + width: 1920, + height: 1080 + }, + headless: true + } +}; diff --git a/tools/webide/packages/e2e/package-lock.json b/tools/webide/packages/e2e/package-lock.json new file mode 100644 index 000000000..3d3a35125 --- /dev/null +++ b/tools/webide/packages/e2e/package-lock.json @@ -0,0 +1,4820 @@ +{ + "name": "e2e", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/core": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.4.tgz", + "integrity": "sha512-Rm0HGw101GY8FTzpWSyRbki/jzq+/PkNQJ+nSulrdY6gFGOsNseCqD6KHRYe2E+EdzuBdr2pxCp6s4Uk6eJ+XQ==", + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.6.4", + "@babel/helpers": "^7.6.2", + "@babel/parser": "^7.6.4", + "@babel/template": "^7.6.0", + "@babel/traverse": "^7.6.3", + "@babel/types": "^7.6.3", + "convert-source-map": "^1.1.0", + "debug": "^4.1.0", + "json5": "^2.1.0", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + } + } + }, + "@babel/generator": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.6.4.tgz", + "integrity": "sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w==", + "requires": { + "@babel/types": "^7.6.3", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + } + } + }, + "@babel/helper-function-name": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", + "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", + "requires": { + "@babel/helper-get-function-arity": "^7.0.0", + "@babel/template": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", + "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", + "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==" + }, + "@babel/helper-split-export-declaration": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", + "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", + "requires": { + "@babel/types": "^7.4.4" + } + }, + "@babel/helpers": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.6.2.tgz", + "integrity": "sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA==", + "requires": { + "@babel/template": "^7.6.0", + "@babel/traverse": "^7.6.2", + "@babel/types": "^7.6.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.4.tgz", + "integrity": "sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A==" + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz", + "integrity": "sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, + "@babel/template": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.6.0.tgz", + "integrity": "sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.6.0", + "@babel/types": "^7.6.0" + } + }, + "@babel/traverse": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.6.3.tgz", + "integrity": "sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw==", + "requires": { + "@babel/code-frame": "^7.5.5", + "@babel/generator": "^7.6.3", + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/parser": "^7.6.3", + "@babel/types": "^7.6.3", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@babel/types": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.3.tgz", + "integrity": "sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA==", + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "@cnakazawa/watch": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz", + "integrity": "sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA==", + "requires": { + "exec-sh": "^0.3.2", + "minimist": "^1.2.0" + } + }, + "@hapi/address": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.2.tgz", + "integrity": "sha512-O4QDrx+JoGKZc6aN64L04vqa7e41tIiLU+OvKdcYaEMP97UttL0f9GIi9/0A4WAMx0uBd6SidDIhktZhgOcN8Q==" + }, + "@hapi/bourne": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz", + "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==" + }, + "@hapi/hoek": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.3.0.tgz", + "integrity": "sha512-C0QL9bmgUXTSuf8nDeGrpMjtJG7tPUr8wG6/wxPbP62tGwCwQtdMSJYfESowmY4P3Hn593f+8OzNY5bckcu/LQ==" + }, + "@hapi/joi": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz", + "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==", + "requires": { + "@hapi/address": "2.x.x", + "@hapi/bourne": "1.x.x", + "@hapi/hoek": "8.x.x", + "@hapi/topo": "3.x.x" + } + }, + "@hapi/topo": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.5.tgz", + "integrity": "sha512-bi9m1jrui9LlvtVdLaHv0DqeOoe+I8dep+nEcTgW6XxJHL3xArQcilYz3tIp0cRC4gWlsVtABK7vNKg4jzEmAA==", + "requires": { + "@hapi/hoek": "8.x.x" + } + }, + "@jest/console": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", + "integrity": "sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ==", + "requires": { + "@jest/source-map": "^24.9.0", + "chalk": "^2.0.1", + "slash": "^2.0.0" + } + }, + "@jest/core": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.9.0.tgz", + "integrity": "sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A==", + "requires": { + "@jest/console": "^24.7.1", + "@jest/reporters": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "graceful-fs": "^4.1.15", + "jest-changed-files": "^24.9.0", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-resolve-dependencies": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "jest-watcher": "^24.9.0", + "micromatch": "^3.1.10", + "p-each-series": "^1.0.0", + "realpath-native": "^1.1.0", + "rimraf": "^2.5.4", + "slash": "^2.0.0", + "strip-ansi": "^5.0.0" + } + }, + "@jest/environment": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.9.0.tgz", + "integrity": "sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==", + "requires": { + "@jest/fake-timers": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0" + } + }, + "@jest/fake-timers": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.9.0.tgz", + "integrity": "sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A==", + "requires": { + "@jest/types": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0" + } + }, + "@jest/reporters": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.9.0.tgz", + "integrity": "sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw==", + "requires": { + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.2", + "istanbul-lib-coverage": "^2.0.2", + "istanbul-lib-instrument": "^3.0.1", + "istanbul-lib-report": "^2.0.4", + "istanbul-lib-source-maps": "^3.0.1", + "istanbul-reports": "^2.2.6", + "jest-haste-map": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.6.0", + "node-notifier": "^5.4.2", + "slash": "^2.0.0", + "source-map": "^0.6.0", + "string-length": "^2.0.0" + } + }, + "@jest/source-map": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.9.0.tgz", + "integrity": "sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg==", + "requires": { + "callsites": "^3.0.0", + "graceful-fs": "^4.1.15", + "source-map": "^0.6.0" + } + }, + "@jest/test-result": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz", + "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==", + "requires": { + "@jest/console": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/istanbul-lib-coverage": "^2.0.0" + } + }, + "@jest/test-sequencer": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz", + "integrity": "sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A==", + "requires": { + "@jest/test-result": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0" + } + }, + "@jest/transform": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.9.0.tgz", + "integrity": "sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==", + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^24.9.0", + "babel-plugin-istanbul": "^5.1.0", + "chalk": "^2.0.1", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.1.15", + "jest-haste-map": "^24.9.0", + "jest-regex-util": "^24.9.0", + "jest-util": "^24.9.0", + "micromatch": "^3.1.10", + "pirates": "^4.0.1", + "realpath-native": "^1.1.0", + "slash": "^2.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "2.4.1" + } + }, + "@jest/types": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", + "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^13.0.0" + } + }, + "@types/babel__core": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz", + "integrity": "sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA==", + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.0.tgz", + "integrity": "sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw==", + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz", + "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==", + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.7.tgz", + "integrity": "sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw==", + "requires": { + "@babel/types": "^7.3.0" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", + "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==" + }, + "@types/istanbul-lib-report": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", + "integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==", + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", + "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", + "requires": { + "@types/istanbul-lib-coverage": "*", + "@types/istanbul-lib-report": "*" + } + }, + "@types/stack-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==" + }, + "@types/yargs": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.3.tgz", + "integrity": "sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-13.1.0.tgz", + "integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==" + }, + "abab": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.2.tgz", + "integrity": "sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg==" + }, + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" + }, + "acorn-globals": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "requires": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + }, + "dependencies": { + "acorn": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", + "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==" + } + } + }, + "acorn-walk": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==" + }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==" + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=" + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=" + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==" + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "babel-jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz", + "integrity": "sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw==", + "requires": { + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/babel__core": "^7.1.0", + "babel-plugin-istanbul": "^5.1.0", + "babel-preset-jest": "^24.9.0", + "chalk": "^2.4.2", + "slash": "^2.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz", + "integrity": "sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "find-up": "^3.0.0", + "istanbul-lib-instrument": "^3.3.0", + "test-exclude": "^5.2.3" + } + }, + "babel-plugin-jest-hoist": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz", + "integrity": "sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==", + "requires": { + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz", + "integrity": "sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg==", + "requires": { + "@babel/plugin-syntax-object-rest-spread": "^7.0.0", + "babel-plugin-jest-hoist": "^24.9.0" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "browser-process-hrtime": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", + "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==" + }, + "browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" + } + } + }, + "bser": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.0.tgz", + "integrity": "sha512-8zsjWrQkkBoLK6uxASk1nJ2SKv97ltiGDo6A3wA0/yRPz+CwmEyDo0hUrhIuukG2JHpAl3bvFIixw2/3Hi0DOg==", + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "capture-exit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", + "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==", + "requires": { + "rsvp": "^4.8.4" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "clone-deep": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-0.2.4.tgz", + "integrity": "sha1-TnPdCen7lxzDhnDF3O2cGJZIHMY=", + "requires": { + "for-own": "^0.1.3", + "is-plain-object": "^2.0.1", + "kind-of": "^3.0.2", + "lazy-cache": "^1.0.3", + "shallow-clone": "^0.1.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==" + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" + }, + "core-js": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", + "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + }, + "cssstyle": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", + "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", + "requires": { + "cssom": "0.3.x" + } + }, + "cwd": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/cwd/-/cwd-0.10.0.tgz", + "integrity": "sha1-FyQAaUBXwioTsM8WFix+S3p/5Wc=", + "requires": { + "find-pkg": "^0.1.2", + "fs-exists-sync": "^0.1.0" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "data-urls": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", + "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", + "requires": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.2.0", + "whatwg-url": "^7.0.0" + }, + "dependencies": { + "whatwg-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", + "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + } + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "requires": { + "object-keys": "^1.0.12" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "detect-newline": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=" + }, + "diff-sequences": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz", + "integrity": "sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==" + }, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "requires": { + "webidl-conversions": "^4.0.2" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.15.0.tgz", + "integrity": "sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ==", + "requires": { + "es-to-primitive": "^1.2.0", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.0", + "is-callable": "^1.1.4", + "is-regex": "^1.0.4", + "object-inspect": "^1.6.0", + "object-keys": "^1.1.1", + "string.prototype.trimleft": "^2.1.0", + "string.prototype.trimright": "^2.1.0" + } + }, + "es-to-primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", + "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "requires": { + "es6-promise": "^4.0.3" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "escodegen": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.12.0.tgz", + "integrity": "sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg==", + "requires": { + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + } + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "exec-sh": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.2.tgz", + "integrity": "sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg==" + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-tilde": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-1.2.2.tgz", + "integrity": "sha1-C4HrqJflo9MdHD0QL48BRB5VlEk=", + "requires": { + "os-homedir": "^1.0.1" + } + }, + "expect": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-24.9.0.tgz", + "integrity": "sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q==", + "requires": { + "@jest/types": "^24.9.0", + "ansi-styles": "^3.2.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.9.0" + } + }, + "expect-puppeteer": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/expect-puppeteer/-/expect-puppeteer-4.3.0.tgz", + "integrity": "sha512-p8N/KSVPG9PAOJlftK5f1n3JrULJ6Qq1EQ8r/n9xzkX2NmXbK8PcnJnkSAEzEHrMycELKGnlJV7M5nkgm+wEWA==" + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "requires": { + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, + "fb-watchman": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", + "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", + "requires": { + "bser": "^2.0.0" + } + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "requires": { + "pend": "~1.2.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "find-file-up": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/find-file-up/-/find-file-up-0.1.3.tgz", + "integrity": "sha1-z2gJG8+fMApA2kEbN9pczlovvqA=", + "requires": { + "fs-exists-sync": "^0.1.0", + "resolve-dir": "^0.1.0" + } + }, + "find-pkg": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/find-pkg/-/find-pkg-0.1.2.tgz", + "integrity": "sha1-G9wiwG42NlUy4qJIBGhUuXiNpVc=", + "requires": { + "find-file-up": "^0.1.2" + } + }, + "find-process": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/find-process/-/find-process-1.4.2.tgz", + "integrity": "sha512-O83EVJr4dWvHJ7QpUzANNAMeQVKukRzRqRx4AIzdLYRrQorRdbqDwLPigkd9PYPhJRhmNPAoVjOm9bcwSmcZaw==", + "requires": { + "chalk": "^2.0.1", + "commander": "^2.11.0", + "debug": "^2.6.8" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "requires": { + "for-in": "^1.0.1" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-exists-sync": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", + "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", + "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==", + "optional": true, + "requires": { + "nan": "^2.12.1", + "node-pre-gyp": "^0.12.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "optional": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "optional": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.1", + "bundled": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "optional": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "debug": { + "version": "4.1.1", + "bundled": true, + "optional": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.3", + "bundled": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "optional": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "optional": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "optional": true + }, + "minipass": { + "version": "2.3.5", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.2.1", + "bundled": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "optional": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.1.1", + "bundled": true, + "optional": true + }, + "needle": { + "version": "2.3.0", + "bundled": true, + "optional": true, + "requires": { + "debug": "^4.1.0", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.12.0", + "bundled": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.6", + "bundled": true, + "optional": true + }, + "npm-packlist": { + "version": "1.4.1", + "bundled": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "optional": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "optional": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.3", + "bundled": true, + "optional": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "optional": true + }, + "semver": { + "version": "5.7.0", + "bundled": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "tar": { + "version": "4.4.8", + "bundled": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "yallist": { + "version": "3.0.3", + "bundled": true, + "optional": true + } + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "global-modules": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", + "integrity": "sha1-6lo77ULG1s6ZWk+KEmm12uIjgo0=", + "requires": { + "global-prefix": "^0.1.4", + "is-windows": "^0.2.0" + }, + "dependencies": { + "is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=" + } + } + }, + "global-prefix": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", + "integrity": "sha1-jTvGuNo8qBEqFg2NSW/wRiv+948=", + "requires": { + "homedir-polyfill": "^1.0.0", + "ini": "^1.3.4", + "is-windows": "^0.2.0", + "which": "^1.2.12" + }, + "dependencies": { + "is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=" + } + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + }, + "graceful-fs": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", + "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==" + }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" + }, + "handlebars": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.3.tgz", + "integrity": "sha512-B0W4A2U1ww3q7VVthTKfh+epHx+q4mCt6iK+zEAzbMBpWQAwxCeKxEGpj/1oQTpzPXDNSOG7hmG14TsISH50yw==", + "requires": { + "neo-async": "^2.6.0", + "optimist": "^0.6.1", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "hosted-git-info": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", + "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==" + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "requires": { + "whatwg-encoding": "^1.0.1" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-proxy-agent": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", + "integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "requires": { + "loose-envify": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==" + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "^3.0.1" + } + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "requires": { + "has": "^1.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-symbol": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", + "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "requires": { + "has-symbols": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==" + }, + "istanbul-lib-instrument": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", + "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "requires": { + "@babel/generator": "^7.4.0", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", + "istanbul-lib-coverage": "^2.0.5", + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "requires": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", + "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "rimraf": "^2.6.3", + "source-map": "^0.6.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "istanbul-reports": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz", + "integrity": "sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA==", + "requires": { + "handlebars": "^4.1.2" + } + }, + "jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-24.9.0.tgz", + "integrity": "sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw==", + "requires": { + "import-local": "^2.0.0", + "jest-cli": "^24.9.0" + }, + "dependencies": { + "jest-cli": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.9.0.tgz", + "integrity": "sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg==", + "requires": { + "@jest/core": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "import-local": "^2.0.0", + "is-ci": "^2.0.0", + "jest-config": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "prompts": "^2.0.1", + "realpath-native": "^1.1.0", + "yargs": "^13.3.0" + } + } + } + }, + "jest-changed-files": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz", + "integrity": "sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg==", + "requires": { + "@jest/types": "^24.9.0", + "execa": "^1.0.0", + "throat": "^4.0.0" + } + }, + "jest-config": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz", + "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==", + "requires": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^24.9.0", + "@jest/types": "^24.9.0", + "babel-jest": "^24.9.0", + "chalk": "^2.0.1", + "glob": "^7.1.1", + "jest-environment-jsdom": "^24.9.0", + "jest-environment-node": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "micromatch": "^3.1.10", + "pretty-format": "^24.9.0", + "realpath-native": "^1.1.0" + } + }, + "jest-dev-server": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/jest-dev-server/-/jest-dev-server-4.3.0.tgz", + "integrity": "sha512-bC9flKY2G1honQ/UI0gEhb0wFnDhpFr7xidC8Nk+evi7TgnNtfsGIzzF2dcIhF1G9BGF0n/M7CJrMAzwQhyTPA==", + "requires": { + "chalk": "^2.4.2", + "cwd": "^0.10.0", + "find-process": "^1.4.2", + "prompts": "^2.1.0", + "spawnd": "^4.0.0", + "tree-kill": "^1.2.1", + "wait-on": "^3.3.0" + } + }, + "jest-diff": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz", + "integrity": "sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==", + "requires": { + "chalk": "^2.0.1", + "diff-sequences": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-docblock": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.9.0.tgz", + "integrity": "sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA==", + "requires": { + "detect-newline": "^2.1.0" + } + }, + "jest-each": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.9.0.tgz", + "integrity": "sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog==", + "requires": { + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-environment-jsdom": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz", + "integrity": "sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA==", + "requires": { + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0", + "jsdom": "^11.5.1" + } + }, + "jest-environment-node": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.9.0.tgz", + "integrity": "sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA==", + "requires": { + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0" + } + }, + "jest-environment-puppeteer": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/jest-environment-puppeteer/-/jest-environment-puppeteer-4.3.0.tgz", + "integrity": "sha512-ZighMsU39bnacn2ylyHb88CB+ldgCfXGD3lS78k4PEo8A8xyt6+2mxmSR62FH3Y7K+W2gPDu5+QM3/LZuq42fQ==", + "requires": { + "chalk": "^2.4.2", + "cwd": "^0.10.0", + "jest-dev-server": "^4.3.0", + "merge-deep": "^3.0.2" + } + }, + "jest-get-type": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz", + "integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==" + }, + "jest-haste-map": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.9.0.tgz", + "integrity": "sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ==", + "requires": { + "@jest/types": "^24.9.0", + "anymatch": "^2.0.0", + "fb-watchman": "^2.0.0", + "fsevents": "^1.2.7", + "graceful-fs": "^4.1.15", + "invariant": "^2.2.4", + "jest-serializer": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.9.0", + "micromatch": "^3.1.10", + "sane": "^4.0.3", + "walker": "^1.0.7" + } + }, + "jest-jasmine2": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz", + "integrity": "sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==", + "requires": { + "@babel/traverse": "^7.1.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "co": "^4.6.0", + "expect": "^24.9.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0", + "throat": "^4.0.0" + } + }, + "jest-leak-detector": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz", + "integrity": "sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==", + "requires": { + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-matcher-utils": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz", + "integrity": "sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==", + "requires": { + "chalk": "^2.0.1", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-message-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.9.0.tgz", + "integrity": "sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/stack-utils": "^1.0.1", + "chalk": "^2.0.1", + "micromatch": "^3.1.10", + "slash": "^2.0.0", + "stack-utils": "^1.0.1" + } + }, + "jest-mock": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.9.0.tgz", + "integrity": "sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w==", + "requires": { + "@jest/types": "^24.9.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", + "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==" + }, + "jest-puppeteer": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/jest-puppeteer/-/jest-puppeteer-4.3.0.tgz", + "integrity": "sha512-WXhaWlbQl01xadZyNmdZntrtIr8uWUmgjPogDih7dOnr3G/xRr3A034SCqdjwV6fE0tqz7c5hwO8oBTyGZPRgA==", + "requires": { + "expect-puppeteer": "^4.3.0", + "jest-environment-puppeteer": "^4.3.0" + } + }, + "jest-regex-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.9.0.tgz", + "integrity": "sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA==" + }, + "jest-resolve": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.9.0.tgz", + "integrity": "sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ==", + "requires": { + "@jest/types": "^24.9.0", + "browser-resolve": "^1.11.3", + "chalk": "^2.0.1", + "jest-pnp-resolver": "^1.2.1", + "realpath-native": "^1.1.0" + } + }, + "jest-resolve-dependencies": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz", + "integrity": "sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g==", + "requires": { + "@jest/types": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-snapshot": "^24.9.0" + } + }, + "jest-runner": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.9.0.tgz", + "integrity": "sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg==", + "requires": { + "@jest/console": "^24.7.1", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.4.2", + "exit": "^0.1.2", + "graceful-fs": "^4.1.15", + "jest-config": "^24.9.0", + "jest-docblock": "^24.3.0", + "jest-haste-map": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-leak-detector": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.6.0", + "source-map-support": "^0.5.6", + "throat": "^4.0.0" + } + }, + "jest-runtime": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.9.0.tgz", + "integrity": "sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==", + "requires": { + "@jest/console": "^24.7.1", + "@jest/environment": "^24.9.0", + "@jest/source-map": "^24.3.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.1.15", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "realpath-native": "^1.1.0", + "slash": "^2.0.0", + "strip-bom": "^3.0.0", + "yargs": "^13.3.0" + } + }, + "jest-serializer": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-24.9.0.tgz", + "integrity": "sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==" + }, + "jest-snapshot": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.9.0.tgz", + "integrity": "sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew==", + "requires": { + "@babel/types": "^7.0.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "expect": "^24.9.0", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "pretty-format": "^24.9.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "jest-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz", + "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==", + "requires": { + "@jest/console": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/source-map": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "callsites": "^3.0.0", + "chalk": "^2.0.1", + "graceful-fs": "^4.1.15", + "is-ci": "^2.0.0", + "mkdirp": "^0.5.1", + "slash": "^2.0.0", + "source-map": "^0.6.0" + } + }, + "jest-validate": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", + "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", + "requires": { + "@jest/types": "^24.9.0", + "camelcase": "^5.3.1", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "leven": "^3.1.0", + "pretty-format": "^24.9.0" + } + }, + "jest-watcher": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.9.0.tgz", + "integrity": "sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw==", + "requires": { + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "jest-util": "^24.9.0", + "string-length": "^2.0.0" + } + }, + "jest-worker": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", + "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "jsdom": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", + "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "requires": { + "abab": "^2.0.0", + "acorn": "^5.5.3", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": "^1.0.0", + "data-urls": "^1.0.0", + "domexception": "^1.0.1", + "escodegen": "^1.9.1", + "html-encoding-sniffer": "^1.0.2", + "left-pad": "^1.3.0", + "nwsapi": "^2.0.7", + "parse5": "4.0.0", + "pn": "^1.1.0", + "request": "^2.87.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.3.4", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.3", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^6.4.1", + "ws": "^5.2.0", + "xml-name-validator": "^3.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "json5": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", + "requires": { + "minimist": "^1.2.0" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==" + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" + }, + "left-pad": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==" + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==" + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, + "makeerror": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "requires": { + "tmpl": "1.0.x" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "requires": { + "object-visit": "^1.0.0" + } + }, + "merge-deep": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.2.tgz", + "integrity": "sha512-T7qC8kg4Zoti1cFd8Cr0M+qaZfOwjlPDEdZIIPPB2JZctjaPM4fX+i7HOId69tAti2fvO6X5ldfYUONDODsrkA==", + "requires": { + "arr-union": "^3.1.0", + "clone-deep": "^0.2.4", + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + }, + "mime-db": { + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + }, + "mime-types": { + "version": "2.1.24", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", + "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "requires": { + "mime-db": "1.40.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mixin-object": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", + "integrity": "sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=", + "requires": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "dependencies": { + "for-in": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", + "integrity": "sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=" + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" + }, + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "dev": true + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=" + }, + "node-modules-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", + "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=" + }, + "node-notifier": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz", + "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==", + "requires": { + "growly": "^1.3.0", + "is-wsl": "^1.1.0", + "semver": "^5.5.0", + "shellwords": "^0.1.1", + "which": "^1.3.0" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "nwsapi": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.4.tgz", + "integrity": "sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw==" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-inspect": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", + "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==" + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "requires": { + "isobject": "^3.0.0" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + }, + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + } + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "p-each-series": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-1.0.0.tgz", + "integrity": "sha1-kw89Et0fUOdDRFeiLNbwSsatf3E=", + "requires": { + "p-reduce": "^1.0.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-reduce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz", + "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=" + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=" + }, + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "requires": { + "pify": "^3.0.0" + } + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + }, + "pirates": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", + "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "requires": { + "node-modules-regexp": "^1.0.0" + } + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "requires": { + "find-up": "^3.0.0" + } + }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=" + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, + "pretty-format": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz", + "integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==", + "requires": { + "@jest/types": "^24.9.0", + "ansi-regex": "^4.0.0", + "ansi-styles": "^3.2.0", + "react-is": "^16.8.4" + } + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + }, + "prompts": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.2.1.tgz", + "integrity": "sha512-VObPvJiWPhpZI6C5m60XOzTfnYg/xc/an+r9VYymj9WJW3B/DIH+REzjpAACPf8brwPeP+7vz3bIim3S+AaMjw==", + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.3" + } + }, + "proxy-from-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", + "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=" + }, + "psl": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", + "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "puppeteer": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.20.0.tgz", + "integrity": "sha512-bt48RDBy2eIwZPrkgbcwHtb51mj2nKvHOPMaSH2IsWiv7lOG9k9zhaRzpDZafrk05ajMc3cu+lSQYYOfH2DkVQ==", + "requires": { + "debug": "^4.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^2.2.1", + "mime": "^2.0.3", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^6.1.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "react-is": { + "version": "16.10.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.10.2.tgz", + "integrity": "sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA==" + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "realpath-native": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.1.0.tgz", + "integrity": "sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA==", + "requires": { + "util.promisify": "^1.0.0" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + } + } + }, + "request-promise-core": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", + "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "requires": { + "lodash": "^4.17.11" + } + }, + "request-promise-native": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", + "integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==", + "requires": { + "request-promise-core": "1.1.2", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-dir": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", + "integrity": "sha1-shklmlYC+sXFxJatiUpujMQwJh4=", + "requires": { + "expand-tilde": "^1.2.2", + "global-modules": "^0.2.3" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + }, + "rsvp": { + "version": "4.8.5", + "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", + "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==" + }, + "rx": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz", + "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sane": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", + "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", + "requires": { + "@cnakazawa/watch": "^1.0.3", + "anymatch": "^2.0.0", + "capture-exit": "^2.0.0", + "exec-sh": "^0.3.2", + "execa": "^1.0.0", + "fb-watchman": "^2.0.0", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5" + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "shallow-clone": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-0.1.2.tgz", + "integrity": "sha1-WQnodLp3EG1zrEFM/sH/yofZcGA=", + "requires": { + "is-extendable": "^0.1.1", + "kind-of": "^2.0.1", + "lazy-cache": "^0.2.3", + "mixin-object": "^2.0.1" + }, + "dependencies": { + "kind-of": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-2.0.1.tgz", + "integrity": "sha1-AY7HpM5+OobLkUG+UZ0kyPqpgbU=", + "requires": { + "is-buffer": "^1.0.2" + } + }, + "lazy-cache": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.7.tgz", + "integrity": "sha1-f+3fLctu23fRHvHRF6tf/fCrG2U=" + } + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "sisteransi": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.3.tgz", + "integrity": "sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg==" + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==" + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" + }, + "spawnd": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/spawnd/-/spawnd-4.0.0.tgz", + "integrity": "sha512-ql3qhJnhAkvXpaqKBWOqou1rUTSQhFRaZkyOT+MTFB4xY3X+brgw6LTWV2wHuE9A6YPhrNe1cbg7S+jAYnbC0Q==", + "requires": { + "exit": "^0.1.2", + "signal-exit": "^3.0.2", + "tree-kill": "^1.2.1", + "wait-port": "^0.2.2" + } + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==" + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==" + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stack-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", + "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==" + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + }, + "string-length": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "requires": { + "astral-regex": "^1.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "string.prototype.trimleft": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", + "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimright": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", + "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" + }, + "test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "requires": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + } + }, + "throat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=" + }, + "tmpl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "^2.1.0" + } + }, + "tree-kill": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.1.tgz", + "integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "uglify-js": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.1.tgz", + "integrity": "sha512-+dSJLJpXBb6oMHP+Yvw8hUgElz4gLTh82XuX68QiJVTXaE5ibl6buzhNkQdYhBlIhozWOC9ge16wyRmjG4TwVQ==", + "optional": true, + "requires": { + "commander": "2.20.0", + "source-map": "~0.6.1" + } + }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=" + } + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, + "uuid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "requires": { + "browser-process-hrtime": "^0.1.2" + } + }, + "wait-on": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-3.3.0.tgz", + "integrity": "sha512-97dEuUapx4+Y12aknWZn7D25kkjMk16PbWoYzpSdA8bYpVfS6hpl2a2pOWZ3c+Tyt3/i4/pglyZctG3J4V1hWQ==", + "requires": { + "@hapi/joi": "^15.0.3", + "core-js": "^2.6.5", + "minimist": "^1.2.0", + "request": "^2.88.0", + "rx": "^4.1.0" + } + }, + "wait-port": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/wait-port/-/wait-port-0.2.6.tgz", + "integrity": "sha512-nXE5Yp0Zs1obhFVc0Da7WVJc3y0LxoCq3j4mtV0NdI5P/ZvRdKp5yhuojvMOcOxSwpQL1hGbOgMNQ+4wpRpwCA==", + "requires": { + "chalk": "^2.4.2", + "commander": "^3.0.2", + "debug": "^4.1.1" + }, + "dependencies": { + "commander": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "walker": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "requires": { + "makeerror": "1.0.x" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", + "requires": { + "iconv-lite": "0.4.24" + } + }, + "whatwg-mimetype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" + }, + "whatwg-url": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", + "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write-file-atomic": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.1.tgz", + "integrity": "sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg==", + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yargs": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "requires": { + "fd-slicer": "~1.0.1" + } + } + } +} diff --git a/tools/webide/packages/e2e/package.json b/tools/webide/packages/e2e/package.json new file mode 100644 index 000000000..2260071a8 --- /dev/null +++ b/tools/webide/packages/e2e/package.json @@ -0,0 +1,22 @@ +{ + "name": "e2e", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "jest --runInBand" + }, + "jest": { + "preset": "jest-puppeteer" + }, + "author": "", + "license": "ISC", + "dependencies": { + "jest": "^24.9.0", + "jest-puppeteer": "^4.3.0", + "puppeteer": "^1.20.0" + }, + "devDependencies": { + "node-fetch": "^2.6.0" + } +} diff --git a/tools/webide/packages/e2e/test/common-utils.js b/tools/webide/packages/e2e/test/common-utils.js new file mode 100644 index 000000000..4b6c53cc1 --- /dev/null +++ b/tools/webide/packages/e2e/test/common-utils.js @@ -0,0 +1,112 @@ +const fetch = require('node-fetch'); + +// +// Generic utils +// +exports.sleep = (time) => { + return new Promise((resolve) => setTimeout(resolve, time)); +}; + +exports.clearText = async keyboard => { + await keyboard.down('Shift'); + for (let i = 0; i < 100; i++) { + await keyboard.press('ArrowUp'); + } + await keyboard.up('Shift'); + await keyboard.press('Backspace'); + await keyboard.down('Shift'); + for (let i = 0; i < 100; i++) { + await keyboard.press('ArrowDown'); + } + await keyboard.up('Shift'); + await keyboard.press('Backspace'); +}; + +exports.createResponseCallback = (page, url) => { + return new Promise(resolve => { + page.on('response', function callback(response) { + if (response.url() === url) { + resolve(response); + page.removeListener('response', callback); + } + }); + }); +}; + +exports.getInnerText = id => { + let element = document.getElementById(id); + return element && element.textContent; +}; + +exports.getInputValue = id => { + let element = document.getElementById(id); + return element && element.value; +}; + +// +// Application specific utils +// +exports.API_HOST = process.env['API_HOST'] || 'http://127.0.0.1:8080'; +exports.API_ROOT = `${exports.API_HOST}/api`; + +exports.fetchExamples = async () => (await fetch(`${exports.API_HOST}/static/examples/list`)).json(); + +exports.runCommandAndGetOutputFor = async (command, endpoint) => { + await page.click('#configure-tab'); + await exports.sleep(1000); + + await page.click('#command-select'); + await page.click(`#${command}`); + + // Gotta create response callback before clicking run because some responses are too fast + const responseCallback = exports.createResponseCallback(page, `${exports.API_ROOT}/${endpoint}`); + + await page.click('#run'); + await responseCallback; + + return page.evaluate(exports.getInnerText, 'output'); +}; + +exports.verifyAllExamples = async (action, done) => { + const examples = await exports.fetchExamples(); + + for (example of examples) { + await page.click(`#${example.id}`); + + expect(await action()).not.toContain('Error: '); + } + + done(); +}; + +exports.verifyWithBlankParameter = async (command, parameter, action, done) => { + await page.click('#command-select'); + await page.click(`#${command}`); + + await page.click(`#${parameter}`); + await exports.clearText(page.keyboard); + + expect(await action()).toEqual(`Error: "${parameter}" is not allowed to be empty`); + + done(); +} + +exports.verifyEntrypointBlank = async (command, action, done) => { + exports.verifyWithBlankParameter(command, 'entrypoint', action, done); +} + +exports.verifyParametersBlank = async (command, action, done) => { + exports.verifyWithBlankParameter(command, 'parameters', action, done); +} + +exports.verifyStorageBlank = async (command, action, done) => { + exports.verifyWithBlankParameter(command, 'storage', action, done); +} + +exports.verifyWithCompilationError = async (action, done) => { + await page.click('#editor'); + await page.keyboard.type('asdf'); + + expect(await action()).toContain('Error: '); + done(); +}; diff --git a/tools/webide/packages/e2e/test/compile-contract.spec.js b/tools/webide/packages/e2e/test/compile-contract.spec.js new file mode 100644 index 000000000..548da261b --- /dev/null +++ b/tools/webide/packages/e2e/test/compile-contract.spec.js @@ -0,0 +1,34 @@ +const commonUtils = require('./common-utils'); + +const API_HOST = commonUtils.API_HOST; + +const runCommandAndGetOutputFor = commonUtils.runCommandAndGetOutputFor; + +const verifyEntrypointBlank = commonUtils.verifyEntrypointBlank; +const verifyAllExamples = commonUtils.verifyAllExamples; +const verifyWithCompilationError = commonUtils.verifyWithCompilationError; + +const COMMAND = 'compile'; +const COMMAND_ENDPOINT = 'compile-contract'; + +async function action() { + return await runCommandAndGetOutputFor(COMMAND, COMMAND_ENDPOINT); +} + +describe('Compile contract', () => { + beforeAll(() => jest.setTimeout(60000)); + + beforeEach(async () => await page.goto(API_HOST)); + + it('should compile for each examples', async done => { + verifyAllExamples(action, done); + }); + + it('should return an error when entrypoint is blank', async done => { + verifyEntrypointBlank(COMMAND, action, done); + }); + + it('should return an error when code has compilation error', async done => { + verifyWithCompilationError(action, done); + }); +}); diff --git a/tools/webide/packages/e2e/test/dry-run.spec.js b/tools/webide/packages/e2e/test/dry-run.spec.js new file mode 100644 index 000000000..cedd627e0 --- /dev/null +++ b/tools/webide/packages/e2e/test/dry-run.spec.js @@ -0,0 +1,44 @@ +const commonUtils = require('./common-utils'); + +const API_HOST = commonUtils.API_HOST; + +const runCommandAndGetOutputFor = commonUtils.runCommandAndGetOutputFor; + +const verifyAllExamples = commonUtils.verifyAllExamples; +const verifyEntrypointBlank = commonUtils.verifyEntrypointBlank; +const verifyParametersBlank = commonUtils.verifyParametersBlank; +const verifyStorageBlank = commonUtils.verifyStorageBlank; +const verifyWithCompilationError = commonUtils.verifyWithCompilationError; + +const COMMAND = 'dry-run'; +const COMMAND_ENDPOINT = 'dry-run'; + +async function action() { + return await runCommandAndGetOutputFor(COMMAND, COMMAND_ENDPOINT); +} + +describe('Dry run contract', () => { + beforeAll(() => jest.setTimeout(60000)); + + beforeEach(async () => await page.goto(API_HOST)); + + it('should dry run for examples', async done => { + verifyAllExamples(action, done); + }); + + it('should return an error when entrypoint is blank', async done => { + verifyEntrypointBlank(COMMAND, action, done); + }); + + it('should return an error when parameters is blank', async done => { + verifyParametersBlank(COMMAND, action, done); + }); + + it('should return an error when storage is blank', async done => { + verifyStorageBlank(COMMAND, action, done); + }); + + it('should return an error when code has compilation error', async done => { + verifyWithCompilationError(action, done); + }); +}); diff --git a/tools/webide/packages/e2e/test/evaluate-function.spec.js b/tools/webide/packages/e2e/test/evaluate-function.spec.js new file mode 100644 index 000000000..c1ce73edd --- /dev/null +++ b/tools/webide/packages/e2e/test/evaluate-function.spec.js @@ -0,0 +1,39 @@ +const commonUtils = require('./common-utils'); + +const API_HOST = commonUtils.API_HOST; + +const runCommandAndGetOutputFor = commonUtils.runCommandAndGetOutputFor; + +const verifyAllExamples = commonUtils.verifyAllExamples; +const verifyEntrypointBlank = commonUtils.verifyEntrypointBlank; +const verifyParametersBlank = commonUtils.verifyParametersBlank; +const verifyWithCompilationError = commonUtils.verifyWithCompilationError; + +const COMMAND = 'evaluate-function'; +const COMMAND_ENDPOINT = 'run-function'; + +async function action() { + return await runCommandAndGetOutputFor(COMMAND, COMMAND_ENDPOINT); +} + +describe('Evaluate function', () => { + beforeAll(() => jest.setTimeout(60000)); + + beforeEach(async () => await page.goto(API_HOST)); + + it('should evaluate function for each examples', async done => { + verifyAllExamples(action, done); + }); + + it('should return an error when entrypoint is blank', async done => { + verifyEntrypointBlank(COMMAND, action, done); + }); + + it('should return an error when parameters is blank', async done => { + verifyParametersBlank(COMMAND, action, done); + }); + + it('should return an error when code has compilation error', async done => { + verifyWithCompilationError(action, done); + }); +}); diff --git a/tools/webide/packages/e2e/test/share.spec.js b/tools/webide/packages/e2e/test/share.spec.js new file mode 100644 index 000000000..40b84fd11 --- /dev/null +++ b/tools/webide/packages/e2e/test/share.spec.js @@ -0,0 +1,210 @@ +const commonUtils = require('./common-utils'); +const fs = require('fs'); + +const API_HOST = commonUtils.API_HOST; +const API_ROOT = commonUtils.API_ROOT; + +const getInnerText = commonUtils.getInnerText; +const getInputValue = commonUtils.getInputValue; +const createResponseCallback = commonUtils.createResponseCallback; +const clearText = commonUtils.clearText; + +describe('Share', () => { + beforeAll(() => jest.setTimeout(60000)); + + it('should generate a link', async done => { + await page.goto(API_HOST); + + await page.click('#editor'); + await clearText(page.keyboard); + await page.keyboard.type('asdf'); + + const responseCallback = createResponseCallback(page, `${API_ROOT}/share`); + await page.click('#share'); + await responseCallback; + + const actualShareLink = await page.evaluate(getInputValue, 'share-link'); + const expectedShareLink = `${API_HOST}/p/sIpy-2D9ExpCojwuBNw_-g`; + + expect(actualShareLink).toEqual(expectedShareLink); + done(); + }); + + it('should work with v0 schema', async done => { + const id = 'v0-schema'; + const expectedShareLink = `${API_HOST}/p/${id}`; + const v0State = { + language: 'cameligo', + code: 'somecode', + entrypoint: 'main', + parameters: '1', + storage: '2' + }; + fs.writeFileSync(`/tmp/${id}.txt`, JSON.stringify(v0State)); + + await page.goto(expectedShareLink); + + // Check share link is correct + const actualShareLink = await page.evaluate(getInputValue, 'share-link'); + expect(actualShareLink).toEqual(expectedShareLink); + + // Check the code is correct. Note, because we are getting inner text we will get + // a line number as well. Therefore the expected value has a '1' prefix + const actualCode = await page.evaluate(getInnerText, 'editor'); + expect(actualCode).toContain(`1${v0State.code}`); + + // Check compile configuration + await page.click('#command-select'); + await page.click('#compile'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v0State.entrypoint + ); + + // Check dry run configuration + await page.click('#command-select'); + await page.click('#dry-run'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v0State.entrypoint + ); + expect(await page.evaluate(getInputValue, 'parameters')).toEqual( + v0State.parameters + ); + expect(await page.evaluate(getInputValue, 'storage')).toEqual( + v0State.storage + ); + + // Check deploy configuration + await page.click('#command-select'); + await page.click('#deploy'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v0State.entrypoint + ); + expect(await page.evaluate(getInputValue, 'storage')).toEqual( + v0State.storage + ); + + // Check evaluate function configuration + await page.click('#command-select'); + await page.click('#evaluate-function'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v0State.entrypoint + ); + expect(await page.evaluate(getInputValue, 'parameters')).toEqual( + v0State.parameters + ); + + // Check evaluate value configuration + await page.click('#command-select'); + await page.click('#evaluate-value'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v0State.entrypoint + ); + + done(); + }); + + it('should work with v1 schema', async done => { + const id = 'v1-schema'; + const expectedShareLink = `${API_HOST}/p/${id}`; + const v1State = { + version: 'v1', + state: { + editor: { + language: 'cameligo', + code: 'somecode' + }, + compile: { + entrypoint: 'main' + }, + dryRun: { + entrypoint: 'main', + parameters: '1', + storage: '2' + }, + deploy: { + entrypoint: 'main', + storage: '3', + useTezBridge: false + }, + evaluateFunction: { + entrypoint: 'add', + parameters: '(1, 2)' + }, + evaluateValue: { + entrypoint: 'a' + } + } + }; + fs.writeFileSync(`/tmp/${id}.txt`, JSON.stringify(v1State)); + + await page.goto(expectedShareLink); + + // Check share link is correct + const actualShareLink = await page.evaluate(getInputValue, 'share-link'); + expect(actualShareLink).toEqual(expectedShareLink); + + // Check the code is correct. Note, because we are getting inner text we will get + // a line number as well. Therefore the expected value has a '1' prefix + const actualCode = await page.evaluate(getInnerText, 'editor'); + expect(actualCode).toContain(`1${v1State.state.editor.code}`); + + // Check compile configuration + await page.click('#command-select'); + await page.click('#compile'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v1State.state.compile.entrypoint + ); + + // Check dry run configuration + await page.click('#command-select'); + await page.click('#dry-run'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v1State.state.dryRun.entrypoint + ); + expect(await page.evaluate(getInputValue, 'parameters')).toEqual( + v1State.state.dryRun.parameters + ); + expect(await page.evaluate(getInputValue, 'storage')).toEqual( + v1State.state.dryRun.storage + ); + + // Check deploy configuration + await page.click('#command-select'); + await page.click('#deploy'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v1State.state.deploy.entrypoint + ); + expect(await page.evaluate(getInputValue, 'storage')).toEqual( + v1State.state.deploy.storage + ); + + // Check evaluate function configuration + await page.click('#command-select'); + await page.click('#evaluate-function'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v1State.state.evaluateFunction.entrypoint + ); + expect(await page.evaluate(getInputValue, 'parameters')).toEqual( + v1State.state.evaluateFunction.parameters + ); + + // Check evaluate value configuration + await page.click('#command-select'); + await page.click('#evaluate-value'); + + expect(await page.evaluate(getInputValue, 'entrypoint')).toEqual( + v1State.state.evaluateValue.entrypoint + ); + + done(); + }); +}); diff --git a/tools/webide/packages/server/README.md b/tools/webide/packages/server/README.md new file mode 100644 index 000000000..8eca36b66 --- /dev/null +++ b/tools/webide/packages/server/README.md @@ -0,0 +1,22 @@ +# Quick Start + +```sh +yarn start +open http://localhost:8080 +``` + +# Available Scripts + +In the project directory, you can run: + +## `yarn start` + +Runs the server in development mode. This will also start the client. + +## `yarn test` + +Runs tests. + +## `yarn build` + +Builds the application for production to the `dist` folder. diff --git a/tools/webide/packages/server/jest.config.js b/tools/webide/packages/server/jest.config.js new file mode 100644 index 000000000..f6f5efbdd --- /dev/null +++ b/tools/webide/packages/server/jest.config.js @@ -0,0 +1,7 @@ +module.exports = { + roots: ['test'], + testMatch: ['**/?(*.)+(spec|test).+(ts|tsx|js)'], + transform: { + '^.+\\.(ts|tsx)?$': 'ts-jest' + } +}; diff --git a/tools/webide/packages/server/package-lock.json b/tools/webide/packages/server/package-lock.json new file mode 100644 index 000000000..d700b73d3 --- /dev/null +++ b/tools/webide/packages/server/package-lock.json @@ -0,0 +1,7506 @@ +{ + "name": "server", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/core": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.3.tgz", + "integrity": "sha512-4XFkf8AwyrEG7Ziu3L2L0Cv+WyY47Tcsp70JFmpftbAA1K7YL/sgE9jh9HyNj08Y/U50ItUchpN0w6HxAoX1rA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.3", + "@babel/helpers": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.0", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.3.tgz", + "integrity": "sha512-WjoPk8hRpDRqqzRpvaR8/gDUPkrnOOeuT2m8cNICJtZH6mwaCo3v0OKMI7Y6SM1pBtyijnLtAL0HDi41pf41ug==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/helper-function-name": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", + "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", + "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", + "integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==", + "dev": true + }, + "@babel/helper-split-export-declaration": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", + "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helpers": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.3.tgz", + "integrity": "sha512-LmU3q9Pah/XyZU89QvBgGt+BCsTPoQa+73RxAQh8fb8qkDyIfeQnmgs+hvzhTCKTzqOyk7JTkS3MS1S8Mq5yrQ==", + "dev": true, + "requires": { + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/highlight": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", + "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.3.tgz", + "integrity": "sha512-/V72F4Yp/qmHaTALizEm9Gf2eQHV3QyTL3K0cNfijwnMnb1L+LDlAubb/ZnSdGAVzVSWakujHYs1I26x66sMeQ==", + "dev": true + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/template": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.3.tgz", + "integrity": "sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/traverse": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.3.tgz", + "integrity": "sha512-we+a2lti+eEImHmEXp7bM9cTxGzxPmBiVJlLVD+FuuQMeeO7RaDbutbgeheDkw+Xe3mCfJHnGOWLswT74m2IPg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.3", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/types": "^7.8.3", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + } + }, + "@babel/types": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.3.tgz", + "integrity": "sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "@cnakazawa/watch": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz", + "integrity": "sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA==", + "dev": true, + "requires": { + "exec-sh": "^0.3.2", + "minimist": "^1.2.0" + } + }, + "@google-cloud/common": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-2.3.0.tgz", + "integrity": "sha512-nmIyi3q/FL2j6ZJ61xK/863DoJEZayI2/W/iCgwrCYUYsem277XO45MBTAimjgiKBCA0c9InmQyfT48h/IK4jg==", + "requires": { + "@google-cloud/projectify": "^1.0.0", + "@google-cloud/promisify": "^1.0.0", + "arrify": "^2.0.0", + "duplexify": "^3.6.0", + "ent": "^2.2.0", + "extend": "^3.0.2", + "google-auth-library": "^5.5.0", + "retry-request": "^4.0.0", + "teeny-request": "^6.0.0" + } + }, + "@google-cloud/paginator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-2.0.3.tgz", + "integrity": "sha512-kp/pkb2p/p0d8/SKUu4mOq8+HGwF8NPzHWkj+VKrIPQPyMRw8deZtrO/OcSiy9C/7bpfU5Txah5ltUNfPkgEXg==", + "requires": { + "arrify": "^2.0.0", + "extend": "^3.0.2" + } + }, + "@google-cloud/projectify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-1.0.4.tgz", + "integrity": "sha512-ZdzQUN02eRsmTKfBj9FDL0KNDIFNjBn/d6tHQmA/+FImH5DO6ZV8E7FzxMgAUiVAUq41RFAkb25p1oHOZ8psfg==" + }, + "@google-cloud/promisify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-1.0.4.tgz", + "integrity": "sha512-VccZDcOql77obTnFh0TbNED/6ZbbmHDf8UMNnzO1d5g9V0Htfm4k5cllY8P1tJsRKC3zWYGRLaViiupcgVjBoQ==" + }, + "@google-cloud/storage": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-4.3.0.tgz", + "integrity": "sha512-ph0jsUsZ9FPtN40V5eIkKPLUmxnTpxqBDkWxStW/kbQZgoNVGW9vJcbsYSyE4ath7jQIpM4OHu6aqmPFX1OnGw==", + "requires": { + "@google-cloud/common": "^2.1.1", + "@google-cloud/paginator": "^2.0.0", + "@google-cloud/promisify": "^1.0.0", + "arrify": "^2.0.0", + "compressible": "^2.0.12", + "concat-stream": "^2.0.0", + "date-and-time": "^0.12.0", + "duplexify": "^3.5.0", + "extend": "^3.0.2", + "gaxios": "^2.0.1", + "gcs-resumable-upload": "^2.2.4", + "hash-stream-validation": "^0.2.2", + "mime": "^2.2.0", + "mime-types": "^2.0.8", + "onetime": "^5.1.0", + "p-limit": "^2.2.0", + "pumpify": "^2.0.0", + "readable-stream": "^3.4.0", + "snakeize": "^0.1.0", + "stream-events": "^1.0.1", + "through2": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, + "@hapi/address": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", + "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==" + }, + "@hapi/formula": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-1.2.0.tgz", + "integrity": "sha512-UFbtbGPjstz0eWHb+ga/GM3Z9EzqKXFWIbSOFURU0A/Gku0Bky4bCk9/h//K2Xr3IrCfjFNhMm4jyZ5dbCewGA==" + }, + "@hapi/hoek": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.0.tgz", + "integrity": "sha512-7XYT10CZfPsH7j9F1Jmg1+d0ezOux2oM2GfArAzLwWe4mE2Dr3hVjsAL6+TFY49RRJlCdJDMw3nJsLFroTc8Kw==" + }, + "@hapi/joi": { + "version": "16.1.7", + "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-16.1.7.tgz", + "integrity": "sha512-anaIgnZhNooG3LJLrTFzgGALTiO97zRA1UkvQHm9KxxoSiIzCozB3RCNCpDnfhTJD72QlrHA8nwGmNgpFFCIeg==", + "requires": { + "@hapi/address": "^2.1.2", + "@hapi/formula": "^1.2.0", + "@hapi/hoek": "^8.2.4", + "@hapi/pinpoint": "^1.0.2", + "@hapi/topo": "^3.1.3" + } + }, + "@hapi/pinpoint": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-1.0.2.tgz", + "integrity": "sha512-dtXC/WkZBfC5vxscazuiJ6iq4j9oNx1SHknmIr8hofarpKUZKmlUVYVIhNVzIEgK5Wrc4GMHL5lZtt1uS2flmQ==" + }, + "@hapi/topo": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz", + "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==", + "requires": { + "@hapi/hoek": "^8.3.0" + } + }, + "@jest/console": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", + "integrity": "sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ==", + "dev": true, + "requires": { + "@jest/source-map": "^24.9.0", + "chalk": "^2.0.1", + "slash": "^2.0.0" + } + }, + "@jest/core": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.9.0.tgz", + "integrity": "sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A==", + "dev": true, + "requires": { + "@jest/console": "^24.7.1", + "@jest/reporters": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "graceful-fs": "^4.1.15", + "jest-changed-files": "^24.9.0", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-resolve-dependencies": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "jest-watcher": "^24.9.0", + "micromatch": "^3.1.10", + "p-each-series": "^1.0.0", + "realpath-native": "^1.1.0", + "rimraf": "^2.5.4", + "slash": "^2.0.0", + "strip-ansi": "^5.0.0" + } + }, + "@jest/environment": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.9.0.tgz", + "integrity": "sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ==", + "dev": true, + "requires": { + "@jest/fake-timers": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0" + } + }, + "@jest/fake-timers": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.9.0.tgz", + "integrity": "sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0" + } + }, + "@jest/reporters": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.9.0.tgz", + "integrity": "sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw==", + "dev": true, + "requires": { + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.2", + "istanbul-lib-coverage": "^2.0.2", + "istanbul-lib-instrument": "^3.0.1", + "istanbul-lib-report": "^2.0.4", + "istanbul-lib-source-maps": "^3.0.1", + "istanbul-reports": "^2.2.6", + "jest-haste-map": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.6.0", + "node-notifier": "^5.4.2", + "slash": "^2.0.0", + "source-map": "^0.6.0", + "string-length": "^2.0.0" + } + }, + "@jest/source-map": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-24.9.0.tgz", + "integrity": "sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg==", + "dev": true, + "requires": { + "callsites": "^3.0.0", + "graceful-fs": "^4.1.15", + "source-map": "^0.6.0" + } + }, + "@jest/test-result": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.9.0.tgz", + "integrity": "sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA==", + "dev": true, + "requires": { + "@jest/console": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/istanbul-lib-coverage": "^2.0.0" + } + }, + "@jest/test-sequencer": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz", + "integrity": "sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A==", + "dev": true, + "requires": { + "@jest/test-result": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0" + } + }, + "@jest/transform": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.9.0.tgz", + "integrity": "sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^24.9.0", + "babel-plugin-istanbul": "^5.1.0", + "chalk": "^2.0.1", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.1.15", + "jest-haste-map": "^24.9.0", + "jest-regex-util": "^24.9.0", + "jest-util": "^24.9.0", + "micromatch": "^3.1.10", + "pirates": "^4.0.1", + "realpath-native": "^1.1.0", + "slash": "^2.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "2.4.1" + }, + "dependencies": { + "write-file-atomic": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.1.tgz", + "integrity": "sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + } + } + }, + "@jest/types": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz", + "integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^13.0.0" + } + }, + "@taquito/http-utils": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-5.1.0-beta.1.tgz", + "integrity": "sha512-/UvE61t9j5CR94vy8Dtb+/6oJERE0P9LmHBbkESKUxNC9SAlETCEntSNiHha+vuwgCoOj0pXsHkBtAZkWAaEeg==", + "requires": { + "xhr2-cookies": "^1.1.0" + } + }, + "@taquito/indexer": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/indexer/-/indexer-5.1.0-beta.1.tgz", + "integrity": "sha512-NDWK7XQGgUP0YkEWhJklF9uhKHZDWtRaAPSsSfxSDYiQzol4iAUn7ru7+TQPNqfsXq0NjpvzGHBysQ8HTeb0Gg==", + "requires": { + "@taquito/http-utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0" + }, + "dependencies": { + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + } + } + }, + "@taquito/michelson-encoder": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-5.1.0-beta.1.tgz", + "integrity": "sha512-kBpHDfsvsxzsIXbM4dOZs0nklY7CjCunSJ2sABUdBu4SmXDM06F5NDzg0166q7VBhFZgOhq/NNM9g7hcgn5qJg==", + "requires": { + "@taquito/utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0" + }, + "dependencies": { + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + } + } + }, + "@taquito/rpc": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-5.1.0-beta.1.tgz", + "integrity": "sha512-ZbqpJVZw1ljAS92Xs9t/1BAgPEMzOv3qk7ubWU7AGZOKDLREjOqI4EAZQfq4gL9hP2KIgqgLubTvPF3GsmTADg==", + "requires": { + "@taquito/http-utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0", + "lodash": "^4.17.15" + }, + "dependencies": { + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + } + } + }, + "@taquito/signer": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-5.1.0-beta.1.tgz", + "integrity": "sha512-N7ZteHnXv2kS+CCxbmQ+Br21aIf8cwP/WGAjwOh0uMUcXg2qsmKE/0XnRYnLhftVaJolNo85oBckYnA6U48uCg==", + "requires": { + "@taquito/utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0", + "bip39": "^3.0.2", + "elliptic": "^6.5.1", + "libsodium-wrappers": "^0.7.5", + "pbkdf2": "^3.0.17", + "typedarray-to-buffer": "^3.1.5" + }, + "dependencies": { + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + } + } + }, + "@taquito/taquito": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-5.1.0-beta.1.tgz", + "integrity": "sha512-hLV7vZiraMlx+Not3dRdELNSwxd0ZLndRGGDBh+uexpo1aH7xX5IQbIgQBREaR1F7fqHswxBBCKcBbrGhP5EWQ==", + "requires": { + "@taquito/indexer": "^5.1.0-beta.1", + "@taquito/michelson-encoder": "^5.1.0-beta.1", + "@taquito/rpc": "^5.1.0-beta.1", + "@taquito/signer": "^5.1.0-beta.1", + "@taquito/utils": "^5.1.0-beta.1", + "bignumber.js": "^9.0.0", + "rxjs": "^6.5.3" + }, + "dependencies": { + "bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + } + } + }, + "@taquito/utils": { + "version": "5.1.0-beta.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-5.1.0-beta.1.tgz", + "integrity": "sha512-3Qk+RLYKNYUW3jj1HYH0KymQQjWXdMcsp08eG+Cc0LKDvwzC5ewd4tfeUwq/jfHsd1fQ9LsG5FJ3NZg93W0H6w==", + "requires": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^5.2.1" + } + }, + "@ts-tools/node": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@ts-tools/node/-/node-1.1.3.tgz", + "integrity": "sha512-1IERQg/QxnnUuGSLXDI9p4GQwE6kJ+uQiNQFepPDPLKoqbf8dRH58HaQzIYQznzzOxV0VrXSi/ej7NxRQ8KCYg==", + "dev": true, + "requires": { + "@ts-tools/transpile": "^2.0.0", + "source-map-support": "^0.5.16" + } + }, + "@ts-tools/transpile": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ts-tools/transpile/-/transpile-2.0.0.tgz", + "integrity": "sha512-Vv9SlCOMPF926iXErWg63zexwkjqfz3eQrgvLnkoyT3g01LG9XPScSEnYzIKJKu2gV2l1TxBMEAXjP1nHn85AA==", + "dev": true + }, + "@types/babel__core": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.3.tgz", + "integrity": "sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz", + "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz", + "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.8.tgz", + "integrity": "sha512-yGeB2dHEdvxjP0y4UbRtQaSkXJ9649fYCmIdRoul5kfAoGCwxuCbMhag0k3RPfnuh9kPGm8x89btcfDEXdVWGw==", + "dev": true, + "requires": { + "@babel/types": "^7.3.0" + } + }, + "@types/body-parser": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz", + "integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.33", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.33.tgz", + "integrity": "sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.2.tgz", + "integrity": "sha512-5mHFNyavtLoJmnusB8OKJ5bshSzw+qkMIBAobLrIM48HJvunFva9mOa6aBwh64lBFyNwBbs0xiEFuj4eU/NjCA==", + "dev": true, + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.2.tgz", + "integrity": "sha512-El9yMpctM6tORDAiBwZVLMcxoTMcqqRO9dVyYcn7ycLWbvR8klrDn8CAOwRfZujZtWD7yS/mshTdz43jMOejbg==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/range-parser": "*" + } + }, + "@types/express-winston": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/express-winston/-/express-winston-3.0.4.tgz", + "integrity": "sha512-fCvI4nTs/oYhq7jACnPurepOPMKz//bNuCwMIRCcESix9jEuky93H5KwkyKeEPGNZfQzR3zCUbeGWs6/jvV7Fg==", + "dev": true, + "requires": { + "@types/express": "*", + "@types/logform": "*", + "winston": "^3.0.0" + } + }, + "@types/hapi__joi": { + "version": "16.0.8", + "resolved": "https://registry.npmjs.org/@types/hapi__joi/-/hapi__joi-16.0.8.tgz", + "integrity": "sha512-13I2m/eIoKF8JwLkeibJjsu2EKui18Vug7cOtzuUbWtF7mHyBgFCzSxnthHQ77z9S3T68ZldsGZpK1qXbinQjw==", + "dev": true + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", + "integrity": "sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg==", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", + "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*", + "@types/istanbul-lib-report": "*" + } + }, + "@types/jest": { + "version": "24.0.23", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.23.tgz", + "integrity": "sha512-L7MBvwfNpe7yVPTXLn32df/EK+AMBFAFvZrRuArGs7npEWnlziUXK+5GMIUTI4NIuwok3XibsjXCs5HxviYXjg==", + "dev": true, + "requires": { + "jest-diff": "^24.3.0" + } + }, + "@types/joi": { + "version": "14.3.4", + "resolved": "https://registry.npmjs.org/@types/joi/-/joi-14.3.4.tgz", + "integrity": "sha512-1TQNDJvIKlgYXGNIABfgFp9y0FziDpuGrd799Q5RcnsDu+krD+eeW/0Fs5PHARvWWFelOhIG2OPCo6KbadBM4A==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "@types/logform": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@types/logform/-/logform-1.10.1.tgz", + "integrity": "sha512-7PFeU3gNsaG80dNWIl9FafSCnc4oYRXlyJ4yM38i0hMuqJaIMGSARS16QKTKfN4nZmNkA2Yy1z3h1WkJxgGbmA==", + "dev": true, + "requires": { + "logform": "*" + } + }, + "@types/mime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.1.tgz", + "integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==", + "dev": true + }, + "@types/node": { + "version": "10.14.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.21.tgz", + "integrity": "sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ==" + }, + "@types/node-fetch": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.4.tgz", + "integrity": "sha512-Oz6id++2qAOFuOlE1j0ouk1dzl3mmI1+qINPNBhi9nt/gVOz0G+13Ao6qjhdF0Ys+eOkhu6JnFmt38bR3H0POQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/range-parser": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", + "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==", + "dev": true + }, + "@types/serve-static": { + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz", + "integrity": "sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==", + "dev": true, + "requires": { + "@types/express-serve-static-core": "*", + "@types/mime": "*" + } + }, + "@types/stack-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", + "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==", + "dev": true + }, + "@types/tmp": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.1.0.tgz", + "integrity": "sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA==", + "dev": true + }, + "@types/winston": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/winston/-/winston-2.4.4.tgz", + "integrity": "sha512-BVGCztsypW8EYwJ+Hq+QNYiT/MUyCif0ouBH+flrY66O5W+KIXAMML6E/0fJpm7VjIzgangahl5S03bJJQGrZw==", + "dev": true, + "requires": { + "winston": "*" + } + }, + "@types/yargs": { + "version": "13.0.7", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.7.tgz", + "integrity": "sha512-Sg9kNeJz+V+W+0fugcVhHC+mNHnydDR1RJrW5Qn2jVrDQARF8wfPVqIqwEzZp+bneuEBIm2ClsJ1/je42ZBzSg==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", + "dev": true + }, + "abab": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", + "dev": true + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "acorn-globals": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", + "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", + "dev": true, + "requires": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + }, + "dependencies": { + "acorn": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", + "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==", + "dev": true + } + } + }, + "acorn-walk": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", + "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", + "dev": true + }, + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==" + }, + "ajv": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", + "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "arg": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.2.tgz", + "integrity": "sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==", + "dev": true + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "requires": { + "lodash": "^4.17.14" + } + }, + "async-each": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", + "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", + "dev": true + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", + "dev": true + }, + "babel-jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.9.0.tgz", + "integrity": "sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw==", + "dev": true, + "requires": { + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/babel__core": "^7.1.0", + "babel-plugin-istanbul": "^5.1.0", + "babel-preset-jest": "^24.9.0", + "chalk": "^2.4.2", + "slash": "^2.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz", + "integrity": "sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "find-up": "^3.0.0", + "istanbul-lib-instrument": "^3.3.0", + "test-exclude": "^5.2.3" + } + }, + "babel-plugin-jest-hoist": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz", + "integrity": "sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==", + "dev": true, + "requires": { + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz", + "integrity": "sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg==", + "dev": true, + "requires": { + "@babel/plugin-syntax-object-rest-spread": "^7.0.0", + "babel-plugin-jest-hoist": "^24.9.0" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base-x": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.7.tgz", + "integrity": "sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bignumber.js": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz", + "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==" + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "bip39": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz", + "integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==", + "requires": { + "@types/node": "11.11.6", + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1" + }, + "dependencies": { + "@types/node": { + "version": "11.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", + "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" + } + } + }, + "blakejs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", + "integrity": "sha1-ad+S75U6qIylGjLfarHFShVfx6U=" + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, + "body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "requires": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "boxen": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", + "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", + "dev": true, + "requires": { + "ansi-align": "^2.0.0", + "camelcase": "^4.0.0", + "chalk": "^2.0.1", + "cli-boxes": "^1.0.0", + "string-width": "^2.0.0", + "term-size": "^1.2.0", + "widest-line": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browser-process-hrtime": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", + "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==", + "dev": true + }, + "browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "dev": true, + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "requires": { + "fast-json-stable-stringify": "2.x" + } + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz", + "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "capture-exit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", + "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==", + "dev": true, + "requires": { + "rsvp": "^4.8.4" + } + }, + "capture-stack-trace": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", + "integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + } + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", + "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "colornames": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/colornames/-/colornames-1.1.1.tgz", + "integrity": "sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y=" + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "colorspace": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.2.tgz", + "integrity": "sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ==", + "requires": { + "color": "3.0.x", + "text-hex": "1.0.x" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, + "compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "requires": { + "mime-db": ">= 1.43.0 < 2" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "configstore": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.0.tgz", + "integrity": "sha512-eE/hvMs7qw7DlcB5JPRnthmrITuHMmACUJAp89v6PT6iOqzoLS7HRWhBtuHMlhNHo2AhUSA/3Dh1bKNJHcublQ==", + "requires": { + "dot-prop": "^5.1.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, + "content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "requires": { + "safe-buffer": "5.1.2" + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cookie": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "^1.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==" + }, + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "cssstyle": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", + "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", + "dev": true, + "requires": { + "cssom": "0.3.x" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "data-urls": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", + "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", + "dev": true, + "requires": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.2.0", + "whatwg-url": "^7.0.0" + }, + "dependencies": { + "whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dev": true, + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + } + } + }, + "date-and-time": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/date-and-time/-/date-and-time-0.12.0.tgz", + "integrity": "sha512-n2RJIAp93AucgF/U/Rz5WRS2Hjg5Z+QxscaaMCi6pVZT1JpJKRH+C08vyH/lRR1kxNXnPxgo3lWfd+jCb/UcuQ==" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "detect-newline": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-2.1.0.tgz", + "integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=", + "dev": true + }, + "diagnostics": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/diagnostics/-/diagnostics-1.1.1.tgz", + "integrity": "sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ==", + "requires": { + "colorspace": "1.1.x", + "enabled": "1.0.x", + "kuler": "1.0.x" + } + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "diff-sequences": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz", + "integrity": "sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew==", + "dev": true + }, + "dom-serializer": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", + "requires": { + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + }, + "dependencies": { + "domelementtype": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", + "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==" + }, + "entities": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", + "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==" + } + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" + }, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dev": true, + "requires": { + "webidl-conversions": "^4.0.2" + } + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "dot-prop": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", + "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==", + "requires": { + "is-obj": "^2.0.0" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "duplexify": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", + "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", + "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "enabled": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-1.0.2.tgz", + "integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=", + "requires": { + "env-variable": "0.0.x" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=" + }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + }, + "env-variable": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/env-variable/-/env-variable-0.0.6.tgz", + "integrity": "sha512-bHz59NlBbtS0NhftmR8+ExBEekE7br0e01jw+kk0NDro7TtZzBYZ5ScGPs3OmwnpyfHTHOtr1Y6uedCdrIldtg==" + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + } + } + }, + "es-abstract": { + "version": "1.17.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz", + "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "escodegen": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.13.0.tgz", + "integrity": "sha512-eYk2dCkxR07DsHA/X2hRBj0CFAZeri/LyDMc0C8JT1Hqi6JnVpMhJ7XFITbb0+yZS3lVkaPL2oCkZ3AVmeVbMw==", + "dev": true, + "requires": { + "esprima": "^4.0.1", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "exec-sh": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz", + "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==", + "dev": true + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "dependencies": { + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + } + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "expect": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-24.9.0.tgz", + "integrity": "sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "ansi-styles": "^3.2.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.9.0" + } + }, + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "requires": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "content-type": "~1.0.4", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.5", + "qs": "6.7.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "express-winston": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/express-winston/-/express-winston-4.0.2.tgz", + "integrity": "sha512-Dt2VRkIekVZQT4F8CiKsFm7dWhD7Hx32vyO62p9TIcOb9AdZ58HiX21b+2P2qrxTsOzYYA2N3mXu2vj+RTq8cQ==", + "requires": { + "chalk": "^2.4.1", + "lodash": "^4.17.10" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, + "fast-text-encoding": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.0.tgz", + "integrity": "sha512-R9bHCvweUxxwkDwhjav5vxpFvdPGlVngtqmx4pIZfSUhM/Q4NiIUHB456BAf+Q1Nwu3HEZYONtu+Rya+af4jiQ==" + }, + "fb-watchman": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", + "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, + "fecha": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz", + "integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg==" + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz", + "integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==", + "dev": true, + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1", + "node-pre-gyp": "*" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "3.2.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "bundled": true, + "dev": true, + "optional": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true, + "optional": true + }, + "minipass": { + "version": "2.9.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.14.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4.4.2" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.4.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.7.1", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.13", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "yallist": { + "version": "3.1.1", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gaxios": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.2.2.tgz", + "integrity": "sha512-fzttYsjvZxCaN+bQK7FtAMgoIlPtHkMwlz7vHD+aNRcU7I7gHgnp6hvGJksoo+dO1TDxaog+dSBycbYhHIStaA==", + "requires": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^4.0.0", + "is-stream": "^2.0.0", + "node-fetch": "^2.3.0" + } + }, + "gcp-metadata": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-3.3.0.tgz", + "integrity": "sha512-uO3P/aByOQmoDu5bOYBODHmD1oDCZw7/R8SYY0MdmMQSZVEmeTSxmiM1vwde+YHYSpkaQnAAMAIZuOqLvgfp/Q==", + "requires": { + "gaxios": "^2.1.0", + "json-bigint": "^0.3.0" + } + }, + "gcs-resumable-upload": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/gcs-resumable-upload/-/gcs-resumable-upload-2.3.2.tgz", + "integrity": "sha512-OPS0iAmPCV+r7PziOIhyxmQOzsazFCy76yYDOS/Z80O/7cuny1KMfqDQa2T0jLaL8EreTU7EMZG5pUuqBKgzHA==", + "requires": { + "abort-controller": "^3.0.0", + "configstore": "^5.0.0", + "gaxios": "^2.0.0", + "google-auth-library": "^5.0.0", + "pumpify": "^2.0.0", + "stream-events": "^1.0.4" + } + }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "dev": true, + "requires": { + "ini": "^1.3.4" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "google-auth-library": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.9.2.tgz", + "integrity": "sha512-rBE1YTOZ3/Hu6Mojkr+UUmbdc/F28hyMGYEGxjyfVA9ZFmq12oqS3AeftX4h9XpdVIcxPooSo8hECYGT6B9XqQ==", + "requires": { + "arrify": "^2.0.0", + "base64-js": "^1.3.0", + "fast-text-encoding": "^1.0.0", + "gaxios": "^2.1.0", + "gcp-metadata": "^3.3.0", + "gtoken": "^4.1.0", + "jws": "^4.0.0", + "lru-cache": "^5.0.0" + } + }, + "google-p12-pem": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-2.0.4.tgz", + "integrity": "sha512-S4blHBQWZRnEW44OcR7TL9WR+QCqByRvhNDZ/uuQfpxywfupikf/miba8js1jZi6ZOGv5slgSuoshCWh6EMDzg==", + "requires": { + "node-forge": "^0.9.0" + } + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "^3.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-redirect": "^1.0.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "lowercase-keys": "^1.0.0", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "unzip-response": "^2.0.1", + "url-parse-lax": "^1.0.0" + }, + "dependencies": { + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + } + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "dev": true + }, + "gtoken": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-4.1.4.tgz", + "integrity": "sha512-VxirzD0SWoFUo5p8RDP8Jt2AGyOmyYcT/pOUgDKJCK+iSw0TMqwrVfY37RXTNmoKwrzmDHSk0GMT9FsgVmnVSA==", + "requires": { + "gaxios": "^2.1.0", + "google-p12-pem": "^2.0.0", + "jws": "^4.0.0", + "mime": "^2.2.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "dev": true, + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash-stream-validation": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/hash-stream-validation/-/hash-stream-validation-0.2.2.tgz", + "integrity": "sha512-cMlva5CxWZOrlS/cY0C+9qAzesn5srhFA8IT1VPiHc9bWWBLkJfEUIZr7MWoi89oOOGmpg8ymchaOjiArsGu5A==", + "requires": { + "through2": "^2.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hosted-git-info": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", + "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==", + "dev": true + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, + "requires": { + "whatwg-encoding": "^1.0.1" + } + }, + "html-escaper": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.0.tgz", + "integrity": "sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig==", + "dev": true + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, + "http-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.0.tgz", + "integrity": "sha512-GX0FA6+IcDf4Oxc/FBWgYj4zKgo/DnZrksaG9jyuQLExs6xlX+uI5lcA8ymM3JaZTRrF/4s2UX19wJolyo7OBA==", + "requires": { + "agent-base": "6", + "debug": "4" + }, + "dependencies": { + "agent-base": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", + "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==", + "requires": { + "debug": "4" + } + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "requires": { + "agent-base": "5", + "debug": "4" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "dev": true, + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "ipaddr.js": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", + "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-callable": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", + "dev": true + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-installed-globally": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", + "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", + "dev": true, + "requires": { + "global-dirs": "^0.1.0", + "is-path-inside": "^1.0.0" + } + }, + "is-npm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==" + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-regex": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-retry-allowed": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", + "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", + "dev": true + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", + "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "dev": true, + "requires": { + "@babel/generator": "^7.4.0", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", + "istanbul-lib-coverage": "^2.0.5", + "semver": "^6.0.0" + } + }, + "istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", + "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "rimraf": "^2.6.3", + "source-map": "^0.6.1" + }, + "dependencies": { + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", + "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0" + } + }, + "jest": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-24.9.0.tgz", + "integrity": "sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw==", + "dev": true, + "requires": { + "import-local": "^2.0.0", + "jest-cli": "^24.9.0" + }, + "dependencies": { + "jest-cli": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.9.0.tgz", + "integrity": "sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg==", + "dev": true, + "requires": { + "@jest/core": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "import-local": "^2.0.0", + "is-ci": "^2.0.0", + "jest-config": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "prompts": "^2.0.1", + "realpath-native": "^1.1.0", + "yargs": "^13.3.0" + } + } + } + }, + "jest-changed-files": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz", + "integrity": "sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "execa": "^1.0.0", + "throat": "^4.0.0" + } + }, + "jest-config": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.9.0.tgz", + "integrity": "sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ==", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^24.9.0", + "@jest/types": "^24.9.0", + "babel-jest": "^24.9.0", + "chalk": "^2.0.1", + "glob": "^7.1.1", + "jest-environment-jsdom": "^24.9.0", + "jest-environment-node": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "micromatch": "^3.1.10", + "pretty-format": "^24.9.0", + "realpath-native": "^1.1.0" + } + }, + "jest-diff": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.9.0.tgz", + "integrity": "sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "diff-sequences": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-docblock": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.9.0.tgz", + "integrity": "sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA==", + "dev": true, + "requires": { + "detect-newline": "^2.1.0" + } + }, + "jest-each": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.9.0.tgz", + "integrity": "sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-environment-jsdom": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz", + "integrity": "sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA==", + "dev": true, + "requires": { + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0", + "jsdom": "^11.5.1" + } + }, + "jest-environment-node": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.9.0.tgz", + "integrity": "sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA==", + "dev": true, + "requires": { + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0" + } + }, + "jest-get-type": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz", + "integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==", + "dev": true + }, + "jest-haste-map": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.9.0.tgz", + "integrity": "sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "anymatch": "^2.0.0", + "fb-watchman": "^2.0.0", + "fsevents": "^1.2.7", + "graceful-fs": "^4.1.15", + "invariant": "^2.2.4", + "jest-serializer": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.9.0", + "micromatch": "^3.1.10", + "sane": "^4.0.3", + "walker": "^1.0.7" + } + }, + "jest-jasmine2": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz", + "integrity": "sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==", + "dev": true, + "requires": { + "@babel/traverse": "^7.1.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "co": "^4.6.0", + "expect": "^24.9.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0", + "throat": "^4.0.0" + } + }, + "jest-leak-detector": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz", + "integrity": "sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA==", + "dev": true, + "requires": { + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-matcher-utils": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz", + "integrity": "sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" + } + }, + "jest-message-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.9.0.tgz", + "integrity": "sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/stack-utils": "^1.0.1", + "chalk": "^2.0.1", + "micromatch": "^3.1.10", + "slash": "^2.0.0", + "stack-utils": "^1.0.1" + } + }, + "jest-mock": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.9.0.tgz", + "integrity": "sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz", + "integrity": "sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ==", + "dev": true + }, + "jest-regex-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-24.9.0.tgz", + "integrity": "sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA==", + "dev": true + }, + "jest-resolve": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.9.0.tgz", + "integrity": "sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "browser-resolve": "^1.11.3", + "chalk": "^2.0.1", + "jest-pnp-resolver": "^1.2.1", + "realpath-native": "^1.1.0" + } + }, + "jest-resolve-dependencies": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz", + "integrity": "sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-snapshot": "^24.9.0" + } + }, + "jest-runner": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.9.0.tgz", + "integrity": "sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg==", + "dev": true, + "requires": { + "@jest/console": "^24.7.1", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "chalk": "^2.4.2", + "exit": "^0.1.2", + "graceful-fs": "^4.1.15", + "jest-config": "^24.9.0", + "jest-docblock": "^24.3.0", + "jest-haste-map": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-leak-detector": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.6.0", + "source-map-support": "^0.5.6", + "throat": "^4.0.0" + } + }, + "jest-runtime": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.9.0.tgz", + "integrity": "sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw==", + "dev": true, + "requires": { + "@jest/console": "^24.7.1", + "@jest/environment": "^24.9.0", + "@jest/source-map": "^24.3.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", + "chalk": "^2.0.1", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.1.15", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-regex-util": "^24.3.0", + "jest-resolve": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "realpath-native": "^1.1.0", + "slash": "^2.0.0", + "strip-bom": "^3.0.0", + "yargs": "^13.3.0" + } + }, + "jest-serializer": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-24.9.0.tgz", + "integrity": "sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ==", + "dev": true + }, + "jest-snapshot": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.9.0.tgz", + "integrity": "sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0", + "@jest/types": "^24.9.0", + "chalk": "^2.0.1", + "expect": "^24.9.0", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "pretty-format": "^24.9.0", + "semver": "^6.2.0" + } + }, + "jest-util": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.9.0.tgz", + "integrity": "sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg==", + "dev": true, + "requires": { + "@jest/console": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/source-map": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "callsites": "^3.0.0", + "chalk": "^2.0.1", + "graceful-fs": "^4.1.15", + "is-ci": "^2.0.0", + "mkdirp": "^0.5.1", + "slash": "^2.0.0", + "source-map": "^0.6.0" + } + }, + "jest-validate": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz", + "integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "camelcase": "^5.3.1", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "leven": "^3.1.0", + "pretty-format": "^24.9.0" + } + }, + "jest-watcher": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.9.0.tgz", + "integrity": "sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw==", + "dev": true, + "requires": { + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", + "@types/yargs": "^13.0.0", + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.1", + "jest-util": "^24.9.0", + "string-length": "^2.0.0" + } + }, + "jest-worker": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", + "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "jsdom": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz", + "integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==", + "dev": true, + "requires": { + "abab": "^2.0.0", + "acorn": "^5.5.3", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": "^1.0.0", + "data-urls": "^1.0.0", + "domexception": "^1.0.1", + "escodegen": "^1.9.1", + "html-encoding-sniffer": "^1.0.2", + "left-pad": "^1.3.0", + "nwsapi": "^2.0.7", + "parse5": "4.0.0", + "pn": "^1.1.0", + "request": "^2.87.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.3.4", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.3", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^6.4.1", + "ws": "^5.2.0", + "xml-name-validator": "^3.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-bigint": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-0.3.0.tgz", + "integrity": "sha1-DM2RLEuCcNBfBW+9E4FLU9OCWx4=", + "requires": { + "bignumber.js": "^7.0.0" + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "requires": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "kuler": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-1.0.1.tgz", + "integrity": "sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ==", + "requires": { + "colornames": "^1.1.1" + } + }, + "latest-version": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", + "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "dev": true, + "requires": { + "package-json": "^4.0.0" + } + }, + "left-pad": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "libsodium": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.6.tgz", + "integrity": "sha512-hPb/04sEuLcTRdWDtd+xH3RXBihpmbPCsKW/Jtf4PsvdyKh+D6z2D2gvp/5BfoxseP+0FCOg66kE+0oGUE/loQ==" + }, + "libsodium-wrappers": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.6.tgz", + "integrity": "sha512-OUO2CWW5bHdLr6hkKLHIKI4raEkZrf3QHkhXsJ1yCh6MZ3JDA7jFD3kCATNquuGSG6MjjPHQIQms0y0gBDzjQg==", + "requires": { + "libsodium": "0.7.6" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" + }, + "lodash.escaperegexp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", + "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "lodash.mergewith": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true + }, + "logform": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.1.2.tgz", + "integrity": "sha512-+lZh4OpERDBLqjiwDLpAWNQu6KMjnlXH2ByZwCuSqVPJletw0kTWJf5CgSNAUKn1KUkv3m2cUz/LK8zyEy7wzQ==", + "requires": { + "colors": "^1.2.1", + "fast-safe-stringify": "^2.0.4", + "fecha": "^2.3.3", + "ms": "^2.1.1", + "triple-beam": "^1.3.0" + } + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, + "make-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.0.tgz", + "integrity": "sha512-grNJDhb8b1Jm1qeqW5R/O63wUo4UXo2v2HMic6YT9i/HBlF93S8jkMgH7yugvY9ABDShH4VZMn8I+U8+fCNegw==", + "requires": { + "semver": "^6.0.0" + } + }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, + "makeerror": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "dev": true, + "requires": { + "tmpl": "1.0.x" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "requires": { + "mime-db": "1.43.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "node-forge": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.1.tgz", + "integrity": "sha512-G6RlQt5Sb4GMBzXvhfkeFmbqR6MzhtnT7VTHuLadjkii3rdYHNdw0m8zA4BTxVIh68FicCQ2NSUANpsqkr9jvQ==" + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", + "dev": true + }, + "node-modules-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", + "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", + "dev": true + }, + "node-notifier": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz", + "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==", + "dev": true, + "requires": { + "growly": "^1.3.0", + "is-wsl": "^1.1.0", + "semver": "^5.5.0", + "shellwords": "^0.1.1", + "which": "^1.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "nodemon": { + "version": "1.19.4", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.19.4.tgz", + "integrity": "sha512-VGPaqQBNk193lrJFotBU8nvWZPqEZY2eIzymy2jjY0fJ9qIsxA0sxQ8ATPl0gZC645gijYEc1jtZvpS8QWzJGQ==", + "dev": true, + "requires": { + "chokidar": "^2.1.8", + "debug": "^3.2.6", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.7", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.2", + "update-notifier": "^2.5.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "nwsapi": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", + "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "one-time": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-0.0.4.tgz", + "integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4=" + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "p-each-series": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-1.0.0.tgz", + "integrity": "sha1-kw89Et0fUOdDRFeiLNbwSsatf3E=", + "dev": true, + "requires": { + "p-reduce": "^1.0.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-reduce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz", + "integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=", + "dev": true + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "^6.7.1", + "registry-auth-token": "^3.0.1", + "registry-url": "^3.0.3", + "semver": "^5.1.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "dev": true + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pbkdf2": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pirates": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", + "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", + "dev": true, + "requires": { + "node-modules-regexp": "^1.0.0" + } + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "postcss": { + "version": "7.0.26", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.26.tgz", + "integrity": "sha512-IY4oRjpXWYshuTDFxMVkJDtWIk2LhsTlu8bZnbEJA4+bYT16Lvpo8Qv6EvDumhYRgzjZl489pmsY3qVgJQ08nA==", + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "pretty-format": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz", + "integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "ansi-regex": "^4.0.0", + "ansi-styles": "^3.2.0", + "react-is": "^16.8.4" + } + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "prompts": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.0.tgz", + "integrity": "sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.3" + } + }, + "proxy-addr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", + "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.0" + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", + "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==", + "dev": true + }, + "pstree.remy": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.7.tgz", + "integrity": "sha512-xsMgrUwRpuGskEzBFkH8NmTimbZ5PcPup0LA8JJkHIm2IMUbQcpo3yeLNWVrufEYjh8YwtSVh0xz6UeWc5Oh5A==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-2.0.1.tgz", + "integrity": "sha512-m7KOje7jZxrmutanlkS1daj1dS6z6BgslzOXmcSEpIlCxM3VJH7lG5QLeck/6hgF6F4crFf01UtQmNsJfweTAw==", + "requires": { + "duplexify": "^4.1.1", + "inherits": "^2.0.3", + "pump": "^3.0.0" + }, + "dependencies": { + "duplexify": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz", + "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==", + "requires": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.0" + } + } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "react-is": { + "version": "16.12.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.12.0.tgz", + "integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + }, + "readable-stream": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", + "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, + "realpath-native": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-1.1.0.tgz", + "integrity": "sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA==", + "dev": true, + "requires": { + "util.promisify": "^1.0.0" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "registry-auth-token": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.4.0.tgz", + "integrity": "sha512-4LM6Fw8eBQdwMYcES4yTnn2TqIasbXuwDx3um+QRs7S55aMKCBKBxvPXl2RiUjHwuJLTyYfxSpmfSAjQpcuP+A==", + "dev": true, + "requires": { + "rc": "^1.1.6", + "safe-buffer": "^5.0.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "^1.0.1" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + } + } + }, + "request-promise-core": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", + "dev": true, + "requires": { + "lodash": "^4.17.15" + } + }, + "request-promise-native": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", + "dev": true, + "requires": { + "request-promise-core": "1.1.3", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "resolve": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz", + "integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "retry-request": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-4.1.1.tgz", + "integrity": "sha512-BINDzVtLI2BDukjWmjAIRZ0oglnCAkpP2vQjM3jdLhmT62h0xnQgciPwBRDAvHqpkPT2Wo1XuUyLyn6nbGrZQQ==", + "requires": { + "debug": "^4.1.1", + "through2": "^3.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rsvp": { + "version": "4.8.5", + "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", + "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", + "dev": true + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sane": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", + "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", + "dev": true, + "requires": { + "@cnakazawa/watch": "^1.0.3", + "anymatch": "^2.0.0", + "capture-exit": "^2.0.0", + "exec-sh": "^0.3.2", + "execa": "^1.0.0", + "fb-watchman": "^2.0.0", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5" + } + }, + "sanitize-html": { + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-1.21.1.tgz", + "integrity": "sha512-W6enXSVphVaVbmVbzVngBthR5f5sMmhq3EfPfBlzBzp2WnX8Rnk7NGpP7KmHUc0Y3MVk9tv/+CbpdHchX9ai7g==", + "requires": { + "chalk": "^2.4.1", + "htmlparser2": "^3.10.0", + "lodash.clonedeep": "^4.5.0", + "lodash.escaperegexp": "^4.1.2", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.mergewith": "^4.6.1", + "postcss": "^7.0.5", + "srcset": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "^5.0.3" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, + "serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "requires": { + "is-arrayish": "^0.3.1" + } + }, + "sisteransi": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.4.tgz", + "integrity": "sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig==", + "dev": true + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + }, + "snakeize": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/snakeize/-/snakeize-0.1.0.tgz", + "integrity": "sha1-EMCI2LWOsHazIpu1oE4jLOEmQi0=" + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "source-map-resolve": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "dev": true, + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "srcset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/srcset/-/srcset-1.0.0.tgz", + "integrity": "sha1-pWad4StC87HV6D7QPHEEb8SPQe8=", + "requires": { + "array-uniq": "^1.0.2", + "number-is-nan": "^1.0.0" + } + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, + "stack-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", + "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true + }, + "stream-events": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", + "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", + "requires": { + "stubs": "^3.0.0" + } + }, + "stream-shift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" + }, + "string-length": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "dev": true, + "requires": { + "astral-regex": "^1.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "string.prototype.trimleft": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz", + "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string.prototype.trimright": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz", + "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "function-bind": "^1.1.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "stubs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", + "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true + }, + "teeny-request": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.1.tgz", + "integrity": "sha512-TAK0c9a00ELOqLrZ49cFxvPVogMUFaWY8dUsQc/0CuQPGF+BOxOQzXfE413BAk2kLomwNplvdtMpeaeGWmoc2g==", + "requires": { + "http-proxy-agent": "^4.0.0", + "https-proxy-agent": "^4.0.0", + "node-fetch": "^2.2.0", + "stream-events": "^1.0.5", + "uuid": "^3.3.2" + } + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "^0.7.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + }, + "test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "dev": true, + "requires": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + } + }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, + "throat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", + "dev": true + }, + "through2": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", + "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", + "requires": { + "readable-stream": "2 || 3" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "tmp": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz", + "integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", + "requires": { + "rimraf": "^2.6.3" + } + }, + "tmpl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" + }, + "ts-jest": { + "version": "24.3.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.3.0.tgz", + "integrity": "sha512-Hb94C/+QRIgjVZlJyiWwouYUF+siNJHJHknyspaOcZ+OQAIdFG/UrdQVXw/0B8Z3No34xkUXZJpOTy9alOWdVQ==", + "dev": true, + "requires": { + "bs-logger": "0.x", + "buffer-from": "1.x", + "fast-json-stable-stringify": "2.x", + "json5": "2.x", + "lodash.memoize": "4.x", + "make-error": "1.x", + "mkdirp": "0.x", + "resolve": "1.x", + "semver": "^5.5", + "yargs-parser": "10.x" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "ts-node": { + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.6.2.tgz", + "integrity": "sha512-4mZEbofxGqLL2RImpe3zMJukvEvcO1XP8bj8ozBPySdCUXEcU5cIRwR0aM3R+VoZq7iXc8N86NC0FspGRqP4gg==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "3.1.1" + } + }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "typescript": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.5.tgz", + "integrity": "sha512-BEjlc0Z06ORZKbtcxGrIvvwYs5hAnuo6TKdNFL55frVDlB+na3z5bsLhFaIxmT+dPWgBIjMo6aNnTOgHHmHgiQ==", + "dev": true + }, + "undefsafe": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.2.tgz", + "integrity": "sha1-Il9rngM3Zj4Njnz9aG/Cg2zKznY=", + "dev": true, + "requires": { + "debug": "^2.2.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "upath": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", + "dev": true + }, + "update-notifier": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.5.0.tgz", + "integrity": "sha512-gwMdhgJHGuj/+wHJJs9e6PcCszpxR1b236igrOkUofGhqJuG+amlIKwApH1IW1WWl7ovZxsX49lMBWLxSdm5Dw==", + "dev": true, + "requires": { + "boxen": "^1.2.1", + "chalk": "^2.0.1", + "configstore": "^3.0.0", + "import-lazy": "^2.1.0", + "is-ci": "^1.0.10", + "is-installed-globally": "^0.1.0", + "is-npm": "^1.0.0", + "latest-version": "^3.0.0", + "semver-diff": "^2.0.0", + "xdg-basedir": "^3.0.0" + }, + "dependencies": { + "ci-info": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "dev": true + }, + "configstore": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", + "integrity": "sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "unique-string": "^1.0.0", + "write-file-atomic": "^2.0.0", + "xdg-basedir": "^3.0.0" + } + }, + "crypto-random-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "dev": true + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "is-ci": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "^1.0.0" + } + }, + "write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + } + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "util.promisify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", + "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.2", + "has-symbols": "^1.0.1", + "object.getownpropertydescriptors": "^2.1.0" + } + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "dev": true, + "requires": { + "browser-process-hrtime": "^0.1.2" + } + }, + "walker": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "dev": true, + "requires": { + "makeerror": "1.0.x" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", + "dev": true, + "requires": { + "iconv-lite": "0.4.24" + } + }, + "whatwg-mimetype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", + "dev": true + }, + "whatwg-url": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", + "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", + "dev": true, + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "widest-line": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", + "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", + "dev": true, + "requires": { + "string-width": "^2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "winston": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.2.1.tgz", + "integrity": "sha512-zU6vgnS9dAWCEKg/QYigd6cgMVVNwyTzKs81XZtTFuRwJOcDdBg7AU0mXVyNbs7O5RH2zdv+BdNZUlx7mXPuOw==", + "requires": { + "async": "^2.6.1", + "diagnostics": "^1.1.1", + "is-stream": "^1.1.0", + "logform": "^2.1.1", + "one-time": "0.0.4", + "readable-stream": "^3.1.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.3.0" + }, + "dependencies": { + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + } + } + }, + "winston-transport": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.3.0.tgz", + "integrity": "sha512-B2wPuwUi3vhzn/51Uukcao4dIduEiPOcOt9HJ3QeaXgkJ5Z7UwpBzxS4ZGNHtrxrUvTwemsQiSys0ihOf8Mp1A==", + "requires": { + "readable-stream": "^2.3.6", + "triple-beam": "^1.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write-file-atomic": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.1.tgz", + "integrity": "sha512-JPStrIyyVJ6oCSz/691fAjFtefZ6q+fP6tm+OS4Qw6o+TGQxNp1ziY2PgS+X/m0V8OWhZiO/m4xSj+Pr4RrZvw==", + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==" + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yargs": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + } + } +} diff --git a/tools/webide/packages/server/package.json b/tools/webide/packages/server/package.json new file mode 100644 index 000000000..9a757c7a9 --- /dev/null +++ b/tools/webide/packages/server/package.json @@ -0,0 +1,45 @@ +{ + "name": "server", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "prestart": "cd ../client && npm run build", + "start": "nodemon -r @ts-tools/node/r -r tsconfig-paths/register ./src/index.ts", + "build": "tsc", + "test": "jest" + }, + "devDependencies": { + "@ts-tools/node": "^1.0.0", + "@types/express": "^4.17.1", + "@types/express-winston": "^3.0.4", + "@types/hapi__joi": "^16.0.1", + "@types/jest": "^24.0.23", + "@types/joi": "^14.3.3", + "@types/node": "10", + "@types/tmp": "^0.1.0", + "@types/winston": "^2.4.4", + "jest": "^24.9.0", + "nodemon": "^1.19.3", + "ts-jest": "^24.1.0", + "ts-node": "^8.4.1", + "tsconfig-paths": "^3.9.0", + "typescript": "~3.6.3" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@google-cloud/storage": "^4.0.0", + "@hapi/joi": "^16.1.7", + "@taquito/taquito": "^5.1.0-beta.1", + "@types/node-fetch": "^2.5.4", + "body-parser": "^1.19.0", + "escape-html": "^1.0.3", + "express": "^4.17.1", + "express-winston": "^4.0.1", + "node-fetch": "^2.6.0", + "sanitize-html": "^1.20.1", + "tmp": "^0.1.0", + "winston": "^3.2.1" + } +} diff --git a/tools/webide/packages/server/src/handlers/compile-contract.ts b/tools/webide/packages/server/src/handlers/compile-contract.ts new file mode 100644 index 000000000..aaed33150 --- /dev/null +++ b/tools/webide/packages/server/src/handlers/compile-contract.ts @@ -0,0 +1,49 @@ +import joi from '@hapi/joi'; +import { Request, Response } from 'express'; + +import { CompilerError, LigoCompiler } from '../ligo-compiler'; +import { logger } from '../logger'; + +interface CompileBody { + syntax: string; + code: string; + entrypoint: string; + format?: string; +} + +const validateRequest = (body: any): { value: CompileBody; error: any } => { + return joi + .object({ + syntax: joi.string().required(), + code: joi.string().required(), + entrypoint: joi.string().required(), + format: joi.string().optional() + }) + .validate(body); +}; + +export async function compileContractHandler(req: Request, res: Response) { + const { error, value: body } = validateRequest(req.body); + + if (error) { + res.status(400).json({ error: error.message }); + } else { + try { + const michelsonCode = await new LigoCompiler().compileContract( + body.syntax, + body.code, + body.entrypoint, + body.format || 'text' + ); + + res.send({ result: michelsonCode }); + } catch (ex) { + if (ex instanceof CompilerError) { + res.status(400).json({ error: ex.message }); + } else { + logger.error(ex); + res.sendStatus(500); + } + } + } +} diff --git a/tools/webide/packages/server/src/handlers/compile-expression.ts b/tools/webide/packages/server/src/handlers/compile-expression.ts new file mode 100644 index 000000000..ece19eccc --- /dev/null +++ b/tools/webide/packages/server/src/handlers/compile-expression.ts @@ -0,0 +1,46 @@ +import joi from '@hapi/joi'; +import { Request, Response } from 'express'; + +import { CompilerError, LigoCompiler } from '../ligo-compiler'; +import { logger } from '../logger'; + +interface CompileBody { + syntax: string; + expression: string; + format?: string; +} + +const validateRequest = (body: any): { value: CompileBody; error: any } => { + return joi + .object({ + syntax: joi.string().required(), + expression: joi.string().required(), + format: joi.string().optional() + }) + .validate(body); +}; + +export async function compileExpressionHandler(req: Request, res: Response) { + const { error, value: body } = validateRequest(req.body); + + if (error) { + res.status(400).json({ error: error.message }); + } else { + try { + const michelsonCode = await new LigoCompiler().compileExpression( + body.syntax, + body.expression, + body.format || 'text' + ); + + res.send({ result: michelsonCode }); + } catch (ex) { + if (ex instanceof CompilerError) { + res.status(400).json({ error: ex.message }); + } else { + logger.error(ex); + res.sendStatus(500); + } + } + } +} diff --git a/tools/webide/packages/server/src/handlers/deploy.ts b/tools/webide/packages/server/src/handlers/deploy.ts new file mode 100644 index 000000000..0fabd925f --- /dev/null +++ b/tools/webide/packages/server/src/handlers/deploy.ts @@ -0,0 +1,68 @@ +import joi from '@hapi/joi'; +import { Tezos } from '@taquito/taquito'; +import { Request, Response } from 'express'; + +import { CompilerError, LigoCompiler } from '../ligo-compiler'; +import { logger } from '../logger'; +import { fetchRandomPrivateKey } from '../services/key'; + +interface DeployBody { + syntax: string; + code: string; + entrypoint: string; + storage: string; +} + +Tezos.setProvider({ rpc: 'https://api.tez.ie/rpc/babylonnet' }); + +const validateRequest = (body: any): { value: DeployBody; error: any } => { + return joi + .object({ + syntax: joi.string().required(), + code: joi.string().required(), + entrypoint: joi.string().required(), + storage: joi.string().required() + }) + .validate(body); +}; + +export async function deployHandler(req: Request, res: Response) { + const { error, value: body } = validateRequest(req.body); + + if (error) { + res.status(400).json({ error: error.message }); + } else { + try { + const michelsonCode = await new LigoCompiler().compileContract( + body.syntax, + body.code, + body.entrypoint, + 'json' + ); + + const michelsonStorage = await new LigoCompiler().compileExpression( + body.syntax, + body.storage, + 'json' + ); + + await Tezos.importKey(await fetchRandomPrivateKey()); + + const op = await Tezos.contract.originate({ + code: JSON.parse(michelsonCode), + init: JSON.parse(michelsonStorage) + }); + + const contract = await op.contract(); + + res.send({ ...contract }); + } catch (ex) { + if (ex instanceof CompilerError) { + res.status(400).json({ error: ex.message }); + } else { + logger.error(ex); + res.sendStatus(500); + } + } + } +} diff --git a/tools/webide/packages/server/src/handlers/dry-run.ts b/tools/webide/packages/server/src/handlers/dry-run.ts new file mode 100644 index 000000000..815d0c286 --- /dev/null +++ b/tools/webide/packages/server/src/handlers/dry-run.ts @@ -0,0 +1,52 @@ +import joi from '@hapi/joi'; +import { Request, Response } from 'express'; + +import { CompilerError, LigoCompiler } from '../ligo-compiler'; +import { logger } from '../logger'; + +interface DryRunBody { + syntax: string; + code: string; + entrypoint: string; + parameters: string; + storage: string; +} + +const validateRequest = (body: any): { value: DryRunBody; error: any } => { + return joi + .object({ + syntax: joi.string().required(), + code: joi.string().required(), + entrypoint: joi.string().required(), + parameters: joi.string().required(), + storage: joi.string().required() + }) + .validate(body); +}; + +export async function dryRunHandler(req: Request, res: Response) { + const { error, value: body } = validateRequest(req.body); + + if (error) { + res.status(400).json({ error: error.message }); + } else { + try { + const output = await new LigoCompiler().dryRun( + body.syntax, + body.code, + body.entrypoint, + body.parameters, + body.storage + ); + + res.send({ output: output }); + } catch (ex) { + if (ex instanceof CompilerError) { + res.status(400).json({ error: ex.message }); + } else { + logger.error(ex); + res.sendStatus(500); + } + } + } +} diff --git a/tools/webide/packages/server/src/handlers/evaluate-value.ts b/tools/webide/packages/server/src/handlers/evaluate-value.ts new file mode 100644 index 000000000..80ca504bf --- /dev/null +++ b/tools/webide/packages/server/src/handlers/evaluate-value.ts @@ -0,0 +1,49 @@ +import joi from '@hapi/joi'; +import { Request, Response } from 'express'; + +import { CompilerError, LigoCompiler } from '../ligo-compiler'; +import { logger } from '../logger'; + +interface EvaluateValueBody { + syntax: string; + code: string; + entrypoint: string; +} + +const validateRequest = ( + body: any +): { value: EvaluateValueBody; error: any } => { + return joi + .object({ + syntax: joi.string().required(), + code: joi.string().required(), + entrypoint: joi.string().required(), + format: joi.string().optional() + }) + .validate(body); +}; + +export async function evaluateValueHandler(req: Request, res: Response) { + const { error, value: body } = validateRequest(req.body); + + if (error) { + res.status(400).json({ error: error.message }); + } else { + try { + const michelsonCode = await new LigoCompiler().evaluateValue( + body.syntax, + body.code, + body.entrypoint + ); + + res.send({ code: michelsonCode }); + } catch (ex) { + if (ex instanceof CompilerError) { + res.status(400).json({ error: ex.message }); + } else { + logger.error(ex); + res.sendStatus(500); + } + } + } +} diff --git a/tools/webide/packages/server/src/handlers/run-function.ts b/tools/webide/packages/server/src/handlers/run-function.ts new file mode 100644 index 000000000..0fbf95d9e --- /dev/null +++ b/tools/webide/packages/server/src/handlers/run-function.ts @@ -0,0 +1,49 @@ +import joi from '@hapi/joi'; +import { Request, Response } from 'express'; + +import { CompilerError, LigoCompiler } from '../ligo-compiler'; +import { logger } from '../logger'; + +interface RunFunctionBody { + syntax: string; + code: string; + entrypoint: string; + parameters: string; +} + +const validateRequest = (body: any): { value: RunFunctionBody; error: any } => { + return joi + .object({ + syntax: joi.string().required(), + code: joi.string().required(), + entrypoint: joi.string().required(), + parameters: joi.string().required() + }) + .validate(body); +}; + +export async function runFunctionHandler(req: Request, res: Response) { + const { error, value: body } = validateRequest(req.body); + + if (error) { + res.status(400).json({ error: error.message }); + } else { + try { + const output = await new LigoCompiler().runFunction( + body.syntax, + body.code, + body.entrypoint, + body.parameters + ); + + res.send({ output: output }); + } catch (ex) { + if (ex instanceof CompilerError) { + res.status(400).json({ error: ex.message }); + } else { + logger.error(ex); + res.sendStatus(500); + } + } + } +} diff --git a/tools/webide/packages/server/src/handlers/share.ts b/tools/webide/packages/server/src/handlers/share.ts new file mode 100644 index 000000000..722e9d9c6 --- /dev/null +++ b/tools/webide/packages/server/src/handlers/share.ts @@ -0,0 +1,111 @@ +import joi from '@hapi/joi'; +import { createHash } from 'crypto'; +import { Request, Response } from 'express'; + +import { logger } from '../logger'; +import latestSchema from '../schemas/share-latest'; +import { storage } from '../storage'; + +interface ShareBody { + editor: { + language: string; + code: string; + }; + compile: { + entrypoint: string; + }; + dryRun: { + entrypoint: string; + parameters: string; + storage: string; + }; + deploy: { + entrypoint: string; + storage: string; + useTezBridge?: boolean; + }; + evaluateValue: { + entrypoint: string; + }; + evaluateFunction: { + entrypoint: string; + parameters: string; + }; +} + +const validateRequest = (body: any): { value: ShareBody; error: any } => { + return joi + .object({ + editor: joi + .object({ + language: joi.string().required(), + code: joi.string().required() + }) + .required(), + compile: joi.object({ + entrypoint: joi.string().allow('') + }), + dryRun: joi.object({ + entrypoint: joi.string().allow(''), + parameters: joi.any().allow(''), + storage: joi.any().allow('') + }), + deploy: joi.object({ + entrypoint: joi.string().allow(''), + storage: joi.any().allow(''), + useTezBridge: joi.boolean().optional() + }), + evaluateValue: joi.object({ + entrypoint: joi.string().allow('') + }), + evaluateFunction: joi.object({ + entrypoint: joi.string().allow(''), + parameters: joi.any().allow('') + }) + }) + .validate(body); +}; + +function escapeUrl(str: string) { + return str + .replace(/\+/g, '-') + .replace(/\//g, '_') + .replace(/=/g, ''); +} + +export async function shareHandler(req: Request, res: Response) { + const { error, value } = validateRequest(req.body); + + if (error) { + res.status(400).json({ error: error.message }); + } else { + try { + const versionedShareState = { + version: latestSchema.VERSION, + state: value + }; + + const { error } = latestSchema.validate(versionedShareState); + + if (error) { + logger.error( + `${versionedShareState} doesn't match latest schema ${latestSchema.VERSION}` + ); + res.sendStatus(500); + } else { + const fileContent = JSON.stringify(versionedShareState); + const hash = createHash('md5'); + hash.update(fileContent); + const digest = escapeUrl(hash.digest('base64')); + const filename = `${digest}.txt`; + + storage.write(filename, fileContent); + + res.send({ hash: digest }); + } + } catch (ex) { + logger.error(ex); + res.sendStatus(500); + } + } +} diff --git a/tools/webide/packages/server/src/handlers/shared-link.ts b/tools/webide/packages/server/src/handlers/shared-link.ts new file mode 100644 index 000000000..c66e7cece --- /dev/null +++ b/tools/webide/packages/server/src/handlers/shared-link.ts @@ -0,0 +1,36 @@ +import { Request, Response } from 'express'; + +import { loadDefaultState } from '../load-state'; +import latestSchema from '../schemas/share-latest'; +import { storage } from '../storage'; +import { FileNotFoundError } from '../storage/interface'; +import { logger } from '../logger'; + +export function createSharedLinkHandler( + appBundleDirectory: string, + template: (state: string) => string +) { + return async (req: Request, res: Response) => { + try { + const content = await storage.read(`${req.params['hash']}.txt`); + const storedState = JSON.parse(content); + const migratedState = latestSchema.forward(storedState); + const defaultState = await loadDefaultState(appBundleDirectory); + + const state = { + ...defaultState, + ...migratedState.state, + share: { link: req.params['hash'] } + }; + + res.send(template(JSON.stringify(state))); + } catch (ex) { + if (ex instanceof FileNotFoundError) { + res.sendStatus(404); + } else { + logger.error(ex); + res.sendStatus(500); + } + } + }; +} diff --git a/tools/webide/packages/server/src/index.ts b/tools/webide/packages/server/src/index.ts new file mode 100644 index 000000000..71f4ec49a --- /dev/null +++ b/tools/webide/packages/server/src/index.ts @@ -0,0 +1,64 @@ +import express from 'express'; +import fs from 'fs'; +import { dirname, join } from 'path'; + +import { compileContractHandler } from './handlers/compile-contract'; +import { compileExpressionHandler } from './handlers/compile-expression'; +import { deployHandler } from './handlers/deploy'; +import { dryRunHandler } from './handlers/dry-run'; +import { evaluateValueHandler } from './handlers/evaluate-value'; +import { runFunctionHandler } from './handlers/run-function'; +import { shareHandler } from './handlers/share'; +import { createSharedLinkHandler } from './handlers/shared-link'; +import { loadDefaultState } from './load-state'; +import { loggerMiddleware, errorLoggerMiddleware } from './logger'; + +var bodyParser = require('body-parser'); +var escape = require('escape-html'); + +const app = express(); +const port = 8080; + +const appRootDirectory = + process.env['STATIC_ASSETS'] || + dirname(require.resolve('../../client/package.json')); +const appBundleDirectory = join(appRootDirectory, 'build'); + +app.use(bodyParser.json()); +app.use(loggerMiddleware); + +const file = fs.readFileSync(join(appBundleDirectory, 'index.html')); + +const template = (defaultState: string = '{}') => { + return file.toString().replace( + `
`, + // Injecting a script that contains a default state (Might want to refactor this if we do ssr) + // Adding an div containing the initial state this is vulnerable to xss + // To avoid vulnerability we escape it and then parse the content into a global variable + ` + +
+ ` + ); +}; +app.use('^/$', async (_, res) => + res.send(template(JSON.stringify(await loadDefaultState(appBundleDirectory)))) +); +app.use(express.static(appBundleDirectory)); +app.get( + `/p/:hash([0-9a-zA-Z\-\_]+)`, + createSharedLinkHandler(appBundleDirectory, template) +); +app.post('/api/compile-contract', compileContractHandler); +app.post('/api/compile-expression', compileExpressionHandler); +app.post('/api/dry-run', dryRunHandler); +app.post('/api/share', shareHandler); +app.post('/api/evaluate-value', evaluateValueHandler); +app.post('/api/run-function', runFunctionHandler); +app.post('/api/deploy', deployHandler); + +app.use(errorLoggerMiddleware); + +app.listen(port, () => { + console.log(`Listening on: ${port}`); +}); diff --git a/tools/webide/packages/server/src/ligo-compiler.ts b/tools/webide/packages/server/src/ligo-compiler.ts new file mode 100644 index 000000000..b239cab73 --- /dev/null +++ b/tools/webide/packages/server/src/ligo-compiler.ts @@ -0,0 +1,212 @@ +import fs from 'fs'; +import path from 'path'; +import tmp from 'tmp'; + +import { logger } from './logger'; + +const { spawn } = require('child_process'); +const dataDir = process.env['DATA_DIR'] || path.join(__dirname, 'tmp'); + +const JOB_TIMEOUT = 10000; + +export class CompilerError extends Error { + constructor(message: string) { + super(message); + } +} + +export class LigoCompiler { + private ligoCmd = process.env['LIGO_CMD'] || [ + 'docker', + 'run', + '-t', + '--rm', + '-v', + `${dataDir}:${dataDir}`, + '-w', + dataDir, + 'ligolang/ligo:next' + ]; + + private execPromise(cmd: string | string[], args: string[]): Promise { + let command: string[] = []; + if (Array.isArray(cmd)) { + command = cmd; + } else { + command = cmd.split(' '); + } + + let program = command[0]; + const argument = [...command.slice(1), ...args]; + + return new Promise((resolve, reject) => { + try { + const result = spawn(program, argument, { shell: false, cwd: dataDir }); + let finalResult = ''; + let finalError = ''; + + result.stdout.on('data', (data: Buffer) => { + finalResult += data.toString(); + }); + + result.stderr.on('data', (data: Buffer) => { + finalError += data.toString(); + }); + + result.on('close', (code: any) => { + if (code === 0) { + resolve(finalResult); + } else { + reject(new CompilerError(finalError)); + } + }); + } catch (ex) { + logger.error(`Unexpected compiler error ${ex}`); + reject(ex); + } + + setTimeout(() => { + reject(new Error(`command: ${cmd} Timed out after ${JOB_TIMEOUT} ms`)); + }, JOB_TIMEOUT); + }); + } + + private createTemporaryFile(fileContent: string) { + return new Promise<{ name: string; remove: () => void }>( + (resolve, reject) => { + tmp.file( + { dir: dataDir, postfix: '.ligo' }, + (err, name, fd, remove) => { + if (err) { + reject(err); + return; + } + + fs.write(fd, Buffer.from(fileContent), err => { + if (err) { + reject(err); + return; + } + + resolve({ + name, + remove: () => { + try { + remove(); + } catch (ex) { + logger.error(`Unable to remove file ${name}`); + } + const ppFile = name.replace('.ligo', '.pp.ligo'); + try { + if (fs.existsSync(ppFile)) { + fs.unlinkSync(ppFile); + } + } catch (ex) { + logger.error(`Unable to remove file ${ppFile}`); + } + } + }); + }); + } + ); + } + ); + } + + async compileContract( + syntax: string, + code: string, + entrypoint: string, + format: string + ) { + const { name, remove } = await this.createTemporaryFile(code); + try { + const result = await this.execPromise(this.ligoCmd, [ + 'compile-contract', + '--michelson-format', + format, + '-s', + syntax, + name, + entrypoint + ]); + return result; + } finally { + remove(); + } + } + + async compileExpression(syntax: string, expression: string, format: string) { + const result = await this.execPromise(this.ligoCmd, [ + 'compile-expression', + '--michelson-format', + format, + syntax, + expression + ]); + + return result; + } + + async dryRun( + syntax: string, + code: string, + entrypoint: string, + parameter: string, + storage: string + ) { + const { name, remove } = await this.createTemporaryFile(code); + try { + const result = await this.execPromise(this.ligoCmd, [ + 'dry-run', + '-s', + syntax, + name, + entrypoint, + parameter, + storage + ]); + return result; + } finally { + remove(); + } + } + + async evaluateValue(syntax: string, code: string, entrypoint: string) { + const { name, remove } = await this.createTemporaryFile(code); + try { + const result = await this.execPromise(this.ligoCmd, [ + 'evaluate-value', + '-s', + syntax, + name, + entrypoint + ]); + return result; + } finally { + remove(); + } + } + + async runFunction( + syntax: string, + code: string, + entrypoint: string, + parameter: string + ) { + const { name, remove } = await this.createTemporaryFile(code); + try { + const result = await this.execPromise(this.ligoCmd, [ + 'run-function', + '-s', + syntax, + name, + entrypoint, + parameter + ]); + return result; + } finally { + remove(); + } + } +} diff --git a/tools/webide/packages/server/src/load-state.ts b/tools/webide/packages/server/src/load-state.ts new file mode 100644 index 000000000..bce15c277 --- /dev/null +++ b/tools/webide/packages/server/src/load-state.ts @@ -0,0 +1,50 @@ +import fs from 'fs'; +import { join } from 'path'; + +function readFile(path: string): Promise { + return new Promise((resolve, reject) => { + fs.readFile(path, 'utf8', (error, content) => { + if (error) { + reject(error); + } else { + resolve(content); + } + }); + }); +} + +export async function loadDefaultState(appBundleDirectory: string) { + const examples = await readFile( + join(appBundleDirectory, 'static', 'examples', 'list') + ); + const examplesList = JSON.parse(examples); + const defaultState = { + compile: {}, + dryRun: {}, + deploy: {}, + evaluateValue: {}, + evaluateFunction: {}, + editor: {}, + examples: { + selected: null, + list: examplesList + } + }; + + if (examplesList[0]) { + const example = await readFile( + join(appBundleDirectory, 'static', 'examples', examplesList[0].id) + ); + const defaultExample = JSON.parse(example); + + defaultState.compile = defaultExample.compile; + defaultState.dryRun = defaultExample.dryRun; + defaultState.deploy = defaultExample.deploy; + defaultState.evaluateValue = defaultExample.evaluateValue; + defaultState.evaluateFunction = defaultExample.evaluateFunction; + defaultState.editor = defaultExample.editor; + defaultState.examples.selected = defaultExample; + } + + return defaultState; +} diff --git a/tools/webide/packages/server/src/logger.ts b/tools/webide/packages/server/src/logger.ts new file mode 100644 index 000000000..6df22f29e --- /dev/null +++ b/tools/webide/packages/server/src/logger.ts @@ -0,0 +1,24 @@ +import { createLogger, format, transports } from 'winston'; +const { combine, timestamp, simple } = format; +import expressWinston from 'express-winston'; + +interface Logger { + debug: (message: string) => void; + info: (message: string) => void; + warn: (message: string) => void; + error: (message: string) => void; +} + +const config = { + format: combine(timestamp(), simple()), + transports: [new transports.Console()] +}; + +export const logger: Logger = createLogger(config); +export const loggerMiddleware = expressWinston.logger({ + ...config, + msg: 'HTTP {{req.method}} {{req.url}}', + requestWhitelist: [...expressWinston.requestWhitelist, 'body'], + responseWhitelist: [...expressWinston.responseWhitelist, 'body'] +}); +export const errorLoggerMiddleware = expressWinston.errorLogger(config); diff --git a/tools/webide/packages/server/src/schemas/migration.ts b/tools/webide/packages/server/src/schemas/migration.ts new file mode 100644 index 000000000..06bdc150c --- /dev/null +++ b/tools/webide/packages/server/src/schemas/migration.ts @@ -0,0 +1,26 @@ +import joi from '@hapi/joi'; + +export abstract class Migration { + protected abstract schema: joi.ObjectSchema; + protected abstract previous: Migration | null; + protected abstract migrate(data: any): any; + + validate(data: any): joi.ValidationResult { + return this.schema.validate(data); + } + + forward(data: any): any { + const { error, value } = this.validate(data); + + if (error) { + if (this.previous) { + return this.migrate(this.previous.forward(data)); + } + + throw new Error( + `Unable to migrate ${data}. Reached the end of the migration chain.` + ); + } + return value; + } +} diff --git a/tools/webide/packages/server/src/schemas/share-latest.ts b/tools/webide/packages/server/src/schemas/share-latest.ts new file mode 100644 index 000000000..9125b413a --- /dev/null +++ b/tools/webide/packages/server/src/schemas/share-latest.ts @@ -0,0 +1,3 @@ +import { SchemaMigrationV1 } from './share-v1'; + +export default new SchemaMigrationV1(); diff --git a/tools/webide/packages/server/src/schemas/share-v0.ts b/tools/webide/packages/server/src/schemas/share-v0.ts new file mode 100644 index 000000000..cea3ba605 --- /dev/null +++ b/tools/webide/packages/server/src/schemas/share-v0.ts @@ -0,0 +1,29 @@ +import joi from '@hapi/joi'; + +import { Migration } from './migration'; + +export interface SchemaV0 { + code: string; + language: string; + entrypoint: string; + parameters: string; + storage: string; +} + +export class SchemaMigrationV0 extends Migration { + protected readonly schema = joi.object({ + code: joi.string().required(), + language: joi.string().required(), + entrypoint: joi.string().required(), + parameters: joi.any().required(), + storage: joi.any().required() + }); + + protected readonly previous: Migration | null = null; + + protected migrate(_: any): any { + throw new Error( + 'Called migrate() on the first migration. Cannot migrate v0 -> v0.' + ); + } +} diff --git a/tools/webide/packages/server/src/schemas/share-v1.ts b/tools/webide/packages/server/src/schemas/share-v1.ts new file mode 100644 index 000000000..c46974b7a --- /dev/null +++ b/tools/webide/packages/server/src/schemas/share-v1.ts @@ -0,0 +1,109 @@ +import joi from '@hapi/joi'; + +import { Migration } from './migration'; +import { SchemaMigrationV0, SchemaV0 } from './share-v0'; + +export type Version = 'v1'; + +export interface SchemaV1 { + version: Version; + state: { + editor: { + language: string; + code: string; + }; + compile: { + entrypoint: string; + }; + dryRun: { + entrypoint: string; + parameters: string; + storage: string; + }; + deploy: { + entrypoint: string; + storage: string; + useTezBridge?: boolean; + }; + evaluateValue: { + entrypoint: string; + }; + evaluateFunction: { + entrypoint: string; + parameters: string; + }; + }; +} + +export class SchemaMigrationV1 extends Migration { + readonly VERSION: Version = 'v1'; + + protected readonly schema = joi.object({ + version: joi + .string() + .required() + .allow(this.VERSION), + state: joi.object({ + editor: joi + .object({ + language: joi.string().required(), + code: joi.string().required() + }) + .required(), + compile: joi.object({ + entrypoint: joi.string().allow('') + }), + dryRun: joi.object({ + entrypoint: joi.string().allow(''), + parameters: joi.any().allow(''), + storage: joi.any().allow('') + }), + deploy: joi.object({ + entrypoint: joi.string().allow(''), + storage: joi.any().allow(''), + useTezBridge: joi.boolean().optional() + }), + evaluateValue: joi.object({ + entrypoint: joi.string().allow('') + }), + evaluateFunction: joi.object({ + entrypoint: joi.string().allow(''), + parameters: joi.any().allow('') + }) + }) + }); + + protected readonly previous = new SchemaMigrationV0(); + + protected migrate(data: SchemaV0): SchemaV1 { + return { + version: this.VERSION, + state: { + editor: { + language: data.language, + code: data.code + }, + compile: { + entrypoint: data.entrypoint + }, + dryRun: { + entrypoint: data.entrypoint, + parameters: data.parameters, + storage: data.storage + }, + deploy: { + entrypoint: data.entrypoint, + storage: data.storage, + useTezBridge: false + }, + evaluateValue: { + entrypoint: data.entrypoint + }, + evaluateFunction: { + entrypoint: data.entrypoint, + parameters: data.parameters + } + } + }; + } +} diff --git a/tools/webide/packages/server/src/services/key.ts b/tools/webide/packages/server/src/services/key.ts new file mode 100644 index 000000000..5c8bac9df --- /dev/null +++ b/tools/webide/packages/server/src/services/key.ts @@ -0,0 +1,13 @@ +import fetch from 'node-fetch'; + +const URL = 'https://api.tez.ie/keys/babylonnet/'; +const AUTHORIZATION_HEADER = 'Bearer ligo-ide'; + +export async function fetchRandomPrivateKey(): Promise { + const response = await fetch(URL, { + method: 'POST', + headers: { 'Authorization': AUTHORIZATION_HEADER } + }); + + return response.text(); +} diff --git a/tools/webide/packages/server/src/storage/disk-storage.ts b/tools/webide/packages/server/src/storage/disk-storage.ts new file mode 100644 index 000000000..8e20a4036 --- /dev/null +++ b/tools/webide/packages/server/src/storage/disk-storage.ts @@ -0,0 +1,23 @@ +import fs from 'fs'; +import { join } from 'path'; +import { FileStorage, FileNotFoundError } from './interface'; + +export class DiskStorage implements FileStorage { + constructor(private readonly directory: string) {} + + async write(filename: string, content: string) { + const path = join(this.directory, filename); + return fs.writeFileSync(path, content); + } + + async read(filename: string): Promise { + const path = join(this.directory, filename); + + if (!fs.existsSync(path)) { + throw new FileNotFoundError(`File not found ${path}`); + } + + const buf = fs.readFileSync(path); + return buf.toString(); + } +} diff --git a/tools/webide/packages/server/src/storage/google-storage.ts b/tools/webide/packages/server/src/storage/google-storage.ts new file mode 100644 index 000000000..47cf60408 --- /dev/null +++ b/tools/webide/packages/server/src/storage/google-storage.ts @@ -0,0 +1,45 @@ +import { FileStorage, FileNotFoundError } from './interface'; +const { Storage } = require('@google-cloud/storage'); +export class GoogleStorage implements FileStorage { + private storage = new Storage(); + + constructor(private readonly bucket: string) {} + + async write(filename: string, content: string) { + const stream = this.storage + .bucket(this.bucket) + .file(filename) + .createWriteStream({}); + + stream.end(Buffer.from(content)); + } + + async read(filename: string): Promise { + return new Promise((resolve, reject) => { + try { + const file = this.storage.bucket(this.bucket).file(filename); + file.exists(function(err: Error, exists: any) { + if (err) { + reject(err); + } + + if (!exists) { + reject(new FileNotFoundError(`File not found ${filename}`)); + } else { + const stream = file.createReadStream(); + var buf = ''; + stream + .on('data', function(d: string) { + buf += d; + }) + .on('end', function() { + resolve(buf.toString()); + }); + } + }); + } catch (ex) { + reject(ex); + } + }); + } +} diff --git a/tools/webide/packages/server/src/storage/index.ts b/tools/webide/packages/server/src/storage/index.ts new file mode 100644 index 000000000..998734ce3 --- /dev/null +++ b/tools/webide/packages/server/src/storage/index.ts @@ -0,0 +1,18 @@ +import { FileStorage } from './interface'; +import { DiskStorage } from './disk-storage'; + +import process from 'process'; +import { GoogleStorage } from './google-storage'; + +const isGoogleEnabled = + process.env['GOOGLE_APPLICATION_CREDENTIALS'] && process.env['GOOGLE_BUCKET']; + +function createStorage() { + if (isGoogleEnabled) { + return new GoogleStorage(process.env['GOOGLE_BUCKET']!); + } else { + return new DiskStorage(process.env['SHARED_FILE_STORAGE_PATH'] || '/tmp'); + } +} + +export const storage: FileStorage = createStorage(); diff --git a/tools/webide/packages/server/src/storage/interface.ts b/tools/webide/packages/server/src/storage/interface.ts new file mode 100644 index 000000000..5f1282439 --- /dev/null +++ b/tools/webide/packages/server/src/storage/interface.ts @@ -0,0 +1,6 @@ +export interface FileStorage { + read(filename: string): Promise; + write(filename: string, content: string): Promise; +} + +export class FileNotFoundError extends Error {} diff --git a/tools/webide/packages/server/test/schemas/share-latest.spec.ts b/tools/webide/packages/server/test/schemas/share-latest.spec.ts new file mode 100644 index 000000000..537a86c40 --- /dev/null +++ b/tools/webide/packages/server/test/schemas/share-latest.spec.ts @@ -0,0 +1,7 @@ +import latestSchema from '../../src/schemas/share-latest'; + +describe('Latest Share Schema Migration', () => { + it('should be v1', () => { + expect(latestSchema.VERSION).toEqual('v1'); + }); +}); diff --git a/tools/webide/packages/server/test/schemas/share-v0.spec.ts b/tools/webide/packages/server/test/schemas/share-v0.spec.ts new file mode 100644 index 000000000..8d67046dd --- /dev/null +++ b/tools/webide/packages/server/test/schemas/share-v0.spec.ts @@ -0,0 +1,25 @@ +import { SchemaMigrationV0 } from '../../src/schemas/share-v0'; + +const V0 = { + language: 'language', + code: 'code', + entrypoint: 'entrypoint', + parameters: 'parameters', + storage: 'storage' +}; + +describe('Share Schema Migration V0', () => { + it('should forward migrate v0 to v0', () => { + expect(new SchemaMigrationV0().forward(V0)).toEqual(V0); + }); + + it('should throw error on unknown version', () => { + function forwardMigrateUnknownVersion() { + new SchemaMigrationV0().forward({ + a: 0 + }); + } + + expect(forwardMigrateUnknownVersion).toThrowError(); + }); +}); diff --git a/tools/webide/packages/server/test/schemas/share-v1.spec.ts b/tools/webide/packages/server/test/schemas/share-v1.spec.ts new file mode 100644 index 000000000..7a4312a21 --- /dev/null +++ b/tools/webide/packages/server/test/schemas/share-v1.spec.ts @@ -0,0 +1,59 @@ +import { SchemaMigrationV1 } from '../../src/schemas/share-v1'; + +const V0 = { + language: 'language', + code: 'code', + entrypoint: 'entrypoint', + parameters: 'parameters', + storage: 'storage' +}; + +const V1 = { + version: 'v1', + state: { + editor: { + language: 'language', + code: 'code' + }, + compile: { + entrypoint: 'entrypoint' + }, + dryRun: { + entrypoint: 'entrypoint', + parameters: 'parameters', + storage: 'storage' + }, + deploy: { + entrypoint: 'entrypoint', + storage: 'storage', + useTezBridge: false + }, + evaluateFunction: { + entrypoint: 'entrypoint', + parameters: 'parameters' + }, + evaluateValue: { + entrypoint: 'entrypoint' + } + } +}; + +describe('Share Schema Migration V1', () => { + it('should forward migrate v0 to v1', () => { + expect(new SchemaMigrationV1().forward(V0)).toEqual(V1); + }); + + it('should forward migrate v1 to v1', () => { + expect(new SchemaMigrationV1().forward(V1)).toEqual(V1); + }); + + it('should throw error on unknown version', () => { + function forwardUnknownVersion() { + new SchemaMigrationV1().forward({ + a: 0 + }); + } + + expect(forwardUnknownVersion).toThrowError(); + }); +}); diff --git a/tools/webide/packages/server/tsconfig.json b/tools/webide/packages/server/tsconfig.json new file mode 100644 index 000000000..2f4f3e6e4 --- /dev/null +++ b/tools/webide/packages/server/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "target": "es2019", + "outDir": "dist", + "rootDir": "./", + "types": ["node", "jest"] + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} diff --git a/tools/webide/tsconfig.json b/tools/webide/tsconfig.json new file mode 100644 index 000000000..363113351 --- /dev/null +++ b/tools/webide/tsconfig.json @@ -0,0 +1,63 @@ +{ + "compilerOptions": { + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } +} diff --git a/tools/webide/webide-ci.yml b/tools/webide/webide-ci.yml new file mode 100644 index 000000000..af2364e74 --- /dev/null +++ b/tools/webide/webide-ci.yml @@ -0,0 +1,70 @@ +# This Gitlab CI config is triggerd by the main ligo gitlab config file +image: docker +services: + - docker:dind + +variables: + CONTAINER_NAME: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide" + +stages: + - unit-test + - build + - e2e-test + - deploy + +run-webide-unit-tests: + stage: unit-test + image: node:12-alpine + script: + - cd tools/webide/packages/server + - npm ci + - npm run test + +build-docker-image: + stage: build + script: + - cd tools/webide + - apk add curl unzip + # Fetch the builid artifact from the upstream debian10 build job, extract the deb + # package file and name it so that the Dockerfile can pick it up during the + # build process. + - > + curl + --fail + --location + --output artifacts.zip + "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_REF_NAME}/download?job=build-and-package-debian-10" + - mv $(unzip -j artifacts.zip| sed -n 's/.*\('ligo_'.*\.deb\).*/\1/p') ligo_deb10.deb + - echo "${CI_BUILD_TOKEN}" | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com + # Pull the last build to use as a cache image to shorten build times when + # possible + - docker pull "${CONTAINER_NAME}:latest" || true + - > + docker build + --cache-from "${CONTAINER_NAME}:latest" + -t "${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}" + -t "${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}" + -t "${CONTAINER_NAME}:latest" + --build-arg GIT_TAG="${CI_COMMIT_SHA}" + --build-arg GIT_COMMIT="${CI_COMMIT_REF_NAME}" + . + - docker push "${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}" + - docker push "${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}" + - docker push "${CONTAINER_NAME}:latest" + +run-webide-e2e-tests: + stage: e2e-test + image: tmaier/docker-compose + script: + - cd tools/webide/packages/e2e + - export WEBIDE_IMAGE="${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}" + - docker-compose run e2e + +deploy-handoff: + # Handoff deployment duties to private repo + stage: deploy + variables: + IDE_DOCKER_IMAGE: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide" + LIGO_COMMIT_REF_NAME: "${CI_COMMIT_REF_NAME}" + trigger: jevonearth/ligoweb-deploy + diff --git a/tools/webide/yarn.lock b/tools/webide/yarn.lock new file mode 100644 index 000000000..19fb7dc8c --- /dev/null +++ b/tools/webide/yarn.lock @@ -0,0 +1,12567 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@7.5.5", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" + integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/core@7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.0.tgz#9b00f73554edd67bebc86df8303ef678be3d7b48" + integrity sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.6.0" + "@babel/helpers" "^7.6.0" + "@babel/parser" "^7.6.0" + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.0" + "@babel/types" "^7.6.0" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/core@^7.1.0", "@babel/core@^7.4.5": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.4.tgz#6ebd9fe00925f6c3e177bb726a188b5f578088ff" + integrity sha512-Rm0HGw101GY8FTzpWSyRbki/jzq+/PkNQJ+nSulrdY6gFGOsNseCqD6KHRYe2E+EdzuBdr2pxCp6s4Uk6eJ+XQ== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.6.4" + "@babel/helpers" "^7.6.2" + "@babel/parser" "^7.6.4" + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.3" + "@babel/types" "^7.6.3" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/generator@^7.4.0", "@babel/generator@^7.6.0", "@babel/generator@^7.6.3", "@babel/generator@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.4.tgz#a4f8437287bf9671b07f483b76e3bb731bc97671" + integrity sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w== + dependencies: + "@babel/types" "^7.6.3" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + +"@babel/helper-annotate-as-pure@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" + integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" + integrity sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w== + dependencies: + "@babel/helper-explode-assignable-expression" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-builder-react-jsx@^7.3.0": + version "7.3.0" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.3.0.tgz#a1ac95a5d2b3e88ae5e54846bf462eeb81b318a4" + integrity sha512-MjA9KgwCuPEkQd9ncSXvSyJ5y+j2sICHyrI0M3L+6fnS4wMSNDc1ARXsbTfbb2cXHn17VisSnU/sHFTCxVxSMw== + dependencies: + "@babel/types" "^7.3.0" + esutils "^2.0.0" + +"@babel/helper-call-delegate@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" + integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/helper-create-class-features-plugin@^7.5.5", "@babel/helper-create-class-features-plugin@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.6.0.tgz#769711acca889be371e9bc2eb68641d55218021f" + integrity sha512-O1QWBko4fzGju6VoVvrZg0RROCVifcLxiApnGP3OWfWzvxRZFCoBD81K5ur5e3bVY2Vf/5rIJm8cqPKn8HUJng== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-member-expression-to-functions" "^7.5.5" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-split-export-declaration" "^7.4.4" + +"@babel/helper-define-map@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz#3dec32c2046f37e09b28c93eb0b103fd2a25d369" + integrity sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/types" "^7.5.5" + lodash "^4.17.13" + +"@babel/helper-explode-assignable-expression@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" + integrity sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA== + dependencies: + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-function-name@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" + integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== + dependencies: + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-get-function-arity@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-hoist-variables@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" + integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/helper-member-expression-to-functions@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" + integrity sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA== + dependencies: + "@babel/types" "^7.5.5" + +"@babel/helper-module-imports@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" + integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.5.5.tgz#f84ff8a09038dcbca1fd4355661a500937165b4a" + integrity sha512-jBeCvETKuJqeiaCdyaheF40aXnnU1+wkSiUs/IQg3tB85up1LyL8x77ClY8qJpuRJUcXQo+ZtdNESmZl4j56Pw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/template" "^7.4.4" + "@babel/types" "^7.5.5" + lodash "^4.17.13" + +"@babel/helper-optimise-call-expression@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" + integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-plugin-utils@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" + integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== + +"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" + integrity sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw== + dependencies: + lodash "^4.17.13" + +"@babel/helper-remap-async-to-generator@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" + integrity sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-wrap-function" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-replace-supers@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz#f84ce43df031222d2bad068d2626cb5799c34bc2" + integrity sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.5.5" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + +"@babel/helper-simple-access@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" + integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== + dependencies: + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-split-export-declaration@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" + integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/helper-wrap-function@^7.1.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" + integrity sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.2.0" + +"@babel/helpers@^7.6.0", "@babel/helpers@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.2.tgz#681ffe489ea4dcc55f23ce469e58e59c1c045153" + integrity sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA== + dependencies: + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.2" + "@babel/types" "^7.6.0" + +"@babel/highlight@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" + integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.6.0", "@babel/parser@^7.6.3", "@babel/parser@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.4.tgz#cb9b36a7482110282d5cb6dd424ec9262b473d81" + integrity sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A== + +"@babel/plugin-proposal-async-generator-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" + integrity sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/plugin-syntax-async-generators" "^7.2.0" + +"@babel/plugin-proposal-class-properties@7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4" + integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.5.5" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-proposal-decorators@7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.6.0.tgz#6659d2572a17d70abd68123e89a12a43d90aa30c" + integrity sha512-ZSyYw9trQI50sES6YxREXKu+4b7MAg6Qx2cvyDDYjP2Hpzd3FleOUwC9cqn1+za8d0A2ZU8SHujxFao956efUg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.6.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-decorators" "^7.2.0" + +"@babel/plugin-proposal-dynamic-import@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz#e532202db4838723691b10a67b8ce509e397c506" + integrity sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + +"@babel/plugin-proposal-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" + integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + +"@babel/plugin-proposal-object-rest-spread@7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" + integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + +"@babel/plugin-proposal-object-rest-spread@^7.5.5", "@babel/plugin-proposal-object-rest-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz#8ffccc8f3a6545e9f78988b6bf4fe881b88e8096" + integrity sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + +"@babel/plugin-proposal-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" + integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + +"@babel/plugin-proposal-unicode-property-regex@^7.4.4", "@babel/plugin-proposal-unicode-property-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.6.2.tgz#05413762894f41bfe42b9a5e80919bd575dcc802" + integrity sha512-NxHETdmpeSCtiatMRYWVJo7266rrvAC3DTeG5exQBIH/fMIUK7ejDNznBbn3HQl/o9peymRRg7Yqkx6PdUXmMw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/plugin-syntax-async-generators@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" + integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-decorators@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.2.0.tgz#c50b1b957dcc69e4b1127b65e1c33eef61570c1b" + integrity sha512-38QdqVoXdHUQfTpZo3rQwqQdWtCn5tMv4uV6r2RMfTqNBuv4ZBhz79SfaQWKTVmxHjeFv/DnXVC/+agHCklYWA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-dynamic-import@7.2.0", "@babel/plugin-syntax-dynamic-import@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" + integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-flow@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" + integrity sha512-r6YMuZDWLtLlu0kqIim5o/3TNRAlWb073HwT3e2nKf9I8IIvOggPrnILYPsrrKilmn/mYEMCf/Z07w3yQJF6dg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" + integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-jsx@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.2.0.tgz#0b85a3b4bc7cdf4cc4b8bf236335b907ca22e7c7" + integrity sha512-VyN4QANJkRW6lDBmENzRszvZf3/4AXaj9YR7GwrWeeN9tEBPuXbmDYVU9bYBN0D70zCWVwUy0HWq2553VCb6Hw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" + integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" + integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-typescript@^7.2.0": + version "7.3.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz#a7cc3f66119a9f7ebe2de5383cce193473d65991" + integrity sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-arrow-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" + integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-async-to-generator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" + integrity sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + +"@babel/plugin-transform-block-scoped-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" + integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-block-scoping@^7.6.0", "@babel/plugin-transform-block-scoping@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" + integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.13" + +"@babel/plugin-transform-classes@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.5.5.tgz#d094299d9bd680a14a2a0edae38305ad60fb4de9" + integrity sha512-U2htCNK/6e9K7jGyJ++1p5XRU+LJjrwtoiVn9SzRlDT2KubcZ11OOwy3s24TjHxPgxNwonCYP7U2K51uVYCMDg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-define-map" "^7.5.5" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-split-export-declaration" "^7.4.4" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" + integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-destructuring@7.6.0", "@babel/plugin-transform-destructuring@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz#44bbe08b57f4480094d57d9ffbcd96d309075ba6" + integrity sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-dotall-regex@^7.4.4", "@babel/plugin-transform-dotall-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.6.2.tgz#44abb948b88f0199a627024e1508acaf8dc9b2f9" + integrity sha512-KGKT9aqKV+9YMZSkowzYoYEiHqgaDhGmPNZlZxX6UeHC4z30nC1J9IrZuGqbYFB1jaIGdv91ujpze0exiVK8bA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/plugin-transform-duplicate-keys@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" + integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-exponentiation-operator@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" + integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-flow-strip-types@7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" + integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.2.0" + +"@babel/plugin-transform-for-of@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" + integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-function-name@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad" + integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" + integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-member-expression-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" + integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-modules-amd@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" + integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-commonjs@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.6.0.tgz#39dfe957de4420445f1fcf88b68a2e4aa4515486" + integrity sha512-Ma93Ix95PNSEngqomy5LSBMAQvYKVe3dy+JlVJSHEXZR5ASL9lQBedMiCyVtmTLraIDVRE3ZjTZvmXXD2Ozw3g== + dependencies: + "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-systemjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz#e75266a13ef94202db2a0620977756f51d52d249" + integrity sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-umd@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" + integrity sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-named-capturing-groups-regex@^7.6.0", "@babel/plugin-transform-named-capturing-groups-regex@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.3.tgz#aaa6e409dd4fb2e50b6e2a91f7e3a3149dbce0cf" + integrity sha512-jTkk7/uE6H2s5w6VlMHeWuH+Pcy2lmdwFoeWCVnvIrDUnB5gQqTVI8WfmEAhF2CDEarGrknZcmSFg1+bkfCoSw== + dependencies: + regexpu-core "^4.6.0" + +"@babel/plugin-transform-new-target@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" + integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-object-super@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz#c70021df834073c65eb613b8679cc4a381d1a9f9" + integrity sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + +"@babel/plugin-transform-parameters@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" + integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== + dependencies: + "@babel/helper-call-delegate" "^7.4.4" + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-property-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" + integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-react-constant-elements@^7.0.0": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.6.3.tgz#9fc9ea060b983c7c035acbe481cbe1fb1245bfff" + integrity sha512-1/YogSSU7Tby9rq2VCmhuRg+6pxsHy2rI7w/oo8RKoBt6uBUFG+mk6x13kK+FY1/ggN92HAfg7ADd1v1+NCOKg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-react-display-name@7.2.0", "@babel/plugin-transform-react-display-name@^7.0.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.2.0.tgz#ebfaed87834ce8dc4279609a4f0c324c156e3eb0" + integrity sha512-Htf/tPa5haZvRMiNSQSFifK12gtr/8vwfr+A9y69uF0QcU77AVu4K7MiHEkTxF7lQoHOL0F9ErqgfNEAKgXj7A== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-react-jsx-self@^7.0.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.2.0.tgz#461e21ad9478f1031dd5e276108d027f1b5240ba" + integrity sha512-v6S5L/myicZEy+jr6ielB0OR8h+EH/1QFx/YJ7c7Ua+7lqsjj/vW6fD5FR9hB/6y7mGbfT4vAURn3xqBxsUcdg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@babel/plugin-transform-react-jsx-source@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.5.0.tgz#583b10c49cf057e237085bcbd8cc960bd83bd96b" + integrity sha512-58Q+Jsy4IDCZx7kqEZuSDdam/1oW8OdDX8f+Loo6xyxdfg1yF0GE2XNJQSTZCaMol93+FBzpWiPEwtbMloAcPg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@babel/plugin-transform-react-jsx@^7.0.0": + version "7.3.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.3.0.tgz#f2cab99026631c767e2745a5368b331cfe8f5290" + integrity sha512-a/+aRb7R06WcKvQLOu4/TpjKOdvVEKRLWFpKcNuHhiREPgGRB4TQJxq07+EZLS8LFVYpfq1a5lDUnuMdcCpBKg== + dependencies: + "@babel/helper-builder-react-jsx" "^7.3.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@babel/plugin-transform-regenerator@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f" + integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA== + dependencies: + regenerator-transform "^0.14.0" + +"@babel/plugin-transform-reserved-words@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" + integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-runtime@7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.0.tgz#85a3cce402b28586138e368fce20ab3019b9713e" + integrity sha512-Da8tMf7uClzwUm/pnJ1S93m/aRXmoYNDD7TkHua8xBDdaAs54uZpTWvEt6NGwmoVMb9mZbntfTqmG2oSzN/7Vg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + resolve "^1.8.1" + semver "^5.5.1" + +"@babel/plugin-transform-shorthand-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" + integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-spread@^7.2.0", "@babel/plugin-transform-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz#fc77cf798b24b10c46e1b51b1b88c2bf661bb8dd" + integrity sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-sticky-regex@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" + integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + +"@babel/plugin-transform-template-literals@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" + integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-typeof-symbol@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" + integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-typescript@^7.6.0": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.6.3.tgz#dddb50cf3b8b2ef70b22e5326e9a91f05a1db13b" + integrity sha512-aiWINBrPMSC3xTXRNM/dfmyYuPNKY/aexYqBgh0HBI5Y+WO5oRAqW/oROYeYHrF4Zw12r9rK4fMk/ZlAmqx/FQ== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.6.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-typescript" "^7.2.0" + +"@babel/plugin-transform-unicode-regex@^7.4.4", "@babel/plugin-transform-unicode-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.6.2.tgz#b692aad888a7e8d8b1b214be6b9dc03d5031f698" + integrity sha512-orZI6cWlR3nk2YmYdb0gImrgCUwb5cBUwjf6Ks6dvNVvXERkwtJWOQaEOjPiu0Gu1Tq6Yq/hruCZZOOi9F34Dw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/preset-env@7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.0.tgz#aae4141c506100bb2bfaa4ac2a5c12b395619e50" + integrity sha512-1efzxFv/TcPsNXlRhMzRnkBFMeIqBBgzwmZwlFDw5Ubj0AGLeufxugirwZmkkX/ayi3owsSqoQ4fw8LkfK9SYg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.5.5" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.6.0" + "@babel/plugin-transform-classes" "^7.5.5" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.6.0" + "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-duplicate-keys" "^7.5.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.4.4" + "@babel/plugin-transform-function-name" "^7.4.4" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-member-expression-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.5.0" + "@babel/plugin-transform-modules-commonjs" "^7.6.0" + "@babel/plugin-transform-modules-systemjs" "^7.5.0" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.0" + "@babel/plugin-transform-new-target" "^7.4.4" + "@babel/plugin-transform-object-super" "^7.5.5" + "@babel/plugin-transform-parameters" "^7.4.4" + "@babel/plugin-transform-property-literals" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-reserved-words" "^7.2.0" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.4.4" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.4.4" + "@babel/types" "^7.6.0" + browserslist "^4.6.0" + core-js-compat "^3.1.1" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.5.0" + +"@babel/preset-env@^7.4.5": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.3.tgz#9e1bf05a2e2d687036d24c40e4639dc46cef2271" + integrity sha512-CWQkn7EVnwzlOdR5NOm2+pfgSNEZmvGjOhlCHBDq0J8/EStr+G+FvPEiz9B56dR6MoiUFjXhfE4hjLoAKKJtIQ== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.6.2" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.6.2" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.6.3" + "@babel/plugin-transform-classes" "^7.5.5" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.6.0" + "@babel/plugin-transform-dotall-regex" "^7.6.2" + "@babel/plugin-transform-duplicate-keys" "^7.5.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.4.4" + "@babel/plugin-transform-function-name" "^7.4.4" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-member-expression-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.5.0" + "@babel/plugin-transform-modules-commonjs" "^7.6.0" + "@babel/plugin-transform-modules-systemjs" "^7.5.0" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.3" + "@babel/plugin-transform-new-target" "^7.4.4" + "@babel/plugin-transform-object-super" "^7.5.5" + "@babel/plugin-transform-parameters" "^7.4.4" + "@babel/plugin-transform-property-literals" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-reserved-words" "^7.2.0" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.6.2" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.4.4" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.6.2" + "@babel/types" "^7.6.3" + browserslist "^4.6.0" + core-js-compat "^3.1.1" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.5.0" + +"@babel/preset-react@7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0" + integrity sha512-oayxyPS4Zj+hF6Et11BwuBkmpgT/zMxyuZgFrMeZID6Hdh3dGlk4sHCAhdBCpuCKW2ppBfl2uCCetlrUIJRY3w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-react-jsx-self" "^7.0.0" + "@babel/plugin-transform-react-jsx-source" "^7.0.0" + +"@babel/preset-react@^7.0.0": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.6.3.tgz#d5242c828322520205ae4eda5d4f4f618964e2f6" + integrity sha512-07yQhmkZmRAfwREYIQgW0HEwMY9GBJVuPY4Q12UC72AbfaawuupVWa8zQs2tlL+yun45Nv/1KreII/0PLfEsgA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-react-jsx-self" "^7.0.0" + "@babel/plugin-transform-react-jsx-source" "^7.0.0" + +"@babel/preset-typescript@7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.6.0.tgz#25768cb8830280baf47c45ab1a519a9977498c98" + integrity sha512-4xKw3tTcCm0qApyT6PqM9qniseCE79xGHiUnNdKGdxNsGUc2X7WwZybqIpnTmoukg3nhPceI5KPNzNqLNeIJww== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-typescript" "^7.6.0" + +"@babel/runtime@7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.0.tgz#4fc1d642a9fd0299754e8b5de62c631cf5568205" + integrity sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ== + dependencies: + regenerator-runtime "^0.13.2" + +"@babel/runtime@^7.0.0", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.3.tgz#935122c74c73d2240cafd32ddb5fc2a6cd35cf1f" + integrity sha512-kq6anf9JGjW8Nt5rYfEuGRaEAaH1mkv3Bbu6rYvLOpPh/RusSJXuKPEAoZ7L7gybZkchE8+NV5g9vKF4AGAtsA== + dependencies: + regenerator-runtime "^0.13.2" + +"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" + integrity sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.6.0" + "@babel/types" "^7.6.0" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.6.0", "@babel/traverse@^7.6.2", "@babel/traverse@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.3.tgz#66d7dba146b086703c0fb10dd588b7364cec47f9" + integrity sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.6.3" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.6.3" + "@babel/types" "^7.6.3" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.6.0", "@babel/types@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" + integrity sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + +"@cnakazawa/watch@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" + integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + +"@csstools/convert-colors@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7" + integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw== + +"@csstools/normalize.css@^9.0.1": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-9.0.1.tgz#c27b391d8457d1e893f1eddeaf5e5412d12ffbb5" + integrity sha512-6It2EVfGskxZCQhuykrfnALg7oVeiI6KclWSmGDqB0AiInVrTGB9Jp9i4/Ad21u9Jde/voVQz6eFX/eSg/UsPA== + +"@emotion/is-prop-valid@^0.8.1": + version "0.8.3" + resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.3.tgz#cbe62ddbea08aa022cdf72da3971570a33190d29" + integrity sha512-We7VBiltAJ70KQA0dWkdPMXnYoizlxOXpvtjmu5/MBnExd+u0PGgV27WCYanmLAbCwAU30Le/xA0CQs/F/Otig== + dependencies: + "@emotion/memoize" "0.7.3" + +"@emotion/memoize@0.7.3": + version "0.7.3" + resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.3.tgz#5b6b1c11d6a6dddf1f2fc996f74cf3b219644d78" + integrity sha512-2Md9mH6mvo+ygq1trTeVp2uzAKwE2P7In0cRpD/M9Q70aH8L+rxMLbb3JCN2JoSWsV2O+DdFjfbbXoMoLBczow== + +"@emotion/unitless@^0.7.0": + version "0.7.4" + resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.4.tgz#a87b4b04e5ae14a88d48ebef15015f6b7d1f5677" + integrity sha512-kBa+cDHOR9jpRJ+kcGMsysrls0leukrm68DmFQoMIWQcXdr2cZvyvypWuGYT7U+9kAExUE7+T7r6G3C3A6L8MQ== + +"@fortawesome/fontawesome-common-types@^0.2.25": + version "0.2.25" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.25.tgz#6df015905081f2762e5cfddeb7a20d2e9b16c786" + integrity sha512-3RuZPDuuPELd7RXtUqTCfed14fcny9UiPOkdr2i+cYxBoTOfQgxcDoq77fHiiHcgWuo1LoBUpvGxFF1H/y7s3Q== + +"@fortawesome/fontawesome-svg-core@^1.2.25": + version "1.2.25" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.25.tgz#24b03391d14f0c6171e8cad7057c687b74049790" + integrity sha512-MotKnn53JKqbkLQiwcZSBJVYtTgIKFbh7B8+kd05TSnfKYPFmjKKI59o2fpz5t0Hzl35vVGU6+N4twoOpZUrqA== + dependencies: + "@fortawesome/fontawesome-common-types" "^0.2.25" + +"@fortawesome/free-solid-svg-icons@^5.11.2": + version "5.11.2" + resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.11.2.tgz#2f2f1459743a27902b76655a0d0bc5ec4d945631" + integrity sha512-zBue4i0PAZJUXOmLBBvM7L0O7wmsDC8dFv9IhpW5QL4kT9xhhVUsYg/LX1+5KaukWq4/cbDcKT+RT1aRe543sg== + dependencies: + "@fortawesome/fontawesome-common-types" "^0.2.25" + +"@fortawesome/react-fontawesome@^0.1.6": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.6.tgz#b798b96401e25d07c30bbe1b9ec0e6d8a33760a5" + integrity sha512-DNqt2t4JQ0YQKi832XzByk1wlQzgugwwCCNQHsFyz1z/zA9dtypSvsvVwMIaWXMljalYzKAA2zHX13C1DIxKAw== + dependencies: + prop-types "^15.5.10" + +"@google-cloud/common@^2.1.1": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-2.2.3.tgz#fc29701b09d7bc9d26ea6b6be119c77485210dbf" + integrity sha512-lvw54mGKn8VqVIy2NzAk0l5fntBFX4UwQhHk6HaqkyCQ7WBl5oz4XhzKMtMilozF/3ObPcDogqwuyEWyZ6rnQQ== + dependencies: + "@google-cloud/projectify" "^1.0.0" + "@google-cloud/promisify" "^1.0.0" + arrify "^2.0.0" + duplexify "^3.6.0" + ent "^2.2.0" + extend "^3.0.2" + google-auth-library "^5.5.0" + retry-request "^4.0.0" + teeny-request "^5.2.1" + +"@google-cloud/paginator@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@google-cloud/paginator/-/paginator-2.0.1.tgz#89ca97933eecfdd7eaa07bd79ed01c9869c9531b" + integrity sha512-HZ6UTGY/gHGNriD7OCikYWL/Eu0sTEur2qqse2w6OVsz+57se3nTkqH14JIPxtf0vlEJ8IJN5w3BdZ22pjCB8g== + dependencies: + arrify "^2.0.0" + extend "^3.0.2" + +"@google-cloud/projectify@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@google-cloud/projectify/-/projectify-1.0.1.tgz#f654c2ea9de923294ec814ff07c42891abf2d143" + integrity sha512-xknDOmsMgOYHksKc1GPbwDLsdej8aRNIA17SlSZgQdyrcC0lx0OGo4VZgYfwoEU1YS8oUxF9Y+6EzDOb0eB7Xg== + +"@google-cloud/promisify@^1.0.0": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@google-cloud/promisify/-/promisify-1.0.2.tgz#e581aa79ff71fb6074acc1cc59e3d81bf84ce07b" + integrity sha512-7WfV4R/3YV5T30WRZW0lqmvZy9hE2/p9MvpI34WuKa2Wz62mLu5XplGTFEMK6uTbJCLWUxTcZ4J4IyClKucE5g== + +"@google-cloud/storage@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-4.0.0.tgz#ad7df44eb7a7ce469c26d86967c444a7484cf595" + integrity sha512-ZhMSvIrsyULJNGuhB3vK9VKxIh92W/sOjEezaxykKewB/NxK/d09cC1AfpwHFcnxN+ZZcy1fSLAIwfNAnKU+lA== + dependencies: + "@google-cloud/common" "^2.1.1" + "@google-cloud/paginator" "^2.0.0" + "@google-cloud/promisify" "^1.0.0" + arrify "^2.0.0" + compressible "^2.0.12" + concat-stream "^2.0.0" + date-and-time "^0.10.0" + duplexify "^3.5.0" + extend "^3.0.2" + gaxios "^2.0.1" + gcs-resumable-upload "^2.2.4" + hash-stream-validation "^0.2.2" + mime "^2.2.0" + mime-types "^2.0.8" + onetime "^5.1.0" + p-limit "^2.2.0" + pumpify "^2.0.0" + readable-stream "^3.4.0" + snakeize "^0.1.0" + stream-events "^1.0.1" + through2 "^3.0.0" + xdg-basedir "^4.0.0" + +"@hapi/address@2.x.x", "@hapi/address@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.2.tgz#1c794cd6dbf2354d1eb1ef10e0303f573e1c7222" + integrity sha512-O4QDrx+JoGKZc6aN64L04vqa7e41tIiLU+OvKdcYaEMP97UttL0f9GIi9/0A4WAMx0uBd6SidDIhktZhgOcN8Q== + +"@hapi/bourne@1.x.x": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@hapi/bourne/-/bourne-1.3.2.tgz#0a7095adea067243ce3283e1b56b8a8f453b242a" + integrity sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA== + +"@hapi/formula@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-1.2.0.tgz#994649c7fea1a90b91a0a1e6d983523f680e10cd" + integrity sha512-UFbtbGPjstz0eWHb+ga/GM3Z9EzqKXFWIbSOFURU0A/Gku0Bky4bCk9/h//K2Xr3IrCfjFNhMm4jyZ5dbCewGA== + +"@hapi/hoek@8.x.x", "@hapi/hoek@^8.2.4", "@hapi/hoek@^8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-8.3.0.tgz#2b9db1cd00f3891005c77b3a8d608b88a6d0aa4d" + integrity sha512-C0QL9bmgUXTSuf8nDeGrpMjtJG7tPUr8wG6/wxPbP62tGwCwQtdMSJYfESowmY4P3Hn593f+8OzNY5bckcu/LQ== + +"@hapi/joi@^15.0.0", "@hapi/joi@^15.0.3": + version "15.1.1" + resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-15.1.1.tgz#c675b8a71296f02833f8d6d243b34c57b8ce19d7" + integrity sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ== + dependencies: + "@hapi/address" "2.x.x" + "@hapi/bourne" "1.x.x" + "@hapi/hoek" "8.x.x" + "@hapi/topo" "3.x.x" + +"@hapi/joi@^16.1.7": + version "16.1.7" + resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-16.1.7.tgz#360857223a87bb1f5f67691537964c1b4908ed93" + integrity sha512-anaIgnZhNooG3LJLrTFzgGALTiO97zRA1UkvQHm9KxxoSiIzCozB3RCNCpDnfhTJD72QlrHA8nwGmNgpFFCIeg== + dependencies: + "@hapi/address" "^2.1.2" + "@hapi/formula" "^1.2.0" + "@hapi/hoek" "^8.2.4" + "@hapi/pinpoint" "^1.0.2" + "@hapi/topo" "^3.1.3" + +"@hapi/pinpoint@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-1.0.2.tgz#025b7a36dbbf4d35bf1acd071c26b20ef41e0d13" + integrity sha512-dtXC/WkZBfC5vxscazuiJ6iq4j9oNx1SHknmIr8hofarpKUZKmlUVYVIhNVzIEgK5Wrc4GMHL5lZtt1uS2flmQ== + +"@hapi/topo@3.x.x": + version "3.1.5" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-3.1.5.tgz#3baea17e456530edad69a75c3fc7cde97dd6d331" + integrity sha512-bi9m1jrui9LlvtVdLaHv0DqeOoe+I8dep+nEcTgW6XxJHL3xArQcilYz3tIp0cRC4gWlsVtABK7vNKg4jzEmAA== + dependencies: + "@hapi/hoek" "8.x.x" + +"@hapi/topo@^3.1.3": + version "3.1.6" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-3.1.6.tgz#68d935fa3eae7fdd5ab0d7f953f3205d8b2bfc29" + integrity sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ== + dependencies: + "@hapi/hoek" "^8.3.0" + +"@jest/console@^24.7.1", "@jest/console@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" + integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== + dependencies: + "@jest/source-map" "^24.9.0" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" + integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== + dependencies: + "@jest/console" "^24.7.1" + "@jest/reporters" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-changed-files "^24.9.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-resolve-dependencies "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + jest-watcher "^24.9.0" + micromatch "^3.1.10" + p-each-series "^1.0.0" + realpath-native "^1.1.0" + rimraf "^2.5.4" + slash "^2.0.0" + strip-ansi "^5.0.0" + +"@jest/environment@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" + integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== + dependencies: + "@jest/fake-timers" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + +"@jest/reporters@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" + integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + istanbul-lib-coverage "^2.0.2" + istanbul-lib-instrument "^3.0.1" + istanbul-lib-report "^2.0.4" + istanbul-lib-source-maps "^3.0.1" + istanbul-reports "^2.2.6" + jest-haste-map "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.6.0" + node-notifier "^5.4.2" + slash "^2.0.0" + source-map "^0.6.0" + string-length "^2.0.0" + +"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" + integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== + dependencies: + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/istanbul-lib-coverage" "^2.0.0" + +"@jest/test-sequencer@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" + integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== + dependencies: + "@jest/test-result" "^24.9.0" + jest-haste-map "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^24.9.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" + micromatch "^3.1.10" + pirates "^4.0.1" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^1.1.1" + "@types/yargs" "^13.0.0" + +"@mrmlnc/readdir-enhanced@^2.2.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" + integrity sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g== + dependencies: + call-me-maybe "^1.0.1" + glob-to-regexp "^0.3.0" + +"@nodelib/fs.stat@^1.1.2": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" + integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== + +"@svgr/babel-plugin-add-jsx-attribute@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.2.0.tgz#dadcb6218503532d6884b210e7f3c502caaa44b1" + integrity sha512-j7KnilGyZzYr/jhcrSYS3FGWMZVaqyCG0vzMCwzvei0coIkczuYMcniK07nI0aHJINciujjH11T72ICW5eL5Ig== + +"@svgr/babel-plugin-remove-jsx-attribute@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-remove-jsx-attribute/-/babel-plugin-remove-jsx-attribute-4.2.0.tgz#297550b9a8c0c7337bea12bdfc8a80bb66f85abc" + integrity sha512-3XHLtJ+HbRCH4n28S7y/yZoEQnRpl0tvTZQsHqvaeNXPra+6vE5tbRliH3ox1yZYPCxrlqaJT/Mg+75GpDKlvQ== + +"@svgr/babel-plugin-remove-jsx-empty-expression@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-remove-jsx-empty-expression/-/babel-plugin-remove-jsx-empty-expression-4.2.0.tgz#c196302f3e68eab6a05e98af9ca8570bc13131c7" + integrity sha512-yTr2iLdf6oEuUE9MsRdvt0NmdpMBAkgK8Bjhl6epb+eQWk6abBaX3d65UZ3E3FWaOwePyUgNyNCMVG61gGCQ7w== + +"@svgr/babel-plugin-replace-jsx-attribute-value@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-replace-jsx-attribute-value/-/babel-plugin-replace-jsx-attribute-value-4.2.0.tgz#310ec0775de808a6a2e4fd4268c245fd734c1165" + integrity sha512-U9m870Kqm0ko8beHawRXLGLvSi/ZMrl89gJ5BNcT452fAjtF2p4uRzXkdzvGJJJYBgx7BmqlDjBN/eCp5AAX2w== + +"@svgr/babel-plugin-svg-dynamic-title@^4.3.3": + version "4.3.3" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-svg-dynamic-title/-/babel-plugin-svg-dynamic-title-4.3.3.tgz#2cdedd747e5b1b29ed4c241e46256aac8110dd93" + integrity sha512-w3Be6xUNdwgParsvxkkeZb545VhXEwjGMwExMVBIdPQJeyMQHqm9Msnb2a1teHBqUYL66qtwfhNkbj1iarCG7w== + +"@svgr/babel-plugin-svg-em-dimensions@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-svg-em-dimensions/-/babel-plugin-svg-em-dimensions-4.2.0.tgz#9a94791c9a288108d20a9d2cc64cac820f141391" + integrity sha512-C0Uy+BHolCHGOZ8Dnr1zXy/KgpBOkEUYY9kI/HseHVPeMbluaX3CijJr7D4C5uR8zrc1T64nnq/k63ydQuGt4w== + +"@svgr/babel-plugin-transform-react-native-svg@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-transform-react-native-svg/-/babel-plugin-transform-react-native-svg-4.2.0.tgz#151487322843359a1ca86b21a3815fd21a88b717" + integrity sha512-7YvynOpZDpCOUoIVlaaOUU87J4Z6RdD6spYN4eUb5tfPoKGSF9OG2NuhgYnq4jSkAxcpMaXWPf1cePkzmqTPNw== + +"@svgr/babel-plugin-transform-svg-component@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-transform-svg-component/-/babel-plugin-transform-svg-component-4.2.0.tgz#5f1e2f886b2c85c67e76da42f0f6be1b1767b697" + integrity sha512-hYfYuZhQPCBVotABsXKSCfel2slf/yvJY8heTVX1PCTaq/IgASq1IyxPPKJ0chWREEKewIU/JMSsIGBtK1KKxw== + +"@svgr/babel-preset@^4.3.3": + version "4.3.3" + resolved "https://registry.yarnpkg.com/@svgr/babel-preset/-/babel-preset-4.3.3.tgz#a75d8c2f202ac0e5774e6bfc165d028b39a1316c" + integrity sha512-6PG80tdz4eAlYUN3g5GZiUjg2FMcp+Wn6rtnz5WJG9ITGEF1pmFdzq02597Hn0OmnQuCVaBYQE1OVFAnwOl+0A== + dependencies: + "@svgr/babel-plugin-add-jsx-attribute" "^4.2.0" + "@svgr/babel-plugin-remove-jsx-attribute" "^4.2.0" + "@svgr/babel-plugin-remove-jsx-empty-expression" "^4.2.0" + "@svgr/babel-plugin-replace-jsx-attribute-value" "^4.2.0" + "@svgr/babel-plugin-svg-dynamic-title" "^4.3.3" + "@svgr/babel-plugin-svg-em-dimensions" "^4.2.0" + "@svgr/babel-plugin-transform-react-native-svg" "^4.2.0" + "@svgr/babel-plugin-transform-svg-component" "^4.2.0" + +"@svgr/core@^4.3.2": + version "4.3.3" + resolved "https://registry.yarnpkg.com/@svgr/core/-/core-4.3.3.tgz#b37b89d5b757dc66e8c74156d00c368338d24293" + integrity sha512-qNuGF1QON1626UCaZamWt5yedpgOytvLj5BQZe2j1k1B8DUG4OyugZyfEwBeXozCUwhLEpsrgPrE+eCu4fY17w== + dependencies: + "@svgr/plugin-jsx" "^4.3.3" + camelcase "^5.3.1" + cosmiconfig "^5.2.1" + +"@svgr/hast-util-to-babel-ast@^4.3.2": + version "4.3.2" + resolved "https://registry.yarnpkg.com/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-4.3.2.tgz#1d5a082f7b929ef8f1f578950238f630e14532b8" + integrity sha512-JioXclZGhFIDL3ddn4Kiq8qEqYM2PyDKV0aYno8+IXTLuYt6TOgHUbUAAFvqtb0Xn37NwP0BTHglejFoYr8RZg== + dependencies: + "@babel/types" "^7.4.4" + +"@svgr/plugin-jsx@^4.3.2", "@svgr/plugin-jsx@^4.3.3": + version "4.3.3" + resolved "https://registry.yarnpkg.com/@svgr/plugin-jsx/-/plugin-jsx-4.3.3.tgz#e2ba913dbdfbe85252a34db101abc7ebd50992fa" + integrity sha512-cLOCSpNWQnDB1/v+SUENHH7a0XY09bfuMKdq9+gYvtuwzC2rU4I0wKGFEp1i24holdQdwodCtDQdFtJiTCWc+w== + dependencies: + "@babel/core" "^7.4.5" + "@svgr/babel-preset" "^4.3.3" + "@svgr/hast-util-to-babel-ast" "^4.3.2" + svg-parser "^2.0.0" + +"@svgr/plugin-svgo@^4.3.1": + version "4.3.1" + resolved "https://registry.yarnpkg.com/@svgr/plugin-svgo/-/plugin-svgo-4.3.1.tgz#daac0a3d872e3f55935c6588dd370336865e9e32" + integrity sha512-PrMtEDUWjX3Ea65JsVCwTIXuSqa3CG9px+DluF1/eo9mlDrgrtFE7NE/DjdhjJgSM9wenlVBzkzneSIUgfUI/w== + dependencies: + cosmiconfig "^5.2.1" + merge-deep "^3.0.2" + svgo "^1.2.2" + +"@svgr/webpack@4.3.2": + version "4.3.2" + resolved "https://registry.yarnpkg.com/@svgr/webpack/-/webpack-4.3.2.tgz#319d4471c8f3d5c3af35059274834d9b5b8fb956" + integrity sha512-F3VE5OvyOWBEd2bF7BdtFRyI6E9it3mN7teDw0JQTlVtc4HZEYiiLSl+Uf9Uub6IYHVGc+qIrxxDyeedkQru2w== + dependencies: + "@babel/core" "^7.4.5" + "@babel/plugin-transform-react-constant-elements" "^7.0.0" + "@babel/preset-env" "^7.4.5" + "@babel/preset-react" "^7.0.0" + "@svgr/core" "^4.3.2" + "@svgr/plugin-jsx" "^4.3.2" + "@svgr/plugin-svgo" "^4.3.1" + loader-utils "^1.2.3" + +"@taquito/http-utils@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/http-utils/-/http-utils-5.1.0-beta.1.tgz#283b89eeae13c78c54657bccef15f1b3242326a0" + integrity sha512-/UvE61t9j5CR94vy8Dtb+/6oJERE0P9LmHBbkESKUxNC9SAlETCEntSNiHha+vuwgCoOj0pXsHkBtAZkWAaEeg== + dependencies: + xhr2-cookies "^1.1.0" + +"@taquito/indexer@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/indexer/-/indexer-5.1.0-beta.1.tgz#62595d2b4758ad541dc54906896131ddf8ee9c59" + integrity sha512-NDWK7XQGgUP0YkEWhJklF9uhKHZDWtRaAPSsSfxSDYiQzol4iAUn7ru7+TQPNqfsXq0NjpvzGHBysQ8HTeb0Gg== + dependencies: + "@taquito/http-utils" "^5.1.0-beta.1" + bignumber.js "^9.0.0" + +"@taquito/michelson-encoder@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/michelson-encoder/-/michelson-encoder-5.1.0-beta.1.tgz#38620820d377f908ea6fc6d4136fa08247702656" + integrity sha512-kBpHDfsvsxzsIXbM4dOZs0nklY7CjCunSJ2sABUdBu4SmXDM06F5NDzg0166q7VBhFZgOhq/NNM9g7hcgn5qJg== + dependencies: + "@taquito/utils" "^5.1.0-beta.1" + bignumber.js "^9.0.0" + +"@taquito/rpc@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/rpc/-/rpc-5.1.0-beta.1.tgz#6e6aa3ca57a9e5d5811f7bb16ce3a1e9fd8a87e3" + integrity sha512-ZbqpJVZw1ljAS92Xs9t/1BAgPEMzOv3qk7ubWU7AGZOKDLREjOqI4EAZQfq4gL9hP2KIgqgLubTvPF3GsmTADg== + dependencies: + "@taquito/http-utils" "^5.1.0-beta.1" + bignumber.js "^9.0.0" + lodash "^4.17.15" + +"@taquito/signer@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/signer/-/signer-5.1.0-beta.1.tgz#b5aadd782df0cc7330501c01f5d4ffd5c537ebd7" + integrity sha512-N7ZteHnXv2kS+CCxbmQ+Br21aIf8cwP/WGAjwOh0uMUcXg2qsmKE/0XnRYnLhftVaJolNo85oBckYnA6U48uCg== + dependencies: + "@taquito/utils" "^5.1.0-beta.1" + bignumber.js "^9.0.0" + bip39 "^3.0.2" + elliptic "^6.5.1" + libsodium-wrappers "^0.7.5" + pbkdf2 "^3.0.17" + typedarray-to-buffer "^3.1.5" + +"@taquito/taquito@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/taquito/-/taquito-5.1.0-beta.1.tgz#32ab600a3a08214463e961085205e25c87fea122" + integrity sha512-hLV7vZiraMlx+Not3dRdELNSwxd0ZLndRGGDBh+uexpo1aH7xX5IQbIgQBREaR1F7fqHswxBBCKcBbrGhP5EWQ== + dependencies: + "@taquito/indexer" "^5.1.0-beta.1" + "@taquito/michelson-encoder" "^5.1.0-beta.1" + "@taquito/rpc" "^5.1.0-beta.1" + "@taquito/signer" "^5.1.0-beta.1" + "@taquito/utils" "^5.1.0-beta.1" + bignumber.js "^9.0.0" + rxjs "^6.5.3" + +"@taquito/tezbridge-signer@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/tezbridge-signer/-/tezbridge-signer-5.1.0-beta.1.tgz#8e88cc3c47a802dade294336d9afa53f8d53bc21" + integrity sha512-Q/bjRjMgYjIcrdW4h2JUAajYuck0wxxb27k7ElINVEtV3qdP3g+0Ubls1YXPMnb5MG4NlDJ4H3xGWiy1dnfrdQ== + dependencies: + "@taquito/utils" "^5.1.0-beta.1" + typedarray-to-buffer "^3.1.5" + +"@taquito/utils@^5.1.0-beta.1": + version "5.1.0-beta.1" + resolved "https://registry.yarnpkg.com/@taquito/utils/-/utils-5.1.0-beta.1.tgz#6ab4f344abd0e3e7d40828182f461cccb9b94b24" + integrity sha512-3Qk+RLYKNYUW3jj1HYH0KymQQjWXdMcsp08eG+Cc0LKDvwzC5ewd4tfeUwq/jfHsd1fQ9LsG5FJ3NZg93W0H6w== + dependencies: + blakejs "^1.1.0" + bs58check "^2.1.2" + buffer "^5.2.1" + +"@ts-tools/node@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@ts-tools/node/-/node-1.0.0.tgz#60d808e3f132a7f47b45658b71e7e2ba1fbe1735" + integrity sha512-KiVn0EweB00oztLhPOto2xyqeUtb+7FdGWsRvyVcTPh9J0+Xz31834OqBkQBXNLLHpLiva5CCKzJzbCSAoW+1w== + dependencies: + "@ts-tools/transpile" "^1.0.0" + source-map-support "^0.5.13" + +"@ts-tools/transpile@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@ts-tools/transpile/-/transpile-1.0.0.tgz#5c474e0a506b584e0f91bedfaf2b5df8670e73be" + integrity sha512-CQ20ZArMdERjIy8JQX+Lt3Lo2CTxya/JiASQLLIXu9HhVxfQPyU/YM9F8tUrCU0aacO2d4ngTRct2OqEjY7DLw== + +"@types/babel__core@^7.1.0": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" + integrity sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.0.tgz#f1ec1c104d1bb463556ecb724018ab788d0c172a" + integrity sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.0.7" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.7.tgz#2496e9ff56196cc1429c72034e07eab6121b6f3f" + integrity sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw== + dependencies: + "@babel/types" "^7.3.0" + +"@types/body-parser@*": + version "1.17.1" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.17.1.tgz#18fcf61768fb5c30ccc508c21d6fd2e8b3bf7897" + integrity sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.32" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.32.tgz#aa0e9616b9435ccad02bc52b5b454ffc2c70ba28" + integrity sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg== + dependencies: + "@types/node" "*" + +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + +"@types/events@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" + integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== + +"@types/express-serve-static-core@*": + version "4.16.9" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.16.9.tgz#69e00643b0819b024bdede95ced3ff239bb54558" + integrity sha512-GqpaVWR0DM8FnRUJYKlWgyARoBUAVfRIeVDZQKOttLFp5SmhhF9YFIYeTPwMd/AXfxlP7xVO2dj1fGu0Q+krKQ== + dependencies: + "@types/node" "*" + "@types/range-parser" "*" + +"@types/express-winston@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/express-winston/-/express-winston-3.0.4.tgz#0818399a094374f16c39bcba24ebcea3891791c6" + integrity sha512-fCvI4nTs/oYhq7jACnPurepOPMKz//bNuCwMIRCcESix9jEuky93H5KwkyKeEPGNZfQzR3zCUbeGWs6/jvV7Fg== + dependencies: + "@types/express" "*" + "@types/logform" "*" + winston "^3.0.0" + +"@types/express@*", "@types/express@^4.17.1": + version "4.17.1" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.1.tgz#4cf7849ae3b47125a567dfee18bfca4254b88c5c" + integrity sha512-VfH/XCP0QbQk5B5puLqTLEeFgR8lfCJHZJKkInZ9mkYd+u8byX0kztXEQxEk4wZXJs8HI+7km2ALXjn4YKcX9w== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "*" + "@types/serve-static" "*" + +"@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" + +"@types/hapi__joi@^16.0.1": + version "16.0.1" + resolved "https://registry.yarnpkg.com/@types/hapi__joi/-/hapi__joi-16.0.1.tgz#ec227341ec7ce2091066cccebc3b14f6c527ba6b" + integrity sha512-U4I9Pfk4qH6TCXlg55qOc3F730QndZi86hGWlZHPHY7b3J+MCDIAO6EejbkaLWk7U15v+jn2J3GRVKD4ruhS2Q== + +"@types/hoist-non-react-statics@^3.3.0": + version "3.3.1" + resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" + integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA== + dependencies: + "@types/react" "*" + hoist-non-react-statics "^3.3.0" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" + integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== + +"@types/istanbul-lib-report@*": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c" + integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a" + integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA== + dependencies: + "@types/istanbul-lib-coverage" "*" + "@types/istanbul-lib-report" "*" + +"@types/jest-diff@*": + version "20.0.1" + resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" + integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== + +"@types/jest@24.0.18": + version "24.0.18" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498" + integrity sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ== + dependencies: + "@types/jest-diff" "*" + +"@types/jest@^24.0.23": + version "24.0.23" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.23.tgz#046f8e2ade026fe831623e361a36b6fb9a4463e4" + integrity sha512-L7MBvwfNpe7yVPTXLn32df/EK+AMBFAFvZrRuArGs7npEWnlziUXK+5GMIUTI4NIuwok3XibsjXCs5HxviYXjg== + dependencies: + jest-diff "^24.3.0" + +"@types/joi@^14.3.3": + version "14.3.3" + resolved "https://registry.yarnpkg.com/@types/joi/-/joi-14.3.3.tgz#f251aa8150fc0b6a7ce9feab21802a28473de335" + integrity sha512-6gAT/UkIzYb7zZulAbcof3lFxpiD5EI6xBeTvkL1wYN12pnFQ+y/+xl9BvnVgxkmaIDN89xWhGZLD9CvuOtZ9g== + +"@types/json-schema@^7.0.3": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" + integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A== + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + +"@types/logform@*": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/logform/-/logform-1.2.0.tgz#4ead916c7eb1ee99d726bfa849b6a2ee5ea50e3e" + integrity sha512-E8cLzW+PmqHI//4HLR+ZvE3cyzqVjsncYBx1O14P07oVJj3ezhmiL/azlgkXKLFyCWAeKsPQdjHNg/NEhBF5Ow== + +"@types/mime@*": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d" + integrity sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw== + +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + +"@types/node-fetch@^2.5.4": + version "2.5.4" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.4.tgz#5245b6d8841fc3a6208b82291119bc11c4e0ce44" + integrity sha512-Oz6id++2qAOFuOlE1j0ouk1dzl3mmI1+qINPNBhi9nt/gVOz0G+13Ao6qjhdF0Ys+eOkhu6JnFmt38bR3H0POQ== + dependencies: + "@types/node" "*" + +"@types/node@*", "@types/node@12.7.12": + version "12.7.12" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.12.tgz#7c6c571cc2f3f3ac4a59a5f2bd48f5bdbc8653cc" + integrity sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ== + +"@types/node@10": + version "10.14.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.21.tgz#4a9db7ef1d1671c0015e632c5fa3d46c86c58c1e" + integrity sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ== + +"@types/node@11.11.6": + version "11.11.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" + integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== + +"@types/prop-types@*": + version "15.7.3" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" + integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw== + +"@types/q@^1.5.1": + version "1.5.2" + resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8" + integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw== + +"@types/range-parser@*": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c" + integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== + +"@types/react-dom@16.9.1": + version "16.9.1" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.1.tgz#79206237cba9532a9f870b1cd5428bef6b66378c" + integrity sha512-1S/akvkKr63qIUWVu5IKYou2P9fHLb/P2VAwyxVV85JGaGZTcUniMiTuIqM3lXFB25ej6h+CYEQ27ERVwi6eGA== + dependencies: + "@types/react" "*" + +"@types/react-native@*": + version "0.60.19" + resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.60.19.tgz#4d58516f9e981c3f477ad48727331e31a0792aae" + integrity sha512-1Qq1EQn/bi7dnsdrZJu0f9MK18KZrEmLGMfw3V9Im5As4uwFUTCIkD4LnFJkfQtRvtJQN1cOQri6MTqT7d9fkg== + dependencies: + "@types/prop-types" "*" + "@types/react" "*" + +"@types/react-outside-click-handler@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/react-outside-click-handler/-/react-outside-click-handler-1.2.0.tgz#a7c5d7b39affb7a80c45029931efa031f1130820" + integrity sha512-yejuPUAzmlMmFuPGPYY1nxKj9NI7nn8qaCsyK1hte+Qy488+1d49+tVXDOP/N4mHFN+UjNt8HXQpIyVpRDI/YQ== + dependencies: + "@types/react" "*" + +"@types/react-redux@^7.1.4": + version "7.1.4" + resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.4.tgz#e0d02a073e730b8b58a6341bddca2ea692ff0bce" + integrity sha512-SUV/7d+4L7C1Db/D4pqASgN1V1U2HnDEhEol9lYpPSguS76xFboZzf5ha2hTz6v31cUewyC7WksMh1q8JxhebQ== + dependencies: + "@types/hoist-non-react-statics" "^3.3.0" + "@types/react" "*" + hoist-non-react-statics "^3.3.0" + redux "^4.0.0" + +"@types/react@*", "@types/react@16.9.5": + version "16.9.5" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.5.tgz#079dabd918b19b32118c25fd00a786bb6d0d5e51" + integrity sha512-jQ12VMiFOWYlp+j66dghOWcmDDwhca0bnlcTxS4Qz/fh5gi6wpaZDthPEu/Gc/YlAuO87vbiUXL8qKstFvuOaA== + dependencies: + "@types/prop-types" "*" + csstype "^2.2.0" + +"@types/serve-static@*": + version "1.13.3" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.3.tgz#eb7e1c41c4468272557e897e9171ded5e2ded9d1" + integrity sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g== + dependencies: + "@types/express-serve-static-core" "*" + "@types/mime" "*" + +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/styled-components@^4.1.19": + version "4.1.19" + resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-4.1.19.tgz#535b455d7744fda1608c605df82c0800eda61a09" + integrity sha512-nDkoTQ8ItcJiyEvTa24TwsIpIfNKCG+Lq0LvAwApOcjQ8OaeOOCg66YSPHBePHUh6RPt1LA8aEzRlgWhQPFqPg== + dependencies: + "@types/react" "*" + "@types/react-native" "*" + csstype "^2.2.0" + +"@types/tmp@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.1.0.tgz#19cf73a7bcf641965485119726397a096f0049bd" + integrity sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA== + +"@types/winston@^2.4.4": + version "2.4.4" + resolved "https://registry.yarnpkg.com/@types/winston/-/winston-2.4.4.tgz#48cc744b7b42fad74b9a2e8490e0112bd9a3d08d" + integrity sha512-BVGCztsypW8EYwJ+Hq+QNYiT/MUyCif0ouBH+flrY66O5W+KIXAMML6E/0fJpm7VjIzgangahl5S03bJJQGrZw== + dependencies: + winston "*" + +"@types/yargs-parser@*": + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" + integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== + +"@types/yargs@^13.0.0": + version "13.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" + integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/eslint-plugin@^2.2.0": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.3.3.tgz#71e06c6887650301e02105c99b4c8f67454157e3" + integrity sha512-12cCbwu5PbQudkq2xCIS/QhB7hCMrsNPXK+vJtqy/zFqtzVkPRGy12O5Yy0gUK086f3VHV/P4a4R4CjMW853pA== + dependencies: + "@typescript-eslint/experimental-utils" "2.3.3" + eslint-utils "^1.4.2" + functional-red-black-tree "^1.0.1" + regexpp "^2.0.1" + tsutils "^3.17.1" + +"@typescript-eslint/experimental-utils@2.3.3": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.3.3.tgz#0685613063ff397cfa9209be2e6e81c0382a9b11" + integrity sha512-MQ4jKPMTU1ty4TigJCRKFPye2qyQdH8jzIIkceaHgecKFmkNS1hXPqKiZ+mOehkz6+HcN5Nuvwm+frmWZR9tdg== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.3.3" + eslint-scope "^5.0.0" + +"@typescript-eslint/parser@^2.2.0": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.3.3.tgz#af519d6572bdee3e9610e21c8362766858976bc1" + integrity sha512-+cV53HuYFeeyrNW8x/rgPmbVrzzp/rpRmwbJnNtwn4K8mroL1BdjxwQh7X9cUHp9rm4BBiEWmD3cSBjKG7d5mw== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.3.3" + "@typescript-eslint/typescript-estree" "2.3.3" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@2.3.3": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.3.3.tgz#be802220876bedfb80384cde1d46fe57ae7abf71" + integrity sha512-GkACs12Xp8d/STunNv/iSMYJFQrkrax9vuPZySlgSzoJJtw1cp6tbEw4qsLskQv6vloLrkFJHcTJ0a/yCB5cIA== + dependencies: + glob "^7.1.4" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + +"@webassemblyjs/ast@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" + integrity sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ== + dependencies: + "@webassemblyjs/helper-module-context" "1.8.5" + "@webassemblyjs/helper-wasm-bytecode" "1.8.5" + "@webassemblyjs/wast-parser" "1.8.5" + +"@webassemblyjs/floating-point-hex-parser@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz#1ba926a2923613edce496fd5b02e8ce8a5f49721" + integrity sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ== + +"@webassemblyjs/helper-api-error@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz#c49dad22f645227c5edb610bdb9697f1aab721f7" + integrity sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA== + +"@webassemblyjs/helper-buffer@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz#fea93e429863dd5e4338555f42292385a653f204" + integrity sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q== + +"@webassemblyjs/helper-code-frame@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz#9a740ff48e3faa3022b1dff54423df9aa293c25e" + integrity sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ== + dependencies: + "@webassemblyjs/wast-printer" "1.8.5" + +"@webassemblyjs/helper-fsm@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz#ba0b7d3b3f7e4733da6059c9332275d860702452" + integrity sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow== + +"@webassemblyjs/helper-module-context@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz#def4b9927b0101dc8cbbd8d1edb5b7b9c82eb245" + integrity sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g== + dependencies: + "@webassemblyjs/ast" "1.8.5" + mamacro "^0.0.3" + +"@webassemblyjs/helper-wasm-bytecode@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz#537a750eddf5c1e932f3744206551c91c1b93e61" + integrity sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ== + +"@webassemblyjs/helper-wasm-section@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz#74ca6a6bcbe19e50a3b6b462847e69503e6bfcbf" + integrity sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/helper-buffer" "1.8.5" + "@webassemblyjs/helper-wasm-bytecode" "1.8.5" + "@webassemblyjs/wasm-gen" "1.8.5" + +"@webassemblyjs/ieee754@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz#712329dbef240f36bf57bd2f7b8fb9bf4154421e" + integrity sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g== + dependencies: + "@xtuc/ieee754" "^1.2.0" + +"@webassemblyjs/leb128@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.8.5.tgz#044edeb34ea679f3e04cd4fd9824d5e35767ae10" + integrity sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A== + dependencies: + "@xtuc/long" "4.2.2" + +"@webassemblyjs/utf8@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.8.5.tgz#a8bf3b5d8ffe986c7c1e373ccbdc2a0915f0cedc" + integrity sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw== + +"@webassemblyjs/wasm-edit@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz#962da12aa5acc1c131c81c4232991c82ce56e01a" + integrity sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/helper-buffer" "1.8.5" + "@webassemblyjs/helper-wasm-bytecode" "1.8.5" + "@webassemblyjs/helper-wasm-section" "1.8.5" + "@webassemblyjs/wasm-gen" "1.8.5" + "@webassemblyjs/wasm-opt" "1.8.5" + "@webassemblyjs/wasm-parser" "1.8.5" + "@webassemblyjs/wast-printer" "1.8.5" + +"@webassemblyjs/wasm-gen@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz#54840766c2c1002eb64ed1abe720aded714f98bc" + integrity sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/helper-wasm-bytecode" "1.8.5" + "@webassemblyjs/ieee754" "1.8.5" + "@webassemblyjs/leb128" "1.8.5" + "@webassemblyjs/utf8" "1.8.5" + +"@webassemblyjs/wasm-opt@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz#b24d9f6ba50394af1349f510afa8ffcb8a63d264" + integrity sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/helper-buffer" "1.8.5" + "@webassemblyjs/wasm-gen" "1.8.5" + "@webassemblyjs/wasm-parser" "1.8.5" + +"@webassemblyjs/wasm-parser@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz#21576f0ec88b91427357b8536383668ef7c66b8d" + integrity sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/helper-api-error" "1.8.5" + "@webassemblyjs/helper-wasm-bytecode" "1.8.5" + "@webassemblyjs/ieee754" "1.8.5" + "@webassemblyjs/leb128" "1.8.5" + "@webassemblyjs/utf8" "1.8.5" + +"@webassemblyjs/wast-parser@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz#e10eecd542d0e7bd394f6827c49f3df6d4eefb8c" + integrity sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/floating-point-hex-parser" "1.8.5" + "@webassemblyjs/helper-api-error" "1.8.5" + "@webassemblyjs/helper-code-frame" "1.8.5" + "@webassemblyjs/helper-fsm" "1.8.5" + "@xtuc/long" "4.2.2" + +"@webassemblyjs/wast-printer@1.8.5": + version "1.8.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz#114bbc481fd10ca0e23b3560fa812748b0bae5bc" + integrity sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/wast-parser" "1.8.5" + "@xtuc/long" "4.2.2" + +"@xtuc/ieee754@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" + integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== + +"@xtuc/long@4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" + integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== + +abab@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.2.tgz#a2fba1b122c69a85caa02d10f9270c7219709a9d" + integrity sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg== + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + +accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: + version "1.3.7" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" + integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== + dependencies: + mime-types "~2.1.24" + negotiator "0.6.2" + +acorn-globals@^4.1.0, acorn-globals@^4.3.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" + integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== + dependencies: + acorn "^6.0.1" + acorn-walk "^6.0.1" + +acorn-jsx@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f" + integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw== + +acorn-walk@^6.0.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" + integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== + +acorn@^5.5.3: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== + +acorn@^6.0.1, acorn@^6.0.4, acorn@^6.2.1: + version "6.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" + integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== + +acorn@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" + integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== + +address@1.1.2, address@^1.0.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/address/-/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6" + integrity sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA== + +adjust-sourcemap-loader@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/adjust-sourcemap-loader/-/adjust-sourcemap-loader-2.0.0.tgz#6471143af75ec02334b219f54bc7970c52fb29a4" + integrity sha512-4hFsTsn58+YjrU9qKzML2JSSDqKvN8mUGQ0nNIrfPi8hmIONT4L3uUaT6MKdMsZ9AjsU6D2xDkZxCkbQPxChrA== + dependencies: + assert "1.4.1" + camelcase "5.0.0" + loader-utils "1.2.3" + object-path "0.11.4" + regex-parser "2.2.10" + +agent-base@4, agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + +airbnb-prop-types@^2.15.0: + version "2.15.0" + resolved "https://registry.yarnpkg.com/airbnb-prop-types/-/airbnb-prop-types-2.15.0.tgz#5287820043af1eb469f5b0af0d6f70da6c52aaef" + integrity sha512-jUh2/hfKsRjNFC4XONQrxo/n/3GG4Tn6Hl0WlFQN5PY9OMC9loSCoAYKnZsWaP8wEfd5xcrPloK0Zg6iS1xwVA== + dependencies: + array.prototype.find "^2.1.0" + function.prototype.name "^1.1.1" + has "^1.0.3" + is-regex "^1.0.4" + object-is "^1.0.1" + object.assign "^4.1.0" + object.entries "^1.1.0" + prop-types "^15.7.2" + prop-types-exact "^1.2.0" + react-is "^16.9.0" + +ajv-errors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" + integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== + +ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" + integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== + +ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +alphanum-sort@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" + integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM= + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= + +ansi-align@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" + integrity sha1-w2rsy6VjuJzrVW82kPCx2eNUf38= + dependencies: + string-width "^2.0.0" + +ansi-colors@^3.0.0: + version "3.2.4" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" + integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== + +ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + +ansi-escapes@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.2.1.tgz#4dccdb846c3eee10f6d64dea66273eab90c37228" + integrity sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q== + dependencies: + type-fest "^0.5.2" + +ansi-html@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" + integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4= + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.0.0, ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + +aproba@^1.0.3, aproba@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +arg@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.1.tgz#485f8e7c390ce4c5f78257dbea80d4be11feda4c" + integrity sha512-SlmP3fEA88MBv0PypnXZ8ZfJhwmDeIE3SP71j37AiXQBXYosPV0x6uISAaHYSlSVhmHOVkomen0tbGk6Anlebw== + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +aria-query@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" + integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w= + dependencies: + ast-types-flow "0.0.7" + commander "^2.11.0" + +arity-n@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/arity-n/-/arity-n-1.0.4.tgz#d9e76b11733e08569c0847ae7b39b2860b30b745" + integrity sha1-2edrEXM+CFacCEeuezmyhgswt0U= + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= + +array-find-index@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= + +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= + +array-flatten@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099" + integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== + +array-includes@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d" + integrity sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.7.0" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1, array-uniq@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +array.prototype.find@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.1.0.tgz#630f2eaf70a39e608ac3573e45cf8ccd0ede9ad7" + integrity sha512-Wn41+K1yuO5p7wRZDl7890c3xvv5UBrfVXTVIe28rSQb6LS0fZMDrQB6PAcxQFRFy6vJTLDc3A2+3CjQdzVKRg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.13.0" + +arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= + +arrify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + +asap@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= + +asn1.js@^4.0.0: + version "4.10.1" + resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" + integrity sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== + dependencies: + bn.js "^4.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +assert@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" + integrity sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE= + dependencies: + util "0.10.3" + +assert@^1.1.1: + version "1.5.0" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" + integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== + dependencies: + object-assign "^4.1.1" + util "0.10.3" + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +ast-types-flow@0.0.7, ast-types-flow@^0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" + integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +async-each@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" + integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== + +async-foreach@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" + integrity sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI= + +async-limiter@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + +async@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= + +async@^2.6.1: + version "2.6.3" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" + integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== + dependencies: + lodash "^4.17.14" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +autoprefixer@^9.6.1: + version "9.6.4" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.4.tgz#e6453be47af316b2923eaeaed87860f52ad4b7eb" + integrity sha512-Koz2cJU9dKOxG8P1f8uVaBntOv9lP4yz9ffWvWaicv9gHBPhpQB22nGijwd8gqW9CNT+UdkbQOQNLVI8jN1ZfQ== + dependencies: + browserslist "^4.7.0" + caniuse-lite "^1.0.30000998" + chalk "^2.4.2" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^7.0.18" + postcss-value-parser "^4.0.2" + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + +axios@^0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8" + integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ== + dependencies: + follow-redirects "1.5.10" + is-buffer "^2.0.2" + +axobject-query@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9" + integrity sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww== + dependencies: + ast-types-flow "0.0.7" + +babel-code-frame@^6.22.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-eslint@10.0.3: + version "10.0.3" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a" + integrity sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + eslint-visitor-keys "^1.0.0" + resolve "^1.12.0" + +babel-extract-comments@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz#0a2aedf81417ed391b85e18b4614e693a0351a21" + integrity sha512-qWWzi4TlddohA91bFwgt6zO/J0X+io7Qp184Fw0m2JYRSTZnJbFR8+07KmzudHCZgOiKRCrjhylwv9Xd8gfhVQ== + dependencies: + babylon "^6.18.0" + +babel-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" + integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== + dependencies: + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/babel__core" "^7.1.0" + babel-plugin-istanbul "^5.1.0" + babel-preset-jest "^24.9.0" + chalk "^2.4.2" + slash "^2.0.0" + +babel-loader@8.0.6: + version "8.0.6" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb" + integrity sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw== + dependencies: + find-cache-dir "^2.0.0" + loader-utils "^1.0.2" + mkdirp "^0.5.1" + pify "^4.0.1" + +babel-plugin-dynamic-import-node@2.3.0, babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== + dependencies: + object.assign "^4.1.0" + +babel-plugin-istanbul@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" + integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + find-up "^3.0.0" + istanbul-lib-instrument "^3.3.0" + test-exclude "^5.2.3" + +babel-plugin-jest-hoist@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" + integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== + dependencies: + "@types/babel__traverse" "^7.0.6" + +babel-plugin-macros@2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.6.1.tgz#41f7ead616fc36f6a93180e89697f69f51671181" + integrity sha512-6W2nwiXme6j1n2erPOnmRiWfObUhWH7Qw1LMi9XZy8cj+KtESu3T6asZvtk5bMQQjX8te35o7CFueiSdL/2NmQ== + dependencies: + "@babel/runtime" "^7.4.2" + cosmiconfig "^5.2.0" + resolve "^1.10.0" + +babel-plugin-named-asset-import@^0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.4.tgz#4a8fc30e9a3e2b1f5ed36883386ab2d84e1089bd" + integrity sha512-S6d+tEzc5Af1tKIMbsf2QirCcPdQ+mKUCY2H1nJj1DyA1ShwpsoxEOAwbWsG5gcXNV/olpvQd9vrUWRx4bnhpw== + +"babel-plugin-styled-components@>= 1": + version "1.10.6" + resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.6.tgz#f8782953751115faf09a9f92431436912c34006b" + integrity sha512-gyQj/Zf1kQti66100PhrCRjI5ldjaze9O0M3emXRPAN80Zsf8+e1thpTpaXJXVHXtaM4/+dJEgZHyS9Its+8SA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-module-imports" "^7.0.0" + babel-plugin-syntax-jsx "^6.18.0" + lodash "^4.17.11" + +babel-plugin-syntax-jsx@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" + integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY= + +babel-plugin-syntax-object-rest-spread@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" + integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U= + +babel-plugin-transform-object-rest-spread@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06" + integrity sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY= + dependencies: + babel-plugin-syntax-object-rest-spread "^6.8.0" + babel-runtime "^6.26.0" + +babel-plugin-transform-react-remove-prop-types@0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz#f2edaf9b4c6a5fbe5c1d678bfb531078c1555f3a" + integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA== + +babel-preset-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" + integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== + dependencies: + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + babel-plugin-jest-hoist "^24.9.0" + +babel-preset-react-app@^9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/babel-preset-react-app/-/babel-preset-react-app-9.0.2.tgz#247d37e883d6d6f4b4691e5f23711bb2dd80567d" + integrity sha512-aXD+CTH8Chn8sNJr4tO/trWKqe5sSE4hdO76j9fhVezJSzmpWYWUSc5JoPmdSxADwef5kQFNGKXd433vvkd2VQ== + dependencies: + "@babel/core" "7.6.0" + "@babel/plugin-proposal-class-properties" "7.5.5" + "@babel/plugin-proposal-decorators" "7.6.0" + "@babel/plugin-proposal-object-rest-spread" "7.5.5" + "@babel/plugin-syntax-dynamic-import" "7.2.0" + "@babel/plugin-transform-destructuring" "7.6.0" + "@babel/plugin-transform-flow-strip-types" "7.4.4" + "@babel/plugin-transform-react-display-name" "7.2.0" + "@babel/plugin-transform-runtime" "7.6.0" + "@babel/preset-env" "7.6.0" + "@babel/preset-react" "7.0.0" + "@babel/preset-typescript" "7.6.0" + "@babel/runtime" "7.6.0" + babel-plugin-dynamic-import-node "2.3.0" + babel-plugin-macros "2.6.1" + babel-plugin-transform-react-remove-prop-types "0.4.24" + +babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base-x@^3.0.2: + version "3.0.7" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.7.tgz#1c5a7fafe8f66b4114063e8da102799d4e7c408f" + integrity sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.0.2, base64-js@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" + integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +batch@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" + integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +big.js@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" + integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== + +bignumber.js@^7.0.0: + version "7.2.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f" + integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ== + +bignumber.js@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075" + integrity sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A== + +binary-extensions@^1.0.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== + +bip39@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.0.2.tgz#2baf42ff3071fc9ddd5103de92e8f80d9257ee32" + integrity sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ== + dependencies: + "@types/node" "11.11.6" + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + randombytes "^2.0.1" + +blakejs@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.0.tgz#69df92ef953aa88ca51a32df6ab1c54a155fc7a5" + integrity sha1-ad+S75U6qIylGjLfarHFShVfx6U= + +block-stream@*: + version "0.0.9" + resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + integrity sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= + dependencies: + inherits "~2.0.0" + +bluebird@^3.5.5: + version "3.7.0" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.0.tgz#56a6a886e03f6ae577cffedeb524f8f2450293cf" + integrity sha512-aBQ1FxIa7kSWCcmKHlcHFlT2jt6J/l4FzC7KcPELkOJOsPOb/bccdhmIrKDfXhwFrmc7vDoDrrepFvGqjyXGJg== + +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: + version "4.11.8" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" + integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + +body-parser@1.19.0, body-parser@^1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" + integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== + dependencies: + bytes "3.1.0" + content-type "~1.0.4" + debug "2.6.9" + depd "~1.1.2" + http-errors "1.7.2" + iconv-lite "0.4.24" + on-finished "~2.3.0" + qs "6.7.0" + raw-body "2.4.0" + type-is "~1.6.17" + +bonjour@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/bonjour/-/bonjour-3.5.0.tgz#8e890a183d8ee9a2393b3844c691a42bcf7bc9f5" + integrity sha1-jokKGD2O6aI5OzhExpGkK897yfU= + dependencies: + array-flatten "^2.1.0" + deep-equal "^1.0.1" + dns-equal "^1.0.0" + dns-txt "^2.0.2" + multicast-dns "^6.0.1" + multicast-dns-service-types "^1.1.0" + +boolbase@^1.0.0, boolbase@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" + integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= + +boxen@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" + integrity sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw== + dependencies: + ansi-align "^2.0.0" + camelcase "^4.0.0" + chalk "^2.0.1" + cli-boxes "^1.0.0" + string-width "^2.0.0" + term-size "^1.2.0" + widest-line "^2.0.0" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^2.3.1, braces@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +brorand@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + +browser-process-hrtime@^0.1.2: + version "0.1.3" + resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" + integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== + +browser-resolve@^1.11.3: + version "1.11.3" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" + integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== + dependencies: + resolve "1.1.7" + +browserify-aes@^1.0.0, browserify-aes@^1.0.4: + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + dependencies: + buffer-xor "^1.0.3" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.3" + inherits "^2.0.1" + safe-buffer "^5.0.1" + +browserify-cipher@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" + integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== + dependencies: + browserify-aes "^1.0.4" + browserify-des "^1.0.0" + evp_bytestokey "^1.0.0" + +browserify-des@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" + integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== + dependencies: + cipher-base "^1.0.1" + des.js "^1.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +browserify-rsa@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" + integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= + dependencies: + bn.js "^4.1.0" + randombytes "^2.0.1" + +browserify-sign@^4.0.0: + version "4.0.4" + resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" + integrity sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= + dependencies: + bn.js "^4.1.1" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.2" + elliptic "^6.0.0" + inherits "^2.0.1" + parse-asn1 "^5.0.0" + +browserify-zlib@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" + integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== + dependencies: + pako "~1.0.5" + +browserslist@4.7.0, browserslist@^4.0.0, browserslist@^4.1.1, browserslist@^4.6.0, browserslist@^4.6.4, browserslist@^4.6.6, browserslist@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.7.0.tgz#9ee89225ffc07db03409f2fee524dc8227458a17" + integrity sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA== + dependencies: + caniuse-lite "^1.0.30000989" + electron-to-chromium "^1.3.247" + node-releases "^1.1.29" + +bs-logger@0.x: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo= + dependencies: + base-x "^3.0.2" + +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + +bser@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5" + integrity sha512-8zsjWrQkkBoLK6uxASk1nJ2SKv97ltiGDo6A3wA0/yRPz+CwmEyDo0hUrhIuukG2JHpAl3bvFIixw2/3Hi0DOg== + dependencies: + node-int64 "^0.4.0" + +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= + +buffer-from@1.x, buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +buffer-indexof@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-indexof/-/buffer-indexof-1.1.1.tgz#52fabcc6a606d1a00302802648ef68f639da268c" + integrity sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g== + +buffer-xor@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + +buffer@^4.3.0: + version "4.9.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" + integrity sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg= + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + isarray "^1.0.0" + +buffer@^5.2.1: + version "5.4.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.4.3.tgz#3fbc9c69eb713d323e3fc1a895eee0710c072115" + integrity sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A== + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + +builtin-status-codes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" + integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= + +bytes@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" + integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= + +bytes@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" + integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== + +cacache@^12.0.2: + version "12.0.3" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390" + integrity sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw== + dependencies: + bluebird "^3.5.5" + chownr "^1.1.1" + figgy-pudding "^3.5.1" + glob "^7.1.4" + graceful-fs "^4.1.15" + infer-owner "^1.0.3" + lru-cache "^5.1.1" + mississippi "^3.0.0" + mkdirp "^0.5.1" + move-concurrently "^1.0.1" + promise-inflight "^1.0.1" + rimraf "^2.6.3" + ssri "^6.0.1" + unique-filename "^1.1.1" + y18n "^4.0.0" + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +call-me-maybe@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" + integrity sha1-JtII6onje1y95gJQoV8DHBak1ms= + +caller-callsite@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" + integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= + dependencies: + callsites "^2.0.0" + +caller-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" + integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= + dependencies: + caller-callsite "^2.0.0" + +callsites@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camel-case@3.0.x: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" + integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M= + dependencies: + no-case "^2.2.0" + upper-case "^1.1.1" + +camelcase-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" + integrity sha1-MIvur/3ygRkFHvodkyITyRuPkuc= + dependencies: + camelcase "^2.0.0" + map-obj "^1.0.0" + +camelcase@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" + integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA== + +camelcase@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" + integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= + +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= + +camelcase@^4.0.0, camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= + +camelcase@^5.0.0, camelcase@^5.2.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelize@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b" + integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs= + +caniuse-api@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0" + integrity sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw== + dependencies: + browserslist "^4.0.0" + caniuse-lite "^1.0.0" + lodash.memoize "^4.1.2" + lodash.uniq "^4.5.0" + +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30000998: + version "1.0.30000999" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000999.tgz#427253a69ad7bea4aa8d8345687b8eec51ca0e43" + integrity sha512-1CUyKyecPeksKwXZvYw0tEoaMCo/RwBlXmEtN5vVnabvO0KPd9RQLcaAuR9/1F+KDMv6esmOFWlsXuzDk+8rxg== + +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== + dependencies: + rsvp "^4.8.4" + +capture-stack-trace@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz#a6c0bbe1f38f3aa0b92238ecb6ff42c344d4135d" + integrity sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw== + +case-sensitive-paths-webpack-plugin@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.2.0.tgz#3371ef6365ef9c25fa4b81c16ace0e9c7dc58c3e" + integrity sha512-u5ElzokS8A1pm9vM3/iDgTcI3xqHxuCao94Oz8etI3cf0Tio0p8izkDYbTIn09uP3yUUr6+veaE6IkjnTYS46g== + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + +chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.4, chokidar@^2.1.5: + version "2.1.8" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" + integrity sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg== + dependencies: + anymatch "^2.0.0" + async-each "^1.0.1" + braces "^2.3.2" + glob-parent "^3.1.0" + inherits "^2.0.3" + is-binary-path "^1.0.0" + is-glob "^4.0.0" + normalize-path "^3.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.2.1" + upath "^1.1.1" + optionalDependencies: + fsevents "^1.2.7" + +chownr@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== + +chrome-trace-event@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4" + integrity sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ== + dependencies: + tslib "^1.9.0" + +ci-info@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" + integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +clean-css@4.2.x: + version "4.2.1" + resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17" + integrity sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g== + dependencies: + source-map "~0.6.0" + +cli-boxes@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" + integrity sha1-T6kXw+WclKAEzWH47lCdplFocUM= + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + +cliui@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" + wrap-ansi "^2.0.0" + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +clone-deep@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-0.2.4.tgz#4e73dd09e9fb971cc38670c5dced9c1896481cc6" + integrity sha1-TnPdCen7lxzDhnDF3O2cGJZIHMY= + dependencies: + for-own "^0.1.3" + is-plain-object "^2.0.1" + kind-of "^3.0.2" + lazy-cache "^1.0.3" + shallow-clone "^0.1.2" + +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= + +coa@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/coa/-/coa-2.0.2.tgz#43f6c21151b4ef2bf57187db0d73de229e3e7ec3" + integrity sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA== + dependencies: + "@types/q" "^1.5.1" + chalk "^2.4.1" + q "^1.1.2" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0, color-convert@^1.9.1: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@^1.0.0: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +color-string@^1.5.2: + version "1.5.3" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.5.3.tgz#c9bbc5f01b58b5492f3d6857459cb6590ce204cc" + integrity sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw== + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + +color@3.0.x: + version "3.0.0" + resolved "https://registry.yarnpkg.com/color/-/color-3.0.0.tgz#d920b4328d534a3ac8295d68f7bd4ba6c427be9a" + integrity sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w== + dependencies: + color-convert "^1.9.1" + color-string "^1.5.2" + +color@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/color/-/color-3.1.2.tgz#68148e7f85d41ad7649c5fa8c8106f098d229e10" + integrity sha512-vXTJhHebByxZn3lDvDJYw4lR5+uB3vuoHsuYA5AKuxRVn5wzzIfQKGLBmgdVRHKTJYeK5rvJcHnrd0Li49CFpg== + dependencies: + color-convert "^1.9.1" + color-string "^1.5.2" + +colornames@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/colornames/-/colornames-1.1.1.tgz#f8889030685c7c4ff9e2a559f5077eb76a816f96" + integrity sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y= + +colors@^1.2.1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + +colorspace@1.1.x: + version "1.1.2" + resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.2.tgz#e0128950d082b86a2168580796a0aa5d6c68d8c5" + integrity sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ== + dependencies: + color "3.0.x" + text-hex "1.0.x" + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@2.17.x: + version "2.17.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== + +commander@2.20.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== + +commander@^2.11.0, commander@^2.20.0: + version "2.20.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.1.tgz#3863ce3ca92d0831dcf2a102f5fb4b5926afd0f9" + integrity sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg== + +commander@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" + integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== + +commander@~2.19.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" + integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== + +common-tags@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937" + integrity sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw== + +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +compose-function@3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/compose-function/-/compose-function-3.0.3.tgz#9ed675f13cc54501d30950a486ff6a7ba3ab185f" + integrity sha1-ntZ18TzFRQHTCVCkhv9qe6OrGF8= + dependencies: + arity-n "^1.0.4" + +compressible@^2.0.12, compressible@~2.0.16: + version "2.0.17" + resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.17.tgz#6e8c108a16ad58384a977f3a482ca20bff2f38c1" + integrity sha512-BGHeLCK1GV7j1bSmQQAi26X+GgWcTjLr/0tzSvMCl3LH1w1IJ4PFSPoV5316b30cneTziC+B1a+3OjoSUcQYmw== + dependencies: + mime-db ">= 1.40.0 < 2" + +compression@^1.5.2: + version "1.7.4" + resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f" + integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ== + dependencies: + accepts "~1.3.5" + bytes "3.0.0" + compressible "~2.0.16" + debug "2.6.9" + on-headers "~1.0.2" + safe-buffer "5.1.2" + vary "~1.1.2" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +concat-stream@1.6.2, concat-stream@^1.5.0: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +concat-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-2.0.0.tgz#414cf5af790a48c60ab9be4527d56d5e41133cb1" + integrity sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A== + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.0.2" + typedarray "^0.0.6" + +configstore@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f" + integrity sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw== + dependencies: + dot-prop "^4.1.0" + graceful-fs "^4.1.2" + make-dir "^1.0.0" + unique-string "^1.0.0" + write-file-atomic "^2.0.0" + xdg-basedir "^3.0.0" + +configstore@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/configstore/-/configstore-5.0.0.tgz#37de662c7a49b5fe8dbcf8f6f5818d2d81ed852b" + integrity sha512-eE/hvMs7qw7DlcB5JPRnthmrITuHMmACUJAp89v6PT6iOqzoLS7HRWhBtuHMlhNHo2AhUSA/3Dh1bKNJHcublQ== + dependencies: + dot-prop "^5.1.0" + graceful-fs "^4.1.2" + make-dir "^3.0.0" + unique-string "^2.0.0" + write-file-atomic "^3.0.0" + xdg-basedir "^4.0.0" + +confusing-browser-globals@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz#72bc13b483c0276801681871d4898516f8f54fdd" + integrity sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw== + +connect-history-api-fallback@^1.3.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" + integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== + +console-browserify@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" + integrity sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA= + dependencies: + date-now "^0.1.4" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +"consolidated-events@^1.1.1 || ^2.0.0": + version "2.0.2" + resolved "https://registry.yarnpkg.com/consolidated-events/-/consolidated-events-2.0.2.tgz#da8d8f8c2b232831413d9e190dc11669c79f4a91" + integrity sha512-2/uRVMdRypf5z/TW/ncD/66l75P5hH2vM/GR8Jf8HLc2xnfJtmina6F6du8+v4Z2vTrMo7jC+W1tmEEuuELgkQ== + +constants-browserify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" + integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= + +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= + +content-disposition@0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" + integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== + dependencies: + safe-buffer "5.1.2" + +content-type@~1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" + integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== + +convert-source-map@1.6.0, convert-source-map@^1.1.0, convert-source-map@^1.4.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== + dependencies: + safe-buffer "~5.1.1" + +convert-source-map@^0.3.3: + version "0.3.5" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190" + integrity sha1-8dgClQr33SYxof6+BZZVDIarMZA= + +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= + +cookie@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" + integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== + +cookiejar@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" + integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA== + +copy-concurrently@^1.0.0: + version "1.0.5" + resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" + integrity sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A== + dependencies: + aproba "^1.1.1" + fs-write-stream-atomic "^1.0.8" + iferr "^0.1.5" + mkdirp "^0.5.1" + rimraf "^2.5.4" + run-queue "^1.0.0" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js-compat@^3.1.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.2.1.tgz#0cbdbc2e386e8e00d3b85dc81c848effec5b8150" + integrity sha512-MwPZle5CF9dEaMYdDeWm73ao/IflDH+FjeJCWEADcEgFSE9TLimFKwJsfmkwzI8eC0Aj0mgvMDjeQjrElkz4/A== + dependencies: + browserslist "^4.6.6" + semver "^6.3.0" + +core-js@3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.2.1.tgz#cd41f38534da6cc59f7db050fe67307de9868b09" + integrity sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw== + +core-js@^2.4.0: + version "2.6.9" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" + integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== + +core-js@^2.6.5: + version "2.6.10" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.10.tgz#8a5b8391f8cc7013da703411ce5b585706300d7f" + integrity sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA== + +core-util-is@1.0.2, core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +cosmiconfig@^5.0.0, cosmiconfig@^5.2.0, cosmiconfig@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" + integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== + dependencies: + import-fresh "^2.0.0" + is-directory "^0.3.1" + js-yaml "^3.13.1" + parse-json "^4.0.0" + +create-ecdh@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" + integrity sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== + dependencies: + bn.js "^4.1.0" + elliptic "^6.0.0" + +create-error-class@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" + integrity sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y= + dependencies: + capture-stack-trace "^1.0.0" + +create-hash@^1.1.0, create-hash@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-3.0.1.tgz#1256037ecb9f0c5f79e3d6ef135e30770184b982" + integrity sha1-ElYDfsufDF9549bvE14wdwGEuYI= + dependencies: + lru-cache "^4.0.1" + which "^1.2.9" + +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +crypto-browserify@^3.11.0: + version "3.12.0" + resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" + integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== + dependencies: + browserify-cipher "^1.0.0" + browserify-sign "^4.0.0" + create-ecdh "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.0" + diffie-hellman "^5.0.0" + inherits "^2.0.1" + pbkdf2 "^3.0.3" + public-encrypt "^4.0.0" + randombytes "^2.0.0" + randomfill "^1.0.3" + +crypto-random-string@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" + integrity sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4= + +crypto-random-string@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5" + integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA== + +css-blank-pseudo@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/css-blank-pseudo/-/css-blank-pseudo-0.1.4.tgz#dfdefd3254bf8a82027993674ccf35483bfcb3c5" + integrity sha512-LHz35Hr83dnFeipc7oqFDmsjHdljj3TQtxGGiNWSOsTLIAubSm4TEz8qCaKFpk7idaQ1GfWscF4E6mgpBysA1w== + dependencies: + postcss "^7.0.5" + +css-color-keywords@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05" + integrity sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU= + +css-color-names@0.0.4, css-color-names@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" + integrity sha1-gIrcLnnPhHOAabZGyyDsJ762KeA= + +css-declaration-sorter@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-4.0.1.tgz#c198940f63a76d7e36c1e71018b001721054cb22" + integrity sha512-BcxQSKTSEEQUftYpBVnsH4SF05NTuBokb19/sBt6asXGKZ/6VP7PLG1CBCkFDYOnhXhPh0jMhO6xZ71oYHXHBA== + dependencies: + postcss "^7.0.1" + timsort "^0.3.0" + +css-has-pseudo@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/css-has-pseudo/-/css-has-pseudo-0.10.0.tgz#3c642ab34ca242c59c41a125df9105841f6966ee" + integrity sha512-Z8hnfsZu4o/kt+AuFzeGpLVhFOGO9mluyHBaA2bA8aCGTwah5sT3WV/fTHH8UNZUytOIImuGPrl/prlb4oX4qQ== + dependencies: + postcss "^7.0.6" + postcss-selector-parser "^5.0.0-rc.4" + +css-loader@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-2.1.1.tgz#d8254f72e412bb2238bb44dd674ffbef497333ea" + integrity sha512-OcKJU/lt232vl1P9EEDamhoO9iKY3tIjY5GU+XDLblAykTdgs6Ux9P1hTHve8nFKy5KPpOXOsVI/hIwi3841+w== + dependencies: + camelcase "^5.2.0" + icss-utils "^4.1.0" + loader-utils "^1.2.3" + normalize-path "^3.0.0" + postcss "^7.0.14" + postcss-modules-extract-imports "^2.0.0" + postcss-modules-local-by-default "^2.0.6" + postcss-modules-scope "^2.1.0" + postcss-modules-values "^2.0.0" + postcss-value-parser "^3.3.0" + schema-utils "^1.0.0" + +css-prefers-color-scheme@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/css-prefers-color-scheme/-/css-prefers-color-scheme-3.1.1.tgz#6f830a2714199d4f0d0d0bb8a27916ed65cff1f4" + integrity sha512-MTu6+tMs9S3EUqzmqLXEcgNRbNkkD/TGFvowpeoWJn5Vfq7FMgsmRQs9X5NXAURiOBmOxm/lLjsDNXDE6k9bhg== + dependencies: + postcss "^7.0.5" + +css-select-base-adapter@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz#3b2ff4972cc362ab88561507a95408a1432135d7" + integrity sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w== + +css-select@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" + integrity sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg= + dependencies: + boolbase "~1.0.0" + css-what "2.1" + domutils "1.5.1" + nth-check "~1.0.1" + +css-select@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-2.0.2.tgz#ab4386cec9e1f668855564b17c3733b43b2a5ede" + integrity sha512-dSpYaDVoWaELjvZ3mS6IKZM/y2PMPa/XYoEfYNZePL4U/XgyxZNroHEHReDx/d+VgXh9VbCTtFqLkFbmeqeaRQ== + dependencies: + boolbase "^1.0.0" + css-what "^2.1.2" + domutils "^1.7.0" + nth-check "^1.0.2" + +css-to-react-native@^2.2.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-2.3.2.tgz#e75e2f8f7aa385b4c3611c52b074b70a002f2e7d" + integrity sha512-VOFaeZA053BqvvvqIA8c9n0+9vFppVBAHCp6JgFTtTMU3Mzi+XnelJ9XC9ul3BqFzZyQ5N+H0SnwsWT2Ebchxw== + dependencies: + camelize "^1.0.0" + css-color-keywords "^1.0.0" + postcss-value-parser "^3.3.0" + +css-tree@1.0.0-alpha.29: + version "1.0.0-alpha.29" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.29.tgz#3fa9d4ef3142cbd1c301e7664c1f352bd82f5a39" + integrity sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg== + dependencies: + mdn-data "~1.1.0" + source-map "^0.5.3" + +css-tree@1.0.0-alpha.33: + version "1.0.0-alpha.33" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.33.tgz#970e20e5a91f7a378ddd0fc58d0b6c8d4f3be93e" + integrity sha512-SPt57bh5nQnpsTBsx/IXbO14sRc9xXu5MtMAVuo0BaQQmyf0NupNPPSoMaqiAF5tDFafYsTkfeH4Q/HCKXkg4w== + dependencies: + mdn-data "2.0.4" + source-map "^0.5.3" + +css-unit-converter@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/css-unit-converter/-/css-unit-converter-1.1.1.tgz#d9b9281adcfd8ced935bdbaba83786897f64e996" + integrity sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY= + +css-what@2.1, css-what@^2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2" + integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg== + +css@^2.0.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/css/-/css-2.2.4.tgz#c646755c73971f2bba6a601e2cf2fd71b1298929" + integrity sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw== + dependencies: + inherits "^2.0.3" + source-map "^0.6.1" + source-map-resolve "^0.5.2" + urix "^0.1.0" + +cssdb@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/cssdb/-/cssdb-4.4.0.tgz#3bf2f2a68c10f5c6a08abd92378331ee803cddb0" + integrity sha512-LsTAR1JPEM9TpGhl/0p3nQecC2LJ0kD8X5YARu1hk/9I1gril5vDtMZyNxcEpxxDj34YNck/ucjuoUd66K03oQ== + +cssesc@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-2.0.0.tgz#3b13bd1bb1cb36e1bcb5a4dcd27f54c5dcb35703" + integrity sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg== + +cssesc@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" + integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== + +cssnano-preset-default@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-4.0.7.tgz#51ec662ccfca0f88b396dcd9679cdb931be17f76" + integrity sha512-x0YHHx2h6p0fCl1zY9L9roD7rnlltugGu7zXSKQx6k2rYw0Hi3IqxcoAGF7u9Q5w1nt7vK0ulxV8Lo+EvllGsA== + dependencies: + css-declaration-sorter "^4.0.1" + cssnano-util-raw-cache "^4.0.1" + postcss "^7.0.0" + postcss-calc "^7.0.1" + postcss-colormin "^4.0.3" + postcss-convert-values "^4.0.1" + postcss-discard-comments "^4.0.2" + postcss-discard-duplicates "^4.0.2" + postcss-discard-empty "^4.0.1" + postcss-discard-overridden "^4.0.1" + postcss-merge-longhand "^4.0.11" + postcss-merge-rules "^4.0.3" + postcss-minify-font-values "^4.0.2" + postcss-minify-gradients "^4.0.2" + postcss-minify-params "^4.0.2" + postcss-minify-selectors "^4.0.2" + postcss-normalize-charset "^4.0.1" + postcss-normalize-display-values "^4.0.2" + postcss-normalize-positions "^4.0.2" + postcss-normalize-repeat-style "^4.0.2" + postcss-normalize-string "^4.0.2" + postcss-normalize-timing-functions "^4.0.2" + postcss-normalize-unicode "^4.0.1" + postcss-normalize-url "^4.0.1" + postcss-normalize-whitespace "^4.0.2" + postcss-ordered-values "^4.1.2" + postcss-reduce-initial "^4.0.3" + postcss-reduce-transforms "^4.0.2" + postcss-svgo "^4.0.2" + postcss-unique-selectors "^4.0.1" + +cssnano-util-get-arguments@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz#ed3a08299f21d75741b20f3b81f194ed49cc150f" + integrity sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8= + +cssnano-util-get-match@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz#c0e4ca07f5386bb17ec5e52250b4f5961365156d" + integrity sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0= + +cssnano-util-raw-cache@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.1.tgz#b26d5fd5f72a11dfe7a7846fb4c67260f96bf282" + integrity sha512-qLuYtWK2b2Dy55I8ZX3ky1Z16WYsx544Q0UWViebptpwn/xDBmog2TLg4f+DBMg1rJ6JDWtn96WHbOKDWt1WQA== + dependencies: + postcss "^7.0.0" + +cssnano-util-same-parent@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz#574082fb2859d2db433855835d9a8456ea18bbf3" + integrity sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q== + +cssnano@^4.1.10: + version "4.1.10" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-4.1.10.tgz#0ac41f0b13d13d465487e111b778d42da631b8b2" + integrity sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ== + dependencies: + cosmiconfig "^5.0.0" + cssnano-preset-default "^4.0.7" + is-resolvable "^1.0.0" + postcss "^7.0.0" + +csso@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/csso/-/csso-3.5.1.tgz#7b9eb8be61628973c1b261e169d2f024008e758b" + integrity sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg== + dependencies: + css-tree "1.0.0-alpha.29" + +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0", cssom@^0.3.4: + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^1.0.0, cssstyle@^1.1.1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" + integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== + dependencies: + cssom "0.3.x" + +csstype@^2.2.0: + version "2.6.7" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.7.tgz#20b0024c20b6718f4eda3853a1f5a1cce7f5e4a5" + integrity sha512-9Mcn9sFbGBAdmimWb2gLVDtFJzeKtDGIr76TUqmjZrw9LFXBMSU70lcs+C0/7fyCd6iBDqmksUcCOUIkisPHsQ== + +currently-unhandled@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + integrity sha1-mI3zP+qxke95mmE2nddsF635V+o= + dependencies: + array-find-index "^1.0.1" + +cwd@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/cwd/-/cwd-0.10.0.tgz#172400694057c22a13b0cf16162c7e4b7a7fe567" + integrity sha1-FyQAaUBXwioTsM8WFix+S3p/5Wc= + dependencies: + find-pkg "^0.1.2" + fs-exists-sync "^0.1.0" + +cyclist@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" + integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= + +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + +damerau-levenshtein@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz#780cf7144eb2e8dbd1c3bb83ae31100ccc31a414" + integrity sha512-CBCRqFnpu715iPmw1KrdOrzRqbdFwQTwAWyyyYS42+iAgHCuXZ+/TdMgQkUENPomxEz9z1BEzuQU2Xw0kUuAgA== + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +data-urls@^1.0.0, data-urls@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== + dependencies: + abab "^2.0.0" + whatwg-mimetype "^2.2.0" + whatwg-url "^7.0.0" + +date-and-time@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/date-and-time/-/date-and-time-0.10.0.tgz#53825b774167b55fbdf0bbd0f17f19357df7bc70" + integrity sha512-IbIzxtvK80JZOVsWF6+NOjunTaoFVYxkAQoyzmflJyuRCJAJebehy48mPiCAedcGp4P7/UO3QYRWa0fe6INftg== + +date-now@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" + integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= + +debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@3.1.0, debug@=3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@^3.0.0, debug@^3.1.0, debug@^3.2.5, debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decamelize@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" + integrity sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg== + dependencies: + xregexp "4.0.0" + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +deep-equal@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.0.tgz#3103cdf8ab6d32cf4a8df7865458f2b8d33f3745" + integrity sha512-ZbfWJq/wN1Z273o7mUSjILYqehAktR2NVoSrOukDkU9kg2v/Uv89yU4Cvz8seJeAmtN5oqiefKq8FPuXOboqLw== + dependencies: + is-arguments "^1.0.4" + is-date-object "^1.0.1" + is-regex "^1.0.4" + object-is "^1.0.1" + object-keys "^1.1.1" + regexp.prototype.flags "^1.2.0" + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +default-gateway@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b" + integrity sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA== + dependencies: + execa "^1.0.0" + ip-regex "^2.1.0" + +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +del@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" + integrity sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU= + dependencies: + globby "^6.1.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + p-map "^1.1.1" + pify "^3.0.0" + rimraf "^2.2.8" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= + +des.js@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" + integrity sha1-wHTS4qpqipoH29YfmhXCzYPsjsw= + dependencies: + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + +destroy@~1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" + integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= + +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +detect-newline@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= + +detect-node@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" + integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw== + +detect-port-alt@1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/detect-port-alt/-/detect-port-alt-1.1.6.tgz#24707deabe932d4a3cf621302027c2b266568275" + integrity sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q== + dependencies: + address "^1.0.1" + debug "^2.6.0" + +diagnostics@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/diagnostics/-/diagnostics-1.1.1.tgz#cab6ac33df70c9d9a727490ae43ac995a769b22a" + integrity sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ== + dependencies: + colorspace "1.1.x" + enabled "1.0.x" + kuler "1.0.x" + +diff-sequences@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" + integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== + +diff@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== + +diffie-hellman@^5.0.0: + version "5.0.3" + resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" + integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== + dependencies: + bn.js "^4.1.0" + miller-rabin "^4.0.0" + randombytes "^2.0.0" + +dir-glob@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" + integrity sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag== + dependencies: + arrify "^1.0.1" + path-type "^3.0.0" + +dns-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" + integrity sha1-s55/HabrCnW6nBcySzR1PEfgZU0= + +dns-packet@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-1.3.1.tgz#12aa426981075be500b910eedcd0b47dd7deda5a" + integrity sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg== + dependencies: + ip "^1.1.0" + safe-buffer "^5.0.1" + +dns-txt@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/dns-txt/-/dns-txt-2.0.2.tgz#b91d806f5d27188e4ab3e7d107d881a1cc4642b6" + integrity sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY= + dependencies: + buffer-indexof "^1.0.0" + +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +document.contains@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/document.contains/-/document.contains-1.0.1.tgz#a18339ec8e74f407fa34709b65f45605b38a3e1f" + integrity sha512-A1KqlZq1w605bwiiLqVZehWE9S9UYlUXPoduFWi64pNVNQ9vy6wwH/7BS+iEfSlF1YyZgcg5PZw5HqDi7FCrUw== + dependencies: + define-properties "^1.1.3" + +dom-converter@^0.2: + version "0.2.0" + resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" + integrity sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA== + dependencies: + utila "~0.4" + +dom-serializer@0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.1.tgz#13650c850daffea35d8b626a4cfc4d3a17643fdb" + integrity sha512-sK3ujri04WyjwQXVoK4PU3y8ula1stq10GJZpqHIUgoGZdsGzAGu65BnU3d08aTVSvO7mGPZUc0wTEDL+qGE0Q== + dependencies: + domelementtype "^2.0.1" + entities "^2.0.0" + +domain-browser@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" + integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== + +domelementtype@1, domelementtype@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" + integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== + +domelementtype@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.0.1.tgz#1f8bdfe91f5a78063274e803b4bdcedf6e94f94d" + integrity sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ== + +domexception@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== + dependencies: + webidl-conversions "^4.0.2" + +domhandler@^2.3.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" + integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA== + dependencies: + domelementtype "1" + +domutils@1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" + integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8= + dependencies: + dom-serializer "0" + domelementtype "1" + +domutils@^1.5.1, domutils@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" + integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg== + dependencies: + dom-serializer "0" + domelementtype "1" + +dot-prop@^4.1.0, dot-prop@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" + integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ== + dependencies: + is-obj "^1.0.0" + +dot-prop@^5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.1.1.tgz#85783b39f2a54e04ae1981489a0ef2b9719bbd7d" + integrity sha512-QCHI6Lkf+9fJMpwfAFsTvbiSh6ujoPmhCLiDvD/n4dGtLvHfhuBwPdN6z2x4YSOwwtTcLoO/LP70xELWGF/JVA== + dependencies: + is-obj "^2.0.0" + +dotenv-expand@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0" + integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA== + +dotenv@6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" + integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w== + +duplexer3@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" + integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= + +duplexer@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= + +duplexify@^3.4.2, duplexify@^3.5.0, duplexify@^3.6.0: + version "3.7.1" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" + integrity sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g== + dependencies: + end-of-stream "^1.0.0" + inherits "^2.0.1" + readable-stream "^2.0.0" + stream-shift "^1.0.0" + +duplexify@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.1.tgz#7027dc374f157b122a8ae08c2d3ea4d2d953aa61" + integrity sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA== + dependencies: + end-of-stream "^1.4.1" + inherits "^2.0.3" + readable-stream "^3.1.1" + stream-shift "^1.0.0" + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +ecdsa-sig-formatter@1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= + +electron-to-chromium@^1.3.247: + version "1.3.280" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.280.tgz#5f8950c8329e3e11b59c705fd59b4b8d9b3de5b9" + integrity sha512-qYWNMjKLEfQAWZF2Sarvo+ahigu0EArnpCFSoUuZJS3W5wIeVfeEvsgmT2mgIrieQkeQ0+xFmykK3nx2ezekPQ== + +elliptic@^6.0.0, elliptic@^6.5.1: + version "6.5.1" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.1.tgz#c380f5f909bf1b9b4428d028cd18d3b0efd6b52b" + integrity sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg== + dependencies: + bn.js "^4.4.0" + brorand "^1.0.1" + hash.js "^1.0.0" + hmac-drbg "^1.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.0" + +emoji-regex@^7.0.1, emoji-regex@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +emojis-list@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" + integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= + +enabled@1.0.x: + version "1.0.2" + resolved "https://registry.yarnpkg.com/enabled/-/enabled-1.0.2.tgz#965f6513d2c2d1c5f4652b64a2e3396467fc2f93" + integrity sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M= + dependencies: + env-variable "0.0.x" + +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= + +end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +enhanced-resolve@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz#2937e2b8066cd0fe7ce0990a98f0d71a35189f66" + integrity sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA== + dependencies: + graceful-fs "^4.1.2" + memory-fs "^0.5.0" + tapable "^1.0.0" + +ent@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d" + integrity sha1-6WQhkyWiHQX0RGai9obtbOX13R0= + +entities@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" + integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== + +entities@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" + integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== + +env-variable@0.0.x: + version "0.0.5" + resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.5.tgz#913dd830bef11e96a039c038d4130604eba37f88" + integrity sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA== + +errno@^0.1.3, errno@~0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" + integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== + dependencies: + prr "~1.0.1" + +error-ex@^1.2.0, error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.12.0, es-abstract@^1.13.0, es-abstract@^1.15.0, es-abstract@^1.5.1, es-abstract@^1.7.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.15.0.tgz#8884928ec7e40a79e3c9bc812d37d10c8b24cc57" + integrity sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.0" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-inspect "^1.6.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.1.0" + string.prototype.trimright "^2.1.0" + +es-to-primitive@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + +es5-ext@^0.10.35, es5-ext@^0.10.50, es5-ext@^0.10.51: + version "0.10.51" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.51.tgz#ed2d7d9d48a12df86e0299287e93a09ff478842f" + integrity sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ== + dependencies: + es6-iterator "~2.0.3" + es6-symbol "~3.1.1" + next-tick "^1.0.0" + +es6-iterator@2.0.3, es6-iterator@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-promise@^4.0.3: + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== + +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= + dependencies: + es6-promise "^4.0.3" + +es6-symbol@^3.1.1, es6-symbol@~3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.2.tgz#859fdd34f32e905ff06d752e7171ddd4444a7ed1" + integrity sha512-/ZypxQsArlv+KHpGvng52/Iz8by3EQPxhmbuz8yFG89N/caTFBSbcXONDw0aMjy827gQg26XAjP4uXFvnfINmQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.51" + +escape-html@^1.0.3, escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +escodegen@^1.11.0, escodegen@^1.9.1: + version "1.12.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" + integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== + dependencies: + esprima "^3.1.3" + estraverse "^4.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.6.1" + +eslint-config-react-app@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-5.0.2.tgz#df40d73a1402986030680c040bbee520db5a32a4" + integrity sha512-VhlESAQM83uULJ9jsvcKxx2Ab0yrmjUt8kDz5DyhTQufqWE0ssAnejlWri5LXv25xoXfdqOyeDPdfJS9dXKagQ== + dependencies: + confusing-browser-globals "^1.0.9" + +eslint-import-resolver-node@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" + integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q== + dependencies: + debug "^2.6.9" + resolve "^1.5.0" + +eslint-loader@3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-3.0.2.tgz#5a627316a51d6f41d357b9f6f0554e91506cdd6e" + integrity sha512-S5VnD+UpVY1PyYRqeBd/4pgsmkvSokbHqTXAQMpvCyRr3XN2tvSLo9spm2nEpqQqh9dezw3os/0zWihLeOg2Rw== + dependencies: + fs-extra "^8.1.0" + loader-fs-cache "^1.0.2" + loader-utils "^1.2.3" + object-hash "^1.3.1" + schema-utils "^2.2.0" + +eslint-module-utils@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.1.tgz#7b4675875bf96b0dbf1b21977456e5bb1f5e018c" + integrity sha512-H6DOj+ejw7Tesdgbfs4jeS4YMFrT8uI8xwd1gtQqXssaR0EQ26L+2O/w6wkYFy2MymON0fTwHmXBvvfLNZVZEw== + dependencies: + debug "^2.6.8" + pkg-dir "^2.0.0" + +eslint-plugin-flowtype@3.13.0: + version "3.13.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz#e241ebd39c0ce519345a3f074ec1ebde4cf80f2c" + integrity sha512-bhewp36P+t7cEV0b6OdmoRWJCBYRiHFlqPZAG1oS3SF+Y0LQkeDvFSM4oxoxvczD1OdONCXMlJfQFiWLcV9urw== + dependencies: + lodash "^4.17.15" + +eslint-plugin-import@2.18.2: + version "2.18.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" + integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ== + dependencies: + array-includes "^3.0.3" + contains-path "^0.1.0" + debug "^2.6.9" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.2" + eslint-module-utils "^2.4.0" + has "^1.0.3" + minimatch "^3.0.4" + object.values "^1.1.0" + read-pkg-up "^2.0.0" + resolve "^1.11.0" + +eslint-plugin-jsx-a11y@6.2.3: + version "6.2.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz#b872a09d5de51af70a97db1eea7dc933043708aa" + integrity sha512-CawzfGt9w83tyuVekn0GDPU9ytYtxyxyFZ3aSWROmnRRFQFT2BiPJd7jvRdzNDi6oLWaS2asMeYSNMjWTV4eNg== + dependencies: + "@babel/runtime" "^7.4.5" + aria-query "^3.0.0" + array-includes "^3.0.3" + ast-types-flow "^0.0.7" + axobject-query "^2.0.2" + damerau-levenshtein "^1.0.4" + emoji-regex "^7.0.2" + has "^1.0.3" + jsx-ast-utils "^2.2.1" + +eslint-plugin-react-hooks@^1.6.1: + version "1.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz#6210b6d5a37205f0b92858f895a4e827020a7d04" + integrity sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA== + +eslint-plugin-react@7.14.3: + version "7.14.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz#911030dd7e98ba49e1b2208599571846a66bdf13" + integrity sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA== + dependencies: + array-includes "^3.0.3" + doctrine "^2.1.0" + has "^1.0.3" + jsx-ast-utils "^2.1.0" + object.entries "^1.1.0" + object.fromentries "^2.0.0" + object.values "^1.1.0" + prop-types "^15.7.2" + resolve "^1.10.1" + +eslint-scope@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" + integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" + integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== + dependencies: + eslint-visitor-keys "^1.0.0" + +eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== + +eslint@^6.1.0: + version "6.5.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.5.1.tgz#828e4c469697d43bb586144be152198b91e96ed6" + integrity sha512-32h99BoLYStT1iq1v2P9uwpyznQ4M2jRiFB6acitKz52Gqn+vPaMDUTB1bYi1WN4Nquj2w+t+bimYUG83DC55A== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.2" + eslint-visitor-keys "^1.1.0" + espree "^6.1.1" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^11.7.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^6.4.1" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.14" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" + table "^5.2.3" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.1.tgz#7f80e5f7257fc47db450022d723e356daeb1e5de" + integrity sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ== + dependencies: + acorn "^7.0.0" + acorn-jsx "^5.0.2" + eslint-visitor-keys "^1.1.0" + +esprima@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +esutils@^2.0.0, esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +eventemitter3@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb" + integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg== + +events@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88" + integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA== + +eventsource@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-1.0.7.tgz#8fbc72c93fcd34088090bc0a4e64f4b5cee6d8d0" + integrity sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ== + dependencies: + original "^1.0.0" + +evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== + dependencies: + md5.js "^1.3.4" + safe-buffer "^5.1.1" + +exec-sh@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" + integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expand-tilde@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-1.2.2.tgz#0b81eba897e5a3d31d1c3d102f8f01441e559449" + integrity sha1-C4HrqJflo9MdHD0QL48BRB5VlEk= + dependencies: + os-homedir "^1.0.1" + +expect-puppeteer@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/expect-puppeteer/-/expect-puppeteer-4.3.0.tgz#732a3c94ab44af0c7d947040ad3e3637a0359bf3" + integrity sha512-p8N/KSVPG9PAOJlftK5f1n3JrULJ6Qq1EQ8r/n9xzkX2NmXbK8PcnJnkSAEzEHrMycELKGnlJV7M5nkgm+wEWA== + +expect@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" + integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== + dependencies: + "@jest/types" "^24.9.0" + ansi-styles "^3.2.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.9.0" + +express-winston@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/express-winston/-/express-winston-4.0.1.tgz#98c74d099b9a7fdeedc56eb839c223968bc33990" + integrity sha512-HQZ/d2UPuZIr/PNiLOHX+CF2Q9srfBy1GDK7yIJ+MvX6MU49ggM25XynSNmC5RRPlD2ju3Zic+mCTQtixP1gzQ== + dependencies: + chalk "^2.4.1" + lodash "^4.17.10" + +express@^4.16.2, express@^4.17.1: + version "4.17.1" + resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" + integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== + dependencies: + accepts "~1.3.7" + array-flatten "1.1.1" + body-parser "1.19.0" + content-disposition "0.5.3" + content-type "~1.0.4" + cookie "0.4.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "~1.1.2" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "~1.1.2" + fresh "0.5.2" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "~2.3.0" + parseurl "~1.3.3" + path-to-regexp "0.1.7" + proxy-addr "~2.0.5" + qs "6.7.0" + range-parser "~1.2.1" + safe-buffer "5.1.2" + send "0.17.1" + serve-static "1.14.1" + setprototypeof "1.1.1" + statuses "~1.5.0" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +extend@^3.0.2, extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extract-zip@^1.6.6: + version "1.6.7" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" + integrity sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k= + dependencies: + concat-stream "1.6.2" + debug "2.6.9" + mkdirp "0.5.1" + yauzl "2.4.1" + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= + +fast-glob@^2.0.2: + version "2.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" + integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== + dependencies: + "@mrmlnc/readdir-enhanced" "^2.2.1" + "@nodelib/fs.stat" "^1.1.2" + glob-parent "^3.1.0" + is-glob "^4.0.0" + merge2 "^1.2.3" + micromatch "^3.1.10" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +fast-safe-stringify@^2.0.4: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" + integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== + +fast-text-encoding@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.0.tgz#3e5ce8293409cfaa7177a71b9ca84e1b1e6f25ef" + integrity sha512-R9bHCvweUxxwkDwhjav5vxpFvdPGlVngtqmx4pIZfSUhM/Q4NiIUHB456BAf+Q1Nwu3HEZYONtu+Rya+af4jiQ== + +faye-websocket@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" + integrity sha1-TkkvjQTftviQA1B/btvy1QHnxvQ= + dependencies: + websocket-driver ">=0.5.1" + +faye-websocket@~0.11.1: + version "0.11.3" + resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.3.tgz#5c0e9a8968e8912c286639fde977a8b209f2508e" + integrity sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA== + dependencies: + websocket-driver ">=0.5.1" + +fb-watchman@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= + dependencies: + bser "^2.0.0" + +fd-slicer@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65" + integrity sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU= + dependencies: + pend "~1.2.0" + +fecha@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fecha/-/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd" + integrity sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg== + +figgy-pudding@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" + integrity sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w== + +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + +file-loader@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-3.0.1.tgz#f8e0ba0b599918b51adfe45d66d1e771ad560faa" + integrity sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw== + dependencies: + loader-utils "^1.0.2" + schema-utils "^1.0.0" + +filesize@3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" + integrity sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg== + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +finalhandler@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" + integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "~2.3.0" + parseurl "~1.3.3" + statuses "~1.5.0" + unpipe "~1.0.0" + +find-cache-dir@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" + integrity sha1-yN765XyKUqinhPnjHFfHQumToLk= + dependencies: + commondir "^1.0.1" + mkdirp "^0.5.1" + pkg-dir "^1.0.0" + +find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" + integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== + dependencies: + commondir "^1.0.1" + make-dir "^2.0.0" + pkg-dir "^3.0.0" + +find-file-up@^0.1.2: + version "0.1.3" + resolved "https://registry.yarnpkg.com/find-file-up/-/find-file-up-0.1.3.tgz#cf68091bcf9f300a40da411b37da5cce5a2fbea0" + integrity sha1-z2gJG8+fMApA2kEbN9pczlovvqA= + dependencies: + fs-exists-sync "^0.1.0" + resolve-dir "^0.1.0" + +find-pkg@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/find-pkg/-/find-pkg-0.1.2.tgz#1bdc22c06e36365532e2a248046854b9788da557" + integrity sha1-G9wiwG42NlUy4qJIBGhUuXiNpVc= + dependencies: + find-file-up "^0.1.2" + +find-process@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/find-process/-/find-process-1.4.2.tgz#8703cbb542df0e4cd646f581fbcce860d0131c31" + integrity sha512-O83EVJr4dWvHJ7QpUzANNAMeQVKukRzRqRx4AIzdLYRrQorRdbqDwLPigkd9PYPhJRhmNPAoVjOm9bcwSmcZaw== + dependencies: + chalk "^2.0.1" + commander "^2.11.0" + debug "^2.6.8" + +find-up@3.0.0, find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== + +flatten@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" + integrity sha1-2uRqnXj74lKSJYzB54CkHZXAN4I= + +flush-write-stream@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" + integrity sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w== + dependencies: + inherits "^2.0.3" + readable-stream "^2.3.6" + +follow-redirects@1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" + integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== + dependencies: + debug "=3.1.0" + +follow-redirects@^1.0.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.9.0.tgz#8d5bcdc65b7108fe1508649c79c12d732dcedb4f" + integrity sha512-CRcPzsSIbXyVDl0QI01muNDu69S8trU4jArW9LpOt2WtC6LyUJetcIrmfHsRBx7/Jb6GHJUiuqyYxPooFfNt6A== + dependencies: + debug "^3.0.0" + +for-in@^0.1.3: + version "0.1.8" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1" + integrity sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE= + +for-in@^1.0.1, for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^0.1.3: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= + dependencies: + for-in "^1.0.1" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +fork-ts-checker-webpack-plugin@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.5.0.tgz#ce1d77190b44d81a761b10b6284a373795e41f0c" + integrity sha512-zEhg7Hz+KhZlBhILYpXy+Beu96gwvkROWJiTXOCyOOMMrdBIRPvsBpBqgTI4jfJGrJXcqGwJR8zsBGDmzY0jsA== + dependencies: + babel-code-frame "^6.22.0" + chalk "^2.4.1" + chokidar "^2.0.4" + micromatch "^3.1.10" + minimatch "^3.0.4" + semver "^5.6.0" + tapable "^1.0.0" + worker-rpc "^0.1.0" + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +forwarded@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" + integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ= + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= + +from2@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" + integrity sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8= + dependencies: + inherits "^2.0.1" + readable-stream "^2.0.0" + +fs-exists-sync@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add" + integrity sha1-mC1ok6+RjnLQjeyehnP/K1qNat0= + +fs-extra@7.0.1, fs-extra@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-extra@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" + integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs-minipass@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== + dependencies: + minipass "^2.6.0" + +fs-write-stream-atomic@^1.0.8: + version "1.0.10" + resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" + integrity sha1-tH31NJPvkR33VzHnCp3tAYnbQMk= + dependencies: + graceful-fs "^4.1.2" + iferr "^0.1.5" + imurmurhash "^0.1.4" + readable-stream "1 || 2" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a" + integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ== + +fsevents@^1.2.7: + version "1.2.9" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f" + integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw== + dependencies: + nan "^2.12.1" + node-pre-gyp "^0.12.0" + +fstream@^1.0.0, fstream@^1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.12.tgz#4e8ba8ee2d48be4f7d0de505455548eae5932045" + integrity sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg== + dependencies: + graceful-fs "^4.1.2" + inherits "~2.0.0" + mkdirp ">=0.5 0" + rimraf "2" + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +function.prototype.name@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.1.tgz#6d252350803085abc2ad423d4fe3be2f9cbda392" + integrity sha512-e1NzkiJuw6xqVH7YSdiW/qDHebcmMhPNe6w+4ZYYEg0VA+LaLzx37RimbPLuonHhYGFGPx1ME2nSi74JiaCr/Q== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + functions-have-names "^1.1.1" + is-callable "^1.1.4" + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + +functions-have-names@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.1.1.tgz#79d35927f07b8e7103d819fed475b64ccf7225ea" + integrity sha512-U0kNHUoxwPNPWOJaMG7Z00d4a/qZVrFtzWJRaK8V9goaVOCXBSQSJpt3MYGNtkScKEBKovxLjnNdC9MlXwo5Pw== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +gaxios@^2.0.0, gaxios@^2.0.1, gaxios@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-2.1.0.tgz#b5d04ec19bf853d4589ccc2e7d61f0f2ab62afee" + integrity sha512-Gtpb5sdQmb82sgVkT2GnS2n+Kx4dlFwbeMYcDlD395aEvsLCSQXJJcHt7oJ2LrGxDEAeiOkK79Zv2A8Pzt6CFg== + dependencies: + abort-controller "^3.0.0" + extend "^3.0.2" + https-proxy-agent "^3.0.0" + is-stream "^2.0.0" + node-fetch "^2.3.0" + +gaze@^1.0.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a" + integrity sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g== + dependencies: + globule "^1.0.0" + +gcp-metadata@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-3.2.0.tgz#27d59660f11de411d35b1edb8a41e81389cab5f6" + integrity sha512-ympv+yQ6k5QuWCuwQqnGEvFGS7MBKdcQdj1i188v3bW9QLFIchTGaBCEZxSQapT0jffdn1vdt8oJhB5VBWQO1Q== + dependencies: + gaxios "^2.0.1" + json-bigint "^0.3.0" + +gcs-resumable-upload@^2.2.4: + version "2.3.0" + resolved "https://registry.yarnpkg.com/gcs-resumable-upload/-/gcs-resumable-upload-2.3.0.tgz#7d7eef01df5f45f66975ebc0c268d17d9a2c3b9c" + integrity sha512-PclXJiEngrVx0c4K0LfE1XOxhmOkBEy39Rrhspdn6jAbbwe4OQMZfjo7Z1LHBrh57+bNZeIN4M+BooYppCoHSg== + dependencies: + abort-controller "^3.0.0" + configstore "^5.0.0" + gaxios "^2.0.0" + google-auth-library "^5.0.0" + pumpify "^2.0.0" + stream-events "^1.0.4" + +get-caller-file@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-own-enumerable-property-symbols@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.1.tgz#6f7764f88ea11e0b514bd9bd860a132259992ca4" + integrity sha512-09/VS4iek66Dh2bctjRkowueRJbY1JDGR1L/zRxO1Qk8Uxs6PnqaNSqalpizPT+CDjre3hnEsuzvhgomz9qYrA== + +get-stdin@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" + integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= + +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +glob-parent@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= + dependencies: + is-glob "^3.1.0" + path-dirname "^1.0.0" + +glob-parent@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + dependencies: + is-glob "^4.0.1" + +glob-to-regexp@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" + integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= + +glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1: + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.5, glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +global-dirs@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445" + integrity sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU= + dependencies: + ini "^1.3.4" + +global-modules@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" + integrity sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A== + dependencies: + global-prefix "^3.0.0" + +global-modules@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-0.2.3.tgz#ea5a3bed42c6d6ce995a4f8a1269b5dae223828d" + integrity sha1-6lo77ULG1s6ZWk+KEmm12uIjgo0= + dependencies: + global-prefix "^0.1.4" + is-windows "^0.2.0" + +global-prefix@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-0.1.5.tgz#8d3bc6b8da3ca8112a160d8d496ff0462bfef78f" + integrity sha1-jTvGuNo8qBEqFg2NSW/wRiv+948= + dependencies: + homedir-polyfill "^1.0.0" + ini "^1.3.4" + is-windows "^0.2.0" + which "^1.2.12" + +global-prefix@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-3.0.0.tgz#fc85f73064df69f50421f47f883fe5b913ba9b97" + integrity sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg== + dependencies: + ini "^1.3.5" + kind-of "^6.0.2" + which "^1.3.1" + +globals@^11.1.0, globals@^11.7.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globby@8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" + integrity sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w== + dependencies: + array-union "^1.0.1" + dir-glob "2.0.0" + fast-glob "^2.0.2" + glob "^7.1.2" + ignore "^3.3.5" + pify "^3.0.0" + slash "^1.0.0" + +globby@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" + integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= + dependencies: + array-union "^1.0.1" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +globule@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.1.tgz#5dffb1b191f22d20797a9369b49eab4e9839696d" + integrity sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ== + dependencies: + glob "~7.1.1" + lodash "~4.17.10" + minimatch "~3.0.2" + +google-auth-library@^5.0.0, google-auth-library@^5.5.0: + version "5.5.1" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-5.5.1.tgz#2bf5ade93cb9d00c860d3fb15798db33b39a53a7" + integrity sha512-zCtjQccWS/EHYyFdXRbfeSGM/gW+d7uMAcVnvXRnjBXON5ijo6s0nsObP0ifqileIDSbZjTlLtgo+UoN8IFJcg== + dependencies: + arrify "^2.0.0" + base64-js "^1.3.0" + fast-text-encoding "^1.0.0" + gaxios "^2.1.0" + gcp-metadata "^3.2.0" + gtoken "^4.1.0" + jws "^3.1.5" + lru-cache "^5.0.0" + +google-p12-pem@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-2.0.2.tgz#39cae8f6fcbe66a01f00be4ddf2d56b95926fa7b" + integrity sha512-UfnEARfJKI6pbmC1hfFFm+UAcZxeIwTiEcHfqKe/drMsXD/ilnVjF7zgOGpHXyhuvX6jNJK3S8A0hOQjwtFxEw== + dependencies: + node-forge "^0.9.0" + +got@^6.7.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" + integrity sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA= + dependencies: + create-error-class "^3.0.0" + duplexer3 "^0.1.4" + get-stream "^3.0.0" + is-redirect "^1.0.0" + is-retry-allowed "^1.0.0" + is-stream "^1.0.0" + lowercase-keys "^1.0.0" + safe-buffer "^5.0.1" + timed-out "^4.0.0" + unzip-response "^2.0.1" + url-parse-lax "^1.0.0" + +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.2" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" + integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= + +gtoken@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-4.1.0.tgz#0b315dd1a925e3ad3c82db1eb5b9e89bae875ba8" + integrity sha512-wqyn2gf5buzEZN4QNmmiiW2i2JkEdZnL7Z/9p44RtZqgt4077m4khRgAYNuu8cBwHWCc6MsP6eDUn/KkF6jFIw== + dependencies: + gaxios "^2.0.0" + google-p12-pem "^2.0.0" + jws "^3.1.5" + mime "^2.2.0" + +gzip-size@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-5.1.1.tgz#cb9bee692f87c0612b232840a873904e4c135274" + integrity sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA== + dependencies: + duplexer "^0.1.1" + pify "^4.0.1" + +handle-thing@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.0.tgz#0e039695ff50c93fc288557d696f3c1dc6776754" + integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== + +handlebars@^4.1.2: + version "4.4.3" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.4.3.tgz#180bae52c1d0e9ec0c15d7e82a4362d662762f6e" + integrity sha512-B0W4A2U1ww3q7VVthTKfh+epHx+q4mCt6iK+zEAzbMBpWQAwxCeKxEGpj/1oQTpzPXDNSOG7hmG14TsISH50yw== + dependencies: + neo-async "^2.6.0" + optimist "^0.6.1" + source-map "^0.6.1" + optionalDependencies: + uglify-js "^3.1.4" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.0: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + +harmony-reflect@^1.4.6: + version "1.6.1" + resolved "https://registry.yarnpkg.com/harmony-reflect/-/harmony-reflect-1.6.1.tgz#c108d4f2bb451efef7a37861fdbdae72c9bdefa9" + integrity sha512-WJTeyp0JzGtHcuMsi7rw2VwtkvLa+JyfEKJCFyfcS0+CDkjQ5lHPu7zEhFZP+PDSRrEgXa5Ah0l1MbgbE41XjA== + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +has@^1.0.0, has@^1.0.1, has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +hash-base@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" + integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +hash-stream-validation@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/hash-stream-validation/-/hash-stream-validation-0.2.2.tgz#6b34c4fce5e9fce265f1d3380900049d92a10090" + integrity sha512-cMlva5CxWZOrlS/cY0C+9qAzesn5srhFA8IT1VPiHc9bWWBLkJfEUIZr7MWoi89oOOGmpg8ymchaOjiArsGu5A== + dependencies: + through2 "^2.0.0" + +hash.js@^1.0.0, hash.js@^1.0.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +he@1.2.x: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +hex-color-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" + integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== + +hmac-drbg@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +hoist-non-react-statics@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#b09178f0122184fb95acf525daaecb4d8f45958b" + integrity sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA== + dependencies: + react-is "^16.7.0" + +homedir-polyfill@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" + integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== + dependencies: + parse-passwd "^1.0.0" + +hosted-git-info@^2.1.4: + version "2.8.5" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" + integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== + +hpack.js@^2.1.6: + version "2.1.6" + resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" + integrity sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI= + dependencies: + inherits "^2.0.1" + obuf "^1.0.0" + readable-stream "^2.0.1" + wbuf "^1.1.0" + +hsl-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e" + integrity sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4= + +hsla-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hsla-regex/-/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38" + integrity sha1-wc56MWjIxmFAM6S194d/OyJfnDg= + +html-comment-regex@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.2.tgz#97d4688aeb5c81886a364faa0cad1dda14d433a7" + integrity sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ== + +html-encoding-sniffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== + dependencies: + whatwg-encoding "^1.0.1" + +html-entities@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f" + integrity sha1-DfKTUfByEWNRXfueVUPl9u7VFi8= + +html-minifier@^3.5.20: + version "3.5.21" + resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.21.tgz#d0040e054730e354db008463593194015212d20c" + integrity sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA== + dependencies: + camel-case "3.0.x" + clean-css "4.2.x" + commander "2.17.x" + he "1.2.x" + param-case "2.1.x" + relateurl "0.2.x" + uglify-js "3.4.x" + +html-webpack-plugin@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.5.tgz#2c53083c1151bfec20479b1f8aaf0039e77b5513" + integrity sha512-y5l4lGxOW3pz3xBTFdfB9rnnrWRPVxlAhX6nrBYIcW+2k2zC3mSp/3DxlWVCMBfnO6UAnoF8OcFn0IMy6kaKAQ== + dependencies: + html-minifier "^3.5.20" + loader-utils "^1.1.0" + lodash "^4.17.11" + pretty-error "^2.1.1" + tapable "^1.1.0" + util.promisify "1.0.0" + +htmlparser2@^3.10.0, htmlparser2@^3.3.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" + integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== + dependencies: + domelementtype "^1.3.1" + domhandler "^2.3.0" + domutils "^1.5.1" + entities "^1.1.1" + inherits "^2.0.1" + readable-stream "^3.1.1" + +http-deceiver@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" + integrity sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc= + +http-errors@1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" + integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +http-errors@~1.6.2: + version "1.6.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" + integrity sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0= + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.0" + statuses ">= 1.4.0 < 2" + +http-errors@~1.7.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" + integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +"http-parser-js@>=0.4.0 <0.4.11": + version "0.4.10" + resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.10.tgz#92c9c1374c35085f75db359ec56cc257cbb93fa4" + integrity sha1-ksnBN0w1CF912zWexWzCV8u5P6Q= + +http-proxy-agent@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" + integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== + dependencies: + agent-base "4" + debug "3.1.0" + +http-proxy-middleware@^0.19.1: + version "0.19.1" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz#183c7dc4aa1479150306498c210cdaf96080a43a" + integrity sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q== + dependencies: + http-proxy "^1.17.0" + is-glob "^4.0.0" + lodash "^4.17.11" + micromatch "^3.1.10" + +http-proxy-middleware@^0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.20.0.tgz#5b128f7207985c4ea91b53fab8ad897a48c690d6" + integrity sha512-dNJAk71nEJhPiAczQH9hGvE/MT9kEs+zn2Dh+Hi94PGZe1GluQirC7mw5rdREUtWx6qGS1Gu0bZd4qEAg+REgw== + dependencies: + http-proxy "^1.17.0" + is-glob "^4.0.1" + lodash "^4.17.14" + micromatch "^4.0.2" + +http-proxy@^1.17.0: + version "1.18.0" + resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a" + integrity sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ== + dependencies: + eventemitter3 "^4.0.0" + follow-redirects "^1.0.0" + requires-port "^1.0.0" + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +https-browserify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" + integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= + +https-proxy-agent@^2.2.1: + version "2.2.3" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.3.tgz#fb6cd98ed5b9c35056b5a73cd01a8a721d7193d1" + integrity sha512-Ytgnz23gm2DVftnzqRRz2dOXZbGd2uiajSw/95bPp6v53zPRspQjLm/AfBgqbJ2qfeRXWIOMVLpp86+/5yX39Q== + dependencies: + agent-base "^4.3.0" + debug "^3.1.0" + +https-proxy-agent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.0.tgz#0106efa5d63d6d6f3ab87c999fa4877a3fd1ff97" + integrity sha512-y4jAxNEihqvBI5F3SaO2rtsjIOnnNA8sEbuiP+UhJZJHeM2NRm6c09ax2tgqme+SgUUvjao2fJXF4h3D6Cb2HQ== + dependencies: + agent-base "^4.3.0" + debug "^3.1.0" + +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +icss-replace-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" + integrity sha1-Bupvg2ead0njhs/h/oEq5dsiPe0= + +icss-utils@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467" + integrity sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA== + dependencies: + postcss "^7.0.14" + +identity-obj-proxy@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14" + integrity sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ= + dependencies: + harmony-reflect "^1.4.6" + +ieee754@^1.1.4: + version "1.1.13" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" + integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== + +iferr@^0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" + integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= + +ignore-by-default@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" + integrity sha1-SMptcvbGo68Aqa1K5odr44ieKwk= + +ignore-walk@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== + dependencies: + minimatch "^3.0.4" + +ignore@^3.3.5: + version "3.3.10" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" + integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +immer@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/immer/-/immer-1.10.0.tgz#bad67605ba9c810275d91e1c2a47d4582e98286d" + integrity sha512-O3sR1/opvCDGLEVcvrGTMtLac8GJ5IwZC4puPrLuRj3l7ICKvkmA0vGuU9OW8mV9WIBRnaxp5GJh9IEAaNOoYg== + +import-cwd@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" + integrity sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk= + dependencies: + import-from "^2.1.0" + +import-fresh@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" + integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= + dependencies: + caller-path "^2.0.0" + resolve-from "^3.0.0" + +import-fresh@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" + integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +import-from@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" + integrity sha1-M1238qev/VOqpHHUuAId7ja387E= + dependencies: + resolve-from "^3.0.0" + +import-lazy@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" + integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM= + +import-local@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" + integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== + dependencies: + pkg-dir "^3.0.0" + resolve-cwd "^2.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +in-publish@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.0.tgz#e20ff5e3a2afc2690320b6dc552682a9c7fadf51" + integrity sha1-4g/146KvwmkDILbcVSaCqcf631E= + +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + integrity sha1-ji1INIdCEhtKghi3oTfppSBJ3IA= + dependencies: + repeating "^2.0.0" + +indexes-of@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" + integrity sha1-8w9xbI4r00bHtn0985FVZqfAVgc= + +infer-owner@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" + integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +inherits@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" + integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= + +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + +ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + +inquirer@6.5.0: + version "6.5.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" + integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + +inquirer@^6.4.1: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + +internal-ip@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907" + integrity sha512-S1zBo1D6zcsyuC6PMmY5+55YMILQ9av8lotMx447Bq6SAgo/sDK6y6uUKmuYhW7eacnIhFfsPmCNYdDzsnnDCg== + dependencies: + default-gateway "^4.2.0" + ipaddr.js "^1.9.0" + +invariant@^2.2.2, invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= + +invert-kv@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" + integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== + +ip-regex@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" + integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= + +ip@^1.1.0, ip@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" + integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= + +ipaddr.js@1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.0.tgz#37df74e430a0e47550fe54a2defe30d8acd95f65" + integrity sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA== + +ipaddr.js@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + +is-absolute-url@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-2.1.0.tgz#50530dfb84fcc9aa7dbe7852e83a37b93b9f2aa6" + integrity sha1-UFMN+4T8yap9vnhS6Do3uTufKqY= + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-arguments@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3" + integrity sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA== + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-arrayish@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" + integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== + +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= + dependencies: + binary-extensions "^1.0.0" + +is-buffer@^1.0.2, is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-buffer@^2.0.2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623" + integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A== + +is-callable@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== + +is-ci@^1.0.10: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" + integrity sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg== + dependencies: + ci-info "^1.5.0" + +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + +is-color-stop@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-color-stop/-/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345" + integrity sha1-z/9HGu5N1cnhWFmPvhKWe1za00U= + dependencies: + css-color-names "^0.0.4" + hex-color-regex "^1.1.0" + hsl-regex "^1.0.0" + hsla-regex "^1.0.0" + rgb-regex "^1.0.1" + rgba-regex "^1.0.0" + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-directory@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^2.1.0, is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-glob@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= + dependencies: + is-extglob "^2.1.0" + +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-installed-globally@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.1.0.tgz#0dfd98f5a9111716dd535dda6492f67bf3d25a80" + integrity sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA= + dependencies: + global-dirs "^0.1.0" + is-path-inside "^1.0.0" + +is-npm@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" + integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ= + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-obj@^1.0.0, is-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= + +is-obj@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" + integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + integrity sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0= + +is-path-in-cwd@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" + integrity sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ== + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" + integrity sha1-jvW33lBDej/cprToZe96pVy0gDY= + dependencies: + path-is-inside "^1.0.1" + +is-plain-obj@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + +is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +is-redirect@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" + integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= + +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= + dependencies: + has "^1.0.1" + +is-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= + +is-resolvable@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== + +is-retry-allowed@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4" + integrity sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg== + +is-root@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-root/-/is-root-2.1.0.tgz#809e18129cf1129644302a4f8544035d51984a9c" + integrity sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg== + +is-stream@^1.0.0, is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + +is-svg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-3.0.0.tgz#9321dbd29c212e5ca99c4fa9794c714bcafa2f75" + integrity sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ== + dependencies: + html-comment-regex "^1.1.0" + +is-symbol@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + dependencies: + has-symbols "^1.0.0" + +is-typedarray@^1.0.0, is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= + +is-what@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/is-what/-/is-what-3.3.1.tgz#79502181f40226e2d8c09226999db90ef7c1bcbe" + integrity sha512-seFn10yAXy+yJlTRO+8VfiafC+0QJanGLMPTBWLrJm/QPauuchy0UXh8B6H5o9VA8BAzk0iYievt6mNp6gfaqA== + +is-windows@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c" + integrity sha1-3hqm1j6indJIc3tp8f+LgALSEIw= + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" + integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== + +istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" + integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== + dependencies: + "@babel/generator" "^7.4.0" + "@babel/parser" "^7.4.3" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" + istanbul-lib-coverage "^2.0.5" + semver "^6.0.0" + +istanbul-lib-report@^2.0.4: + version "2.0.8" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" + integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== + dependencies: + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + supports-color "^6.1.0" + +istanbul-lib-source-maps@^3.0.1: + version "3.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" + integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + rimraf "^2.6.3" + source-map "^0.6.1" + +istanbul-reports@^2.2.6: + version "2.2.6" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" + integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== + dependencies: + handlebars "^4.1.2" + +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== + dependencies: + "@jest/types" "^24.9.0" + execa "^1.0.0" + throat "^4.0.0" + +jest-cli@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" + integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== + dependencies: + "@jest/core" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + exit "^0.1.2" + import-local "^2.0.0" + is-ci "^2.0.0" + jest-config "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + prompts "^2.0.1" + realpath-native "^1.1.0" + yargs "^13.3.0" + +jest-config@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" + integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== + dependencies: + "@babel/core" "^7.1.0" + "@jest/test-sequencer" "^24.9.0" + "@jest/types" "^24.9.0" + babel-jest "^24.9.0" + chalk "^2.0.1" + glob "^7.1.1" + jest-environment-jsdom "^24.9.0" + jest-environment-node "^24.9.0" + jest-get-type "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + micromatch "^3.1.10" + pretty-format "^24.9.0" + realpath-native "^1.1.0" + +jest-dev-server@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/jest-dev-server/-/jest-dev-server-4.3.0.tgz#27c9cdc96d9f735bc90a309ca39305b76f2c0edd" + integrity sha512-bC9flKY2G1honQ/UI0gEhb0wFnDhpFr7xidC8Nk+evi7TgnNtfsGIzzF2dcIhF1G9BGF0n/M7CJrMAzwQhyTPA== + dependencies: + chalk "^2.4.2" + cwd "^0.10.0" + find-process "^1.4.2" + prompts "^2.1.0" + spawnd "^4.0.0" + tree-kill "^1.2.1" + wait-on "^3.3.0" + +jest-diff@^24.3.0, jest-diff@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== + dependencies: + chalk "^2.0.1" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-docblock@^24.3.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" + integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== + dependencies: + detect-newline "^2.1.0" + +jest-each@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" + integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== + dependencies: + "@jest/types" "^24.9.0" + chalk "^2.0.1" + jest-get-type "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + +jest-environment-jsdom-fourteen@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom-fourteen/-/jest-environment-jsdom-fourteen-0.1.0.tgz#aad6393a9d4b565b69a609109bf469f62bf18ccc" + integrity sha512-4vtoRMg7jAstitRzL4nbw83VmGH8Rs13wrND3Ud2o1fczDhMUF32iIrNKwYGgeOPUdfvZU4oy8Bbv+ni1fgVCA== + dependencies: + jest-mock "^24.5.0" + jest-util "^24.5.0" + jsdom "^14.0.0" + +jest-environment-jsdom@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" + integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" + jsdom "^11.5.1" + +jest-environment-node@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" + integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" + +jest-environment-puppeteer@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-puppeteer/-/jest-environment-puppeteer-4.3.0.tgz#49ac781c4b50459485af031cfb16ad1fd75d31ac" + integrity sha512-ZighMsU39bnacn2ylyHb88CB+ldgCfXGD3lS78k4PEo8A8xyt6+2mxmSR62FH3Y7K+W2gPDu5+QM3/LZuq42fQ== + dependencies: + chalk "^2.4.2" + cwd "^0.10.0" + jest-dev-server "^4.3.0" + merge-deep "^3.0.2" + +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== + +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== + dependencies: + "@jest/types" "^24.9.0" + anymatch "^2.0.0" + fb-watchman "^2.0.0" + graceful-fs "^4.1.15" + invariant "^2.2.4" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" + micromatch "^3.1.10" + sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^1.2.7" + +jest-jasmine2@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" + integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== + dependencies: + "@babel/traverse" "^7.1.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + co "^4.6.0" + expect "^24.9.0" + is-generator-fn "^2.0.0" + jest-each "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + throat "^4.0.0" + +jest-leak-detector@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" + integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== + dependencies: + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-matcher-utils@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" + integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== + dependencies: + chalk "^2.0.1" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" + +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/stack-utils" "^1.0.1" + chalk "^2.0.1" + micromatch "^3.1.10" + slash "^2.0.0" + stack-utils "^1.0.1" + +jest-mock@^24.5.0, jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== + dependencies: + "@jest/types" "^24.9.0" + +jest-pnp-resolver@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" + integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== + +jest-puppeteer@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/jest-puppeteer/-/jest-puppeteer-4.3.0.tgz#432273c2c2c75fbec40d7659b75cbcc7c4ae57ad" + integrity sha512-WXhaWlbQl01xadZyNmdZntrtIr8uWUmgjPogDih7dOnr3G/xRr3A034SCqdjwV6fE0tqz7c5hwO8oBTyGZPRgA== + dependencies: + expect-puppeteer "^4.3.0" + jest-environment-puppeteer "^4.3.0" + +jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" + integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== + +jest-resolve-dependencies@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" + integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== + dependencies: + "@jest/types" "^24.9.0" + jest-regex-util "^24.3.0" + jest-snapshot "^24.9.0" + +jest-resolve@24.9.0, jest-resolve@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" + integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== + dependencies: + "@jest/types" "^24.9.0" + browser-resolve "^1.11.3" + chalk "^2.0.1" + jest-pnp-resolver "^1.2.1" + realpath-native "^1.1.0" + +jest-runner@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" + integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + chalk "^2.4.2" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-config "^24.9.0" + jest-docblock "^24.3.0" + jest-haste-map "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-leak-detector "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.6.0" + source-map-support "^0.5.6" + throat "^4.0.0" + +jest-runtime@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" + integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.9.0" + "@jest/source-map" "^24.3.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.1.15" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + realpath-native "^1.1.0" + slash "^2.0.0" + strip-bom "^3.0.0" + yargs "^13.3.0" + +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== + +jest-snapshot@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" + integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== + dependencies: + "@babel/types" "^7.0.0" + "@jest/types" "^24.9.0" + chalk "^2.0.1" + expect "^24.9.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^24.9.0" + semver "^6.2.0" + +jest-util@^24.5.0, jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + callsites "^3.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.15" + is-ci "^2.0.0" + mkdirp "^0.5.1" + slash "^2.0.0" + source-map "^0.6.0" + +jest-validate@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" + integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== + dependencies: + "@jest/types" "^24.9.0" + camelcase "^5.3.1" + chalk "^2.0.1" + jest-get-type "^24.9.0" + leven "^3.1.0" + pretty-format "^24.9.0" + +jest-watch-typeahead@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-0.4.0.tgz#4d5356839a85421588ce452d2440bf0d25308397" + integrity sha512-bJR/HPNgOQnkmttg1OkBIrYFAYuxFxExtgQh67N2qPvaWGVC8TCkedRNPKBfmZfVXFD3u2sCH+9OuS5ApBfCgA== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.1" + jest-watcher "^24.3.0" + slash "^3.0.0" + string-length "^3.1.0" + strip-ansi "^5.0.0" + +jest-watcher@^24.3.0, jest-watcher@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" + integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== + dependencies: + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + jest-util "^24.9.0" + string-length "^2.0.0" + +jest-worker@^24.6.0, jest-worker@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + +jest@24.9.0, jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" + integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== + dependencies: + import-local "^2.0.0" + jest-cli "^24.9.0" + +js-base64@^2.1.8: + version "2.5.1" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121" + integrity sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw== + +js-levenshtein@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +js-yaml@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +jsdom@^11.5.1: + version "11.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== + dependencies: + abab "^2.0.0" + acorn "^5.5.3" + acorn-globals "^4.1.0" + array-equal "^1.0.0" + cssom ">= 0.3.2 < 0.4.0" + cssstyle "^1.0.0" + data-urls "^1.0.0" + domexception "^1.0.1" + escodegen "^1.9.1" + html-encoding-sniffer "^1.0.2" + left-pad "^1.3.0" + nwsapi "^2.0.7" + parse5 "4.0.0" + pn "^1.1.0" + request "^2.87.0" + request-promise-native "^1.0.5" + sax "^1.2.4" + symbol-tree "^3.2.2" + tough-cookie "^2.3.4" + w3c-hr-time "^1.0.1" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.3" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.1" + ws "^5.2.0" + xml-name-validator "^3.0.0" + +jsdom@^14.0.0: + version "14.1.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-14.1.0.tgz#916463b6094956b0a6c1782c94e380cd30e1981b" + integrity sha512-O901mfJSuTdwU2w3Sn+74T+RnDVP+FuV5fH8tcPWyqrseRAb0s5xOtPgCFiPOtLcyK7CLIJwPyD83ZqQWvA5ng== + dependencies: + abab "^2.0.0" + acorn "^6.0.4" + acorn-globals "^4.3.0" + array-equal "^1.0.0" + cssom "^0.3.4" + cssstyle "^1.1.1" + data-urls "^1.1.0" + domexception "^1.0.1" + escodegen "^1.11.0" + html-encoding-sniffer "^1.0.2" + nwsapi "^2.1.3" + parse5 "5.1.0" + pn "^1.1.0" + request "^2.88.0" + request-promise-native "^1.0.5" + saxes "^3.1.9" + symbol-tree "^3.2.2" + tough-cookie "^2.5.0" + w3c-hr-time "^1.0.1" + w3c-xmlserializer "^1.1.2" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.5" + whatwg-mimetype "^2.3.0" + whatwg-url "^7.0.0" + ws "^6.1.2" + xml-name-validator "^3.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= + +json-bigint@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-0.3.0.tgz#0ccd912c4b8270d05f056fbd13814b53d3825b1e" + integrity sha1-DM2RLEuCcNBfBW+9E4FLU9OCWx4= + dependencies: + bignumber.js "^7.0.0" + +json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +json3@^3.3.2: + version "3.3.3" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" + integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA== + +json5@2.x, json5@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" + integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== + dependencies: + minimist "^1.2.0" + +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +jsx-ast-utils@^2.1.0, jsx-ast-utils@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz#4d4973ebf8b9d2837ee91a8208cc66f3a2776cfb" + integrity sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ== + dependencies: + array-includes "^3.0.3" + object.assign "^4.1.0" + +jwa@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a" + integrity sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^3.1.5: + version "3.2.2" + resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304" + integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA== + dependencies: + jwa "^1.4.1" + safe-buffer "^5.0.1" + +killable@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892" + integrity sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg== + +kind-of@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-2.0.1.tgz#018ec7a4ce7e3a86cb9141be519d24c8faa981b5" + integrity sha1-AY7HpM5+OobLkUG+UZ0kyPqpgbU= + dependencies: + is-buffer "^1.0.2" + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +kuler@1.0.x: + version "1.0.1" + resolved "https://registry.yarnpkg.com/kuler/-/kuler-1.0.1.tgz#ef7c784f36c9fb6e16dd3150d152677b2b0228a6" + integrity sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ== + dependencies: + colornames "^1.1.1" + +last-call-webpack-plugin@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz#9742df0e10e3cf46e5c0381c2de90d3a7a2d7555" + integrity sha512-7KI2l2GIZa9p2spzPIVZBYyNKkN+e/SQPpnjlTiPhdbDW3F86tdKKELxKpzJ5sgU19wQWsACULZmpTPYHeWO5w== + dependencies: + lodash "^4.17.5" + webpack-sources "^1.1.0" + +latest-version@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" + integrity sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU= + dependencies: + package-json "^4.0.0" + +lazy-cache@^0.2.3: + version "0.2.7" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-0.2.7.tgz#7feddf2dcb6edb77d11ef1d117ab5ffdf0ab1b65" + integrity sha1-f+3fLctu23fRHvHRF6tf/fCrG2U= + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + integrity sha1-odePw6UEdMuAhF07O24dpJpEbo4= + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= + dependencies: + invert-kv "^1.0.0" + +lcid@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" + integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== + dependencies: + invert-kv "^2.0.0" + +left-pad@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +libsodium-wrappers@^0.7.5: + version "0.7.6" + resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.6.tgz#baed4c16d4bf9610104875ad8a8e164d259d48fb" + integrity sha512-OUO2CWW5bHdLr6hkKLHIKI4raEkZrf3QHkhXsJ1yCh6MZ3JDA7jFD3kCATNquuGSG6MjjPHQIQms0y0gBDzjQg== + dependencies: + libsodium "0.7.6" + +libsodium@0.7.6: + version "0.7.6" + resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.6.tgz#018b80c5728054817845fbffa554274441bda277" + integrity sha512-hPb/04sEuLcTRdWDtd+xH3RXBihpmbPCsKW/Jtf4PsvdyKh+D6z2D2gvp/5BfoxseP+0FCOg66kE+0oGUE/loQ== + +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.0.0" + strip-bom "^3.0.0" + +loader-fs-cache@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/loader-fs-cache/-/loader-fs-cache-1.0.2.tgz#54cedf6b727e1779fd8f01205f05f6e88706f086" + integrity sha512-70IzT/0/L+M20jUlEqZhZyArTU6VKLRTYRDAYN26g4jfzpJqjipLL3/hgYpySqI9PwsVRHHFja0LfEmsx9X2Cw== + dependencies: + find-cache-dir "^0.1.1" + mkdirp "0.5.1" + +loader-runner@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" + integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== + +loader-utils@1.2.3, loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" + integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA== + dependencies: + big.js "^5.2.2" + emojis-list "^2.0.0" + json5 "^1.0.1" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +lodash._reinterpolate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" + integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= + +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= + +lodash.escaperegexp@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347" + integrity sha1-ZHYsSGGAglGKw99Mz11YhtriA0c= + +lodash.isplainobject@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs= + +lodash.isstring@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE= + +lodash.memoize@4.x, lodash.memoize@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= + +lodash.mergewith@^4.6.1: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55" + integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ== + +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= + +lodash.template@^4.4.0, lodash.template@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" + integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== + dependencies: + lodash._reinterpolate "^3.0.0" + lodash.templatesettings "^4.0.0" + +lodash.templatesettings@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33" + integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ== + dependencies: + lodash._reinterpolate "^3.0.0" + +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + +lodash.uniq@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" + integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= + +"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.5, lodash@^4.2.0, lodash@~4.17.10: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +logform@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/logform/-/logform-2.1.2.tgz#957155ebeb67a13164069825ce67ddb5bb2dd360" + integrity sha512-+lZh4OpERDBLqjiwDLpAWNQu6KMjnlXH2ByZwCuSqVPJletw0kTWJf5CgSNAUKn1KUkv3m2cUz/LK8zyEy7wzQ== + dependencies: + colors "^1.2.1" + fast-safe-stringify "^2.0.4" + fecha "^2.3.3" + ms "^2.1.1" + triple-beam "^1.3.0" + +loglevel@^1.4.1: + version "1.6.4" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.4.tgz#f408f4f006db8354d0577dcf6d33485b3cb90d56" + integrity sha512-p0b6mOGKcGa+7nnmKbpzR6qloPbrgLcnio++E+14Vo/XffOGwZtRpUhr8dTH/x2oCMmEoIU0Zwm3ZauhvYD17g== + +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +loud-rejection@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + integrity sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= + dependencies: + currently-unhandled "^0.4.1" + signal-exit "^3.0.0" + +lower-case@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" + integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= + +lowercase-keys@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" + integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== + +lru-cache@^4.0.1: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +lru-cache@^5.0.0, lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + +make-dir@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" + integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== + dependencies: + pify "^3.0.0" + +make-dir@^2.0.0, make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + +make-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.0.0.tgz#1b5f39f6b9270ed33f9f054c5c0f84304989f801" + integrity sha512-grNJDhb8b1Jm1qeqW5R/O63wUo4UXo2v2HMic6YT9i/HBlF93S8jkMgH7yugvY9ABDShH4VZMn8I+U8+fCNegw== + dependencies: + semver "^6.0.0" + +make-error@1.x, make-error@^1.1.1: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= + dependencies: + tmpl "1.0.x" + +mamacro@^0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" + integrity sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA== + +map-age-cleaner@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== + dependencies: + p-defer "^1.0.0" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-obj@^1.0.0, map-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +mdn-data@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.4.tgz#699b3c38ac6f1d728091a64650b65d388502fd5b" + integrity sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA== + +mdn-data@~1.1.0: + version "1.1.4" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-1.1.4.tgz#50b5d4ffc4575276573c4eedb8780812a8419f01" + integrity sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA== + +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= + +mem@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" + integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== + dependencies: + map-age-cleaner "^0.1.1" + mimic-fn "^2.0.0" + p-is-promise "^2.0.0" + +memoize-one@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.1.1.tgz#047b6e3199b508eaec03504de71229b8eb1d75c0" + integrity sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA== + +memory-fs@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" + integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= + dependencies: + errno "^0.1.3" + readable-stream "^2.0.1" + +memory-fs@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.5.0.tgz#324c01288b88652966d161db77838720845a8e3c" + integrity sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA== + dependencies: + errno "^0.1.3" + readable-stream "^2.0.1" + +meow@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" + integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= + dependencies: + camelcase-keys "^2.0.0" + decamelize "^1.1.2" + loud-rejection "^1.0.0" + map-obj "^1.0.1" + minimist "^1.1.3" + normalize-package-data "^2.3.4" + object-assign "^4.0.1" + read-pkg-up "^1.0.1" + redent "^1.0.0" + trim-newlines "^1.0.0" + +merge-anything@^2.2.4: + version "2.4.1" + resolved "https://registry.yarnpkg.com/merge-anything/-/merge-anything-2.4.1.tgz#e9bccaec1e49ec6cb5f77ca78c5770d1a35315e6" + integrity sha512-dYOIAl9GFCJNctSIHWOj9OJtarCjsD16P8ObCl6oxrujAG+kOvlwJuOD9/O9iYZ9aTi1RGpGTG9q9etIvuUikQ== + dependencies: + is-what "^3.3.1" + +merge-deep@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/merge-deep/-/merge-deep-3.0.2.tgz#f39fa100a4f1bd34ff29f7d2bf4508fbb8d83ad2" + integrity sha512-T7qC8kg4Zoti1cFd8Cr0M+qaZfOwjlPDEdZIIPPB2JZctjaPM4fX+i7HOId69tAti2fvO6X5ldfYUONDODsrkA== + dependencies: + arr-union "^3.1.0" + clone-deep "^0.2.4" + kind-of "^3.0.2" + +merge-descriptors@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.2.3: + version "1.3.0" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" + integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== + +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= + +microevent.ts@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/microevent.ts/-/microevent.ts-0.1.1.tgz#70b09b83f43df5172d0205a63025bce0f7357fa0" + integrity sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g== + +micromatch@^3.1.10, micromatch@^3.1.4: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +micromatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + +miller-rabin@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" + integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== + dependencies: + bn.js "^4.0.0" + brorand "^1.0.1" + +mime-db@1.40.0: + version "1.40.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" + integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== + +"mime-db@>= 1.40.0 < 2": + version "1.42.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" + integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== + +mime-types@^2.0.8, mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24: + version "2.1.24" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" + integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== + dependencies: + mime-db "1.40.0" + +mime@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +mime@^2.0.3, mime@^2.2.0, mime@^2.4.4: + version "2.4.4" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" + integrity sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +mimic-fn@^2.0.0, mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +mini-css-extract-plugin@0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz#81d41ec4fe58c713a96ad7c723cdb2d0bd4d70e1" + integrity sha512-MNpRGbNA52q6U92i0qbVpQNsgk7LExy41MdAlG84FeytfDOtRIf/mCHdEgG8rpTKOaNKiqUnZdlptF469hxqOw== + dependencies: + loader-utils "^1.1.0" + normalize-url "1.9.1" + schema-utils "^1.0.0" + webpack-sources "^1.1.0" + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + +minimatch@3.0.4, minimatch@^3.0.4, minimatch@~3.0.2: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= + +minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== + dependencies: + minipass "^2.9.0" + +mississippi@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" + integrity sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA== + dependencies: + concat-stream "^1.5.0" + duplexify "^3.4.2" + end-of-stream "^1.1.0" + flush-write-stream "^1.0.0" + from2 "^2.1.0" + parallel-transform "^1.1.0" + pump "^3.0.0" + pumpify "^1.3.3" + stream-each "^1.1.0" + through2 "^2.0.0" + +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mixin-object@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mixin-object/-/mixin-object-2.0.1.tgz#4fb949441dab182540f1fe035ba60e1947a5e57e" + integrity sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4= + dependencies: + for-in "^0.1.3" + is-extendable "^0.1.1" + +mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +"monaco-editor@npm:@ligolang/monaco-editor@0.18.1": + version "0.18.1" + resolved "https://registry.yarnpkg.com/@ligolang/monaco-editor/-/monaco-editor-0.18.1.tgz#b0e9522d2b5d6daa77448c867538ea46907fa16c" + integrity sha512-1JEjF5w7AbD8zqoak9Bf8RnGqGCU4OgcKn3hFHPhYQ2TrO+Ufv0Co0oU53pyv+QeGwSgEEQf5YhUqyyUAjG8Rg== + +move-concurrently@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" + integrity sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= + dependencies: + aproba "^1.1.1" + copy-concurrently "^1.0.0" + fs-write-stream-atomic "^1.0.8" + mkdirp "^0.5.1" + rimraf "^2.5.4" + run-queue "^1.0.3" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +multicast-dns-service-types@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz#899f11d9686e5e05cb91b35d5f0e63b773cfc901" + integrity sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE= + +multicast-dns@^6.0.1: + version "6.2.3" + resolved "https://registry.yarnpkg.com/multicast-dns/-/multicast-dns-6.2.3.tgz#a0ec7bd9055c4282f790c3c82f4e28db3b31b229" + integrity sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g== + dependencies: + dns-packet "^1.3.1" + thunky "^1.0.2" + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +nan@^2.12.1, nan@^2.13.2: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +needle@^2.2.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" + integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== + dependencies: + debug "^3.2.6" + iconv-lite "^0.4.4" + sax "^1.2.4" + +negotiator@0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" + integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== + +neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== + +next-tick@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +no-case@^2.2.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" + integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== + dependencies: + lower-case "^1.1.1" + +node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" + integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + +node-forge@0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" + integrity sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ== + +node-forge@^0.9.0: + version "0.9.1" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.1.tgz#775368e6846558ab6676858a4d8c6e8d16c677b5" + integrity sha512-G6RlQt5Sb4GMBzXvhfkeFmbqR6MzhtnT7VTHuLadjkii3rdYHNdw0m8zA4BTxVIh68FicCQ2NSUANpsqkr9jvQ== + +node-gyp@^3.8.0: + version "3.8.0" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.8.0.tgz#540304261c330e80d0d5edce253a68cb3964218c" + integrity sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA== + dependencies: + fstream "^1.0.0" + glob "^7.0.3" + graceful-fs "^4.1.2" + mkdirp "^0.5.0" + nopt "2 || 3" + npmlog "0 || 1 || 2 || 3 || 4" + osenv "0" + request "^2.87.0" + rimraf "2" + semver "~5.3.0" + tar "^2.0.0" + which "1" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-libs-browser@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425" + integrity sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q== + dependencies: + assert "^1.1.1" + browserify-zlib "^0.2.0" + buffer "^4.3.0" + console-browserify "^1.1.0" + constants-browserify "^1.0.0" + crypto-browserify "^3.11.0" + domain-browser "^1.1.1" + events "^3.0.0" + https-browserify "^1.0.0" + os-browserify "^0.3.0" + path-browserify "0.0.1" + process "^0.11.10" + punycode "^1.2.4" + querystring-es3 "^0.2.0" + readable-stream "^2.3.3" + stream-browserify "^2.0.1" + stream-http "^2.7.2" + string_decoder "^1.0.0" + timers-browserify "^2.0.4" + tty-browserify "0.0.0" + url "^0.11.0" + util "^0.11.0" + vm-browserify "^1.0.1" + +node-modules-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= + +node-notifier@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== + dependencies: + growly "^1.3.0" + is-wsl "^1.1.0" + semver "^5.5.0" + shellwords "^0.1.1" + which "^1.3.0" + +node-pre-gyp@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" + integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + +node-releases@^1.1.29: + version "1.1.35" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.35.tgz#32a74a3cd497aa77f23d509f483475fd160e4c48" + integrity sha512-JGcM/wndCN/2elJlU0IGdVEJQQnJwsLbgPCFd2pY7V0mxf17bZ0Gb/lgOtL29ZQhvEX5shnVhxQyZz3ex94N8w== + dependencies: + semver "^6.3.0" + +node-sass@^4.12.0: + version "4.12.0" + resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.12.0.tgz#0914f531932380114a30cc5fa4fa63233a25f017" + integrity sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ== + dependencies: + async-foreach "^0.1.3" + chalk "^1.1.1" + cross-spawn "^3.0.0" + gaze "^1.0.0" + get-stdin "^4.0.1" + glob "^7.0.3" + in-publish "^2.0.0" + lodash "^4.17.11" + meow "^3.7.0" + mkdirp "^0.5.1" + nan "^2.13.2" + node-gyp "^3.8.0" + npmlog "^4.0.0" + request "^2.88.0" + sass-graph "^2.2.4" + stdout-stream "^1.4.0" + "true-case-path" "^1.0.2" + +nodemon@^1.19.3: + version "1.19.3" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.19.3.tgz#db71b3e62aef2a8e1283a9fa00164237356102c0" + integrity sha512-TBNKRmJykEbxpTniZBusqRrUTHIEqa2fpecbTQDQj1Gxjth7kKAPP296ztR0o5gPUWsiYbuEbt73/+XMYab1+w== + dependencies: + chokidar "^2.1.5" + debug "^3.1.0" + ignore-by-default "^1.0.1" + minimatch "^3.0.4" + pstree.remy "^1.1.6" + semver "^5.5.0" + supports-color "^5.2.0" + touch "^3.1.0" + undefsafe "^2.0.2" + update-notifier "^2.5.0" + +"nopt@2 || 3": + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= + dependencies: + abbrev "1" + +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= + dependencies: + abbrev "1" + osenv "^0.1.4" + +nopt@~1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" + integrity sha1-bd0hvSoxQXuScn3Vhfim83YI6+4= + dependencies: + abbrev "1" + +normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +normalize-range@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" + integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI= + +normalize-url@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c" + integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw= + dependencies: + object-assign "^4.0.1" + prepend-http "^1.0.0" + query-string "^4.1.0" + sort-keys "^1.0.0" + +normalize-url@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" + integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== + +npm-bundled@^1.0.1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" + integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== + +npm-packlist@^1.1.6: + version "1.4.6" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.6.tgz#53ba3ed11f8523079f1457376dd379ee4ea42ff4" + integrity sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + dependencies: + path-key "^2.0.0" + +"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +nth-check@^1.0.2, nth-check@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" + integrity sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg== + dependencies: + boolbase "~1.0.0" + +num2fraction@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" + integrity sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4= + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +nwsapi@^2.0.7, nwsapi@^2.1.3: + version "2.1.4" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.4.tgz#e006a878db23636f8e8a67d33ca0e4edf61a842f" + integrity sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw== + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +object-assign@4.1.1, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-hash@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" + integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== + +object-inspect@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" + integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== + +object-is@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6" + integrity sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY= + +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object-path@0.11.4: + version "0.11.4" + resolved "https://registry.yarnpkg.com/object-path/-/object-path-0.11.4.tgz#370ae752fbf37de3ea70a861c23bba8915691949" + integrity sha1-NwrnUvvzfePqcKhhwju6iRVpGUk= + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.entries@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.0.tgz#2024fc6d6ba246aee38bdb0ffd5cfbcf371b7519" + integrity sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + +object.fromentries@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.1.tgz#050f077855c7af8ae6649f45c80b16ee2d31e704" + integrity sha512-PUQv8Hbg3j2QX0IQYv3iAGCbGcu4yY4KQ92/dhA4sFSixBmSmp13UpDLs6jGK8rBtbmhNNIK99LD2k293jpiGA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.15.0" + function-bind "^1.1.1" + has "^1.0.3" + +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +object.values@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.0.tgz#bf6810ef5da3e5325790eaaa2be213ea84624da9" + integrity sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + +obuf@^1.0.0, obuf@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" + integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== + +on-finished@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" + integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= + dependencies: + ee-first "1.1.1" + +on-headers@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" + integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +one-time@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/one-time/-/one-time-0.0.4.tgz#f8cdf77884826fe4dff93e3a9cc37b1e4480742e" + integrity sha1-+M33eISCb+Tf+T46nMN7HkSAdC4= + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + +open@^6.3.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9" + integrity sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg== + dependencies: + is-wsl "^1.1.0" + +opn@^5.1.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" + integrity sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA== + dependencies: + is-wsl "^1.1.0" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optimize-css-assets-webpack-plugin@5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.3.tgz#e2f1d4d94ad8c0af8967ebd7cf138dcb1ef14572" + integrity sha512-q9fbvCRS6EYtUKKSwI87qm2IxlyJK5b4dygW1rKUBT6mMDhdG5e5bZT63v6tnJR9F9FB/H5a0HTmtw+laUBxKA== + dependencies: + cssnano "^4.1.10" + last-call-webpack-plugin "^3.0.0" + +optionator@^0.8.1, optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +original@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/original/-/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f" + integrity sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg== + dependencies: + url-parse "^1.4.3" + +os-browserify@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" + integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= + +os-homedir@^1.0.0, os-homedir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= + dependencies: + lcid "^1.0.0" + +os-locale@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" + integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== + dependencies: + execa "^1.0.0" + lcid "^2.0.0" + mem "^4.0.0" + +os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +osenv@0, osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= + +p-each-series@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" + integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= + dependencies: + p-reduce "^1.0.0" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-is-promise@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + +p-limit@^2.0.0, p-limit@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" + integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== + dependencies: + p-try "^2.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-map@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== + +p-reduce@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" + integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +package-json@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" + integrity sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0= + dependencies: + got "^6.7.1" + registry-auth-token "^3.0.1" + registry-url "^3.0.3" + semver "^5.1.0" + +pako@~1.0.5: + version "1.0.10" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" + integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== + +parallel-transform@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.2.0.tgz#9049ca37d6cb2182c3b1d2c720be94d14a5814fc" + integrity sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg== + dependencies: + cyclist "^1.0.1" + inherits "^2.0.3" + readable-stream "^2.1.5" + +param-case@2.1.x: + version "2.1.1" + resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" + integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc= + dependencies: + no-case "^2.2.0" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-asn1@^5.0.0: + version "5.1.5" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e" + integrity sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ== + dependencies: + asn1.js "^4.0.0" + browserify-aes "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.0" + pbkdf2 "^3.0.3" + safe-buffer "^5.1.1" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= + dependencies: + error-ex "^1.2.0" + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +parse-passwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= + +parse5@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" + integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== + +parse5@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" + integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ== + +parseurl@~1.3.2, parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-browserify@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" + integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== + +path-dirname@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= + +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +path-to-regexp@0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= + dependencies: + pify "^2.0.0" + +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== + dependencies: + pify "^3.0.0" + +pbkdf2@^3.0.17, pbkdf2@^3.0.3, pbkdf2@^3.0.9: + version "3.0.17" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" + integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +pend@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +picomatch@^2.0.5: + version "2.0.7" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.0.7.tgz#514169d8c7cd0bdbeecc8a2609e34a7163de69f6" + integrity sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA== + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= + +pirates@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" + integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== + dependencies: + node-modules-regexp "^1.0.0" + +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + integrity sha1-ektQio1bstYp1EcFb/TpyTFM89Q= + dependencies: + find-up "^1.0.0" + +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= + dependencies: + find-up "^2.1.0" + +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +pkg-up@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" + integrity sha1-yBmscoBZpGHKscOImivjxJoATX8= + dependencies: + find-up "^2.1.0" + +pn@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== + +pnp-webpack-plugin@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.5.0.tgz#62a1cd3068f46d564bb33c56eb250e4d586676eb" + integrity sha512-jd9olUr9D7do+RN8Wspzhpxhgp1n6Vd0NtQ4SFkmIACZoEL1nkyAdW9Ygrinjec0vgDcWjscFQQ1gDW8rsfKTg== + dependencies: + ts-pnp "^1.1.2" + +polished@^1.9.3: + version "1.9.3" + resolved "https://registry.yarnpkg.com/polished/-/polished-1.9.3.tgz#d61b8a0c4624efe31e2583ff24a358932b6b75e1" + integrity sha512-4NmSD7fMFlM8roNxs7YXPv7UFRbYzb0gufR5zBxJLRzY54+zFsavxBo6zsQzP9ep6Hh3pC2pTyrpSTBEaB6IkQ== + +portfinder@^1.0.9: + version "1.0.24" + resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.24.tgz#11efbc6865f12f37624b6531ead1d809ed965cfa" + integrity sha512-ekRl7zD2qxYndYflwiryJwMioBI7LI7rVXg3EnLK3sjkouT5eOuhS3gS255XxBksa30VG8UPZYZCdgfGOfkSUg== + dependencies: + async "^1.5.2" + debug "^2.2.0" + mkdirp "0.5.x" + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +postcss-attribute-case-insensitive@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-attribute-case-insensitive/-/postcss-attribute-case-insensitive-4.0.1.tgz#b2a721a0d279c2f9103a36331c88981526428cc7" + integrity sha512-L2YKB3vF4PetdTIthQVeT+7YiSzMoNMLLYxPXXppOOP7NoazEAy45sh2LvJ8leCQjfBcfkYQs8TtCcQjeZTp8A== + dependencies: + postcss "^7.0.2" + postcss-selector-parser "^5.0.0" + +postcss-browser-comments@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postcss-browser-comments/-/postcss-browser-comments-2.0.0.tgz#dc48d6a8ddbff188a80a000b7393436cb18aed88" + integrity sha512-xGG0UvoxwBc4Yx4JX3gc0RuDl1kc4bVihCzzk6UC72YPfq5fu3c717Nu8Un3nvnq1BJ31gBnFXIG/OaUTnpHgA== + dependencies: + postcss "^7.0.2" + +postcss-calc@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-7.0.1.tgz#36d77bab023b0ecbb9789d84dcb23c4941145436" + integrity sha512-oXqx0m6tb4N3JGdmeMSc/i91KppbYsFZKdH0xMOqK8V1rJlzrKlTdokz8ozUXLVejydRN6u2IddxpcijRj2FqQ== + dependencies: + css-unit-converter "^1.1.1" + postcss "^7.0.5" + postcss-selector-parser "^5.0.0-rc.4" + postcss-value-parser "^3.3.1" + +postcss-color-functional-notation@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/postcss-color-functional-notation/-/postcss-color-functional-notation-2.0.1.tgz#5efd37a88fbabeb00a2966d1e53d98ced93f74e0" + integrity sha512-ZBARCypjEDofW4P6IdPVTLhDNXPRn8T2s1zHbZidW6rPaaZvcnCS2soYFIQJrMZSxiePJ2XIYTlcb2ztr/eT2g== + dependencies: + postcss "^7.0.2" + postcss-values-parser "^2.0.0" + +postcss-color-gray@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/postcss-color-gray/-/postcss-color-gray-5.0.0.tgz#532a31eb909f8da898ceffe296fdc1f864be8547" + integrity sha512-q6BuRnAGKM/ZRpfDascZlIZPjvwsRye7UDNalqVz3s7GDxMtqPY6+Q871liNxsonUw8oC61OG+PSaysYpl1bnw== + dependencies: + "@csstools/convert-colors" "^1.4.0" + postcss "^7.0.5" + postcss-values-parser "^2.0.0" + +postcss-color-hex-alpha@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/postcss-color-hex-alpha/-/postcss-color-hex-alpha-5.0.3.tgz#a8d9ca4c39d497c9661e374b9c51899ef0f87388" + integrity sha512-PF4GDel8q3kkreVXKLAGNpHKilXsZ6xuu+mOQMHWHLPNyjiUBOr75sp5ZKJfmv1MCus5/DWUGcK9hm6qHEnXYw== + dependencies: + postcss "^7.0.14" + postcss-values-parser "^2.0.1" + +postcss-color-mod-function@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/postcss-color-mod-function/-/postcss-color-mod-function-3.0.3.tgz#816ba145ac11cc3cb6baa905a75a49f903e4d31d" + integrity sha512-YP4VG+xufxaVtzV6ZmhEtc+/aTXH3d0JLpnYfxqTvwZPbJhWqp8bSY3nfNzNRFLgB4XSaBA82OE4VjOOKpCdVQ== + dependencies: + "@csstools/convert-colors" "^1.4.0" + postcss "^7.0.2" + postcss-values-parser "^2.0.0" + +postcss-color-rebeccapurple@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-color-rebeccapurple/-/postcss-color-rebeccapurple-4.0.1.tgz#c7a89be872bb74e45b1e3022bfe5748823e6de77" + integrity sha512-aAe3OhkS6qJXBbqzvZth2Au4V3KieR5sRQ4ptb2b2O8wgvB3SJBsdG+jsn2BZbbwekDG8nTfcCNKcSfe/lEy8g== + dependencies: + postcss "^7.0.2" + postcss-values-parser "^2.0.0" + +postcss-colormin@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-4.0.3.tgz#ae060bce93ed794ac71264f08132d550956bd381" + integrity sha512-WyQFAdDZpExQh32j0U0feWisZ0dmOtPl44qYmJKkq9xFWY3p+4qnRzCHeNrkeRhwPHz9bQ3mo0/yVkaply0MNw== + dependencies: + browserslist "^4.0.0" + color "^3.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-convert-values@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-convert-values/-/postcss-convert-values-4.0.1.tgz#ca3813ed4da0f812f9d43703584e449ebe189a7f" + integrity sha512-Kisdo1y77KUC0Jmn0OXU/COOJbzM8cImvw1ZFsBgBgMgb1iL23Zs/LXRe3r+EZqM3vGYKdQ2YJVQ5VkJI+zEJQ== + dependencies: + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-custom-media@^7.0.8: + version "7.0.8" + resolved "https://registry.yarnpkg.com/postcss-custom-media/-/postcss-custom-media-7.0.8.tgz#fffd13ffeffad73621be5f387076a28b00294e0c" + integrity sha512-c9s5iX0Ge15o00HKbuRuTqNndsJUbaXdiNsksnVH8H4gdc+zbLzr/UasOwNG6CTDpLFekVY4672eWdiiWu2GUg== + dependencies: + postcss "^7.0.14" + +postcss-custom-properties@^8.0.11: + version "8.0.11" + resolved "https://registry.yarnpkg.com/postcss-custom-properties/-/postcss-custom-properties-8.0.11.tgz#2d61772d6e92f22f5e0d52602df8fae46fa30d97" + integrity sha512-nm+o0eLdYqdnJ5abAJeXp4CEU1c1k+eB2yMCvhgzsds/e0umabFrN6HoTy/8Q4K5ilxERdl/JD1LO5ANoYBeMA== + dependencies: + postcss "^7.0.17" + postcss-values-parser "^2.0.1" + +postcss-custom-selectors@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/postcss-custom-selectors/-/postcss-custom-selectors-5.1.2.tgz#64858c6eb2ecff2fb41d0b28c9dd7b3db4de7fba" + integrity sha512-DSGDhqinCqXqlS4R7KGxL1OSycd1lydugJ1ky4iRXPHdBRiozyMHrdu0H3o7qNOCiZwySZTUI5MV0T8QhCLu+w== + dependencies: + postcss "^7.0.2" + postcss-selector-parser "^5.0.0-rc.3" + +postcss-dir-pseudo-class@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/postcss-dir-pseudo-class/-/postcss-dir-pseudo-class-5.0.0.tgz#6e3a4177d0edb3abcc85fdb6fbb1c26dabaeaba2" + integrity sha512-3pm4oq8HYWMZePJY+5ANriPs3P07q+LW6FAdTlkFH2XqDdP4HeeJYMOzn0HYLhRSjBO3fhiqSwwU9xEULSrPgw== + dependencies: + postcss "^7.0.2" + postcss-selector-parser "^5.0.0-rc.3" + +postcss-discard-comments@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-discard-comments/-/postcss-discard-comments-4.0.2.tgz#1fbabd2c246bff6aaad7997b2b0918f4d7af4033" + integrity sha512-RJutN259iuRf3IW7GZyLM5Sw4GLTOH8FmsXBnv8Ab/Tc2k4SR4qbV4DNbyyY4+Sjo362SyDmW2DQ7lBSChrpkg== + dependencies: + postcss "^7.0.0" + +postcss-discard-duplicates@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz#3fe133cd3c82282e550fc9b239176a9207b784eb" + integrity sha512-ZNQfR1gPNAiXZhgENFfEglF93pciw0WxMkJeVmw8eF+JZBbMD7jp6C67GqJAXVZP2BWbOztKfbsdmMp/k8c6oQ== + dependencies: + postcss "^7.0.0" + +postcss-discard-empty@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-empty/-/postcss-discard-empty-4.0.1.tgz#c8c951e9f73ed9428019458444a02ad90bb9f765" + integrity sha512-B9miTzbznhDjTfjvipfHoqbWKwd0Mj+/fL5s1QOz06wufguil+Xheo4XpOnc4NqKYBCNqqEzgPv2aPBIJLox0w== + dependencies: + postcss "^7.0.0" + +postcss-discard-overridden@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-4.0.1.tgz#652aef8a96726f029f5e3e00146ee7a4e755ff57" + integrity sha512-IYY2bEDD7g1XM1IDEsUT4//iEYCxAmP5oDSFMVU/JVvT7gh+l4fmjciLqGgwjdWpQIdb0Che2VX00QObS5+cTg== + dependencies: + postcss "^7.0.0" + +postcss-double-position-gradients@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/postcss-double-position-gradients/-/postcss-double-position-gradients-1.0.0.tgz#fc927d52fddc896cb3a2812ebc5df147e110522e" + integrity sha512-G+nV8EnQq25fOI8CH/B6krEohGWnF5+3A6H/+JEpOncu5dCnkS1QQ6+ct3Jkaepw1NGVqqOZH6lqrm244mCftA== + dependencies: + postcss "^7.0.5" + postcss-values-parser "^2.0.0" + +postcss-env-function@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/postcss-env-function/-/postcss-env-function-2.0.2.tgz#0f3e3d3c57f094a92c2baf4b6241f0b0da5365d7" + integrity sha512-rwac4BuZlITeUbiBq60h/xbLzXY43qOsIErngWa4l7Mt+RaSkT7QBjXVGTcBHupykkblHMDrBFh30zchYPaOUw== + dependencies: + postcss "^7.0.2" + postcss-values-parser "^2.0.0" + +postcss-flexbugs-fixes@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/postcss-flexbugs-fixes/-/postcss-flexbugs-fixes-4.1.0.tgz#e094a9df1783e2200b7b19f875dcad3b3aff8b20" + integrity sha512-jr1LHxQvStNNAHlgco6PzY308zvLklh7SJVYuWUwyUQncofaAlD2l+P/gxKHOdqWKe7xJSkVLFF/2Tp+JqMSZA== + dependencies: + postcss "^7.0.0" + +postcss-focus-visible@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-focus-visible/-/postcss-focus-visible-4.0.0.tgz#477d107113ade6024b14128317ade2bd1e17046e" + integrity sha512-Z5CkWBw0+idJHSV6+Bgf2peDOFf/x4o+vX/pwcNYrWpXFrSfTkQ3JQ1ojrq9yS+upnAlNRHeg8uEwFTgorjI8g== + dependencies: + postcss "^7.0.2" + +postcss-focus-within@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-focus-within/-/postcss-focus-within-3.0.0.tgz#763b8788596cee9b874c999201cdde80659ef680" + integrity sha512-W0APui8jQeBKbCGZudW37EeMCjDeVxKgiYfIIEo8Bdh5SpB9sxds/Iq8SEuzS0Q4YFOlG7EPFulbbxujpkrV2w== + dependencies: + postcss "^7.0.2" + +postcss-font-variant@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-font-variant/-/postcss-font-variant-4.0.0.tgz#71dd3c6c10a0d846c5eda07803439617bbbabacc" + integrity sha512-M8BFYKOvCrI2aITzDad7kWuXXTm0YhGdP9Q8HanmN4EF1Hmcgs1KK5rSHylt/lUJe8yLxiSwWAHdScoEiIxztg== + dependencies: + postcss "^7.0.2" + +postcss-gap-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postcss-gap-properties/-/postcss-gap-properties-2.0.0.tgz#431c192ab3ed96a3c3d09f2ff615960f902c1715" + integrity sha512-QZSqDaMgXCHuHTEzMsS2KfVDOq7ZFiknSpkrPJY6jmxbugUPTuSzs/vuE5I3zv0WAS+3vhrlqhijiprnuQfzmg== + dependencies: + postcss "^7.0.2" + +postcss-image-set-function@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/postcss-image-set-function/-/postcss-image-set-function-3.0.1.tgz#28920a2f29945bed4c3198d7df6496d410d3f288" + integrity sha512-oPTcFFip5LZy8Y/whto91L9xdRHCWEMs3e1MdJxhgt4jy2WYXfhkng59fH5qLXSCPN8k4n94p1Czrfe5IOkKUw== + dependencies: + postcss "^7.0.2" + postcss-values-parser "^2.0.0" + +postcss-initial@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/postcss-initial/-/postcss-initial-3.0.1.tgz#99d319669a13d6c06ef8e70d852f68cb1b399b61" + integrity sha512-I2Sz83ZSHybMNh02xQDK609lZ1/QOyYeuizCjzEhlMgeV/HcDJapQiH4yTqLjZss0X6/6VvKFXUeObaHpJoINw== + dependencies: + lodash.template "^4.5.0" + postcss "^7.0.2" + +postcss-lab-function@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/postcss-lab-function/-/postcss-lab-function-2.0.1.tgz#bb51a6856cd12289ab4ae20db1e3821ef13d7d2e" + integrity sha512-whLy1IeZKY+3fYdqQFuDBf8Auw+qFuVnChWjmxm/UhHWqNHZx+B99EwxTvGYmUBqe3Fjxs4L1BoZTJmPu6usVg== + dependencies: + "@csstools/convert-colors" "^1.4.0" + postcss "^7.0.2" + postcss-values-parser "^2.0.0" + +postcss-load-config@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-2.1.0.tgz#c84d692b7bb7b41ddced94ee62e8ab31b417b003" + integrity sha512-4pV3JJVPLd5+RueiVVB+gFOAa7GWc25XQcMp86Zexzke69mKf6Nx9LRcQywdz7yZI9n1udOxmLuAwTBypypF8Q== + dependencies: + cosmiconfig "^5.0.0" + import-cwd "^2.0.0" + +postcss-loader@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-3.0.0.tgz#6b97943e47c72d845fa9e03f273773d4e8dd6c2d" + integrity sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA== + dependencies: + loader-utils "^1.1.0" + postcss "^7.0.0" + postcss-load-config "^2.0.0" + schema-utils "^1.0.0" + +postcss-logical@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-logical/-/postcss-logical-3.0.0.tgz#2495d0f8b82e9f262725f75f9401b34e7b45d5b5" + integrity sha512-1SUKdJc2vuMOmeItqGuNaC+N8MzBWFWEkAnRnLpFYj1tGGa7NqyVBujfRtgNa2gXR+6RkGUiB2O5Vmh7E2RmiA== + dependencies: + postcss "^7.0.2" + +postcss-media-minmax@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-media-minmax/-/postcss-media-minmax-4.0.0.tgz#b75bb6cbc217c8ac49433e12f22048814a4f5ed5" + integrity sha512-fo9moya6qyxsjbFAYl97qKO9gyre3qvbMnkOZeZwlsW6XYFsvs2DMGDlchVLfAd8LHPZDxivu/+qW2SMQeTHBw== + dependencies: + postcss "^7.0.2" + +postcss-merge-longhand@^4.0.11: + version "4.0.11" + resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-4.0.11.tgz#62f49a13e4a0ee04e7b98f42bb16062ca2549e24" + integrity sha512-alx/zmoeXvJjp7L4mxEMjh8lxVlDFX1gqWHzaaQewwMZiVhLo42TEClKaeHbRf6J7j82ZOdTJ808RtN0ZOZwvw== + dependencies: + css-color-names "0.0.4" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + stylehacks "^4.0.0" + +postcss-merge-rules@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-4.0.3.tgz#362bea4ff5a1f98e4075a713c6cb25aefef9a650" + integrity sha512-U7e3r1SbvYzO0Jr3UT/zKBVgYYyhAz0aitvGIYOYK5CPmkNih+WDSsS5tvPrJ8YMQYlEMvsZIiqmn7HdFUaeEQ== + dependencies: + browserslist "^4.0.0" + caniuse-api "^3.0.0" + cssnano-util-same-parent "^4.0.0" + postcss "^7.0.0" + postcss-selector-parser "^3.0.0" + vendors "^1.0.0" + +postcss-minify-font-values@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-font-values/-/postcss-minify-font-values-4.0.2.tgz#cd4c344cce474343fac5d82206ab2cbcb8afd5a6" + integrity sha512-j85oO6OnRU9zPf04+PZv1LYIYOprWm6IA6zkXkrJXyRveDEuQggG6tvoy8ir8ZwjLxLuGfNkCZEQG7zan+Hbtg== + dependencies: + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-minify-gradients@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-4.0.2.tgz#93b29c2ff5099c535eecda56c4aa6e665a663471" + integrity sha512-qKPfwlONdcf/AndP1U8SJ/uzIJtowHlMaSioKzebAXSG4iJthlWC9iSWznQcX4f66gIWX44RSA841HTHj3wK+Q== + dependencies: + cssnano-util-get-arguments "^4.0.0" + is-color-stop "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-minify-params@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz#6b9cef030c11e35261f95f618c90036d680db874" + integrity sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhPet/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg== + dependencies: + alphanum-sort "^1.0.0" + browserslist "^4.0.0" + cssnano-util-get-arguments "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + uniqs "^2.0.0" + +postcss-minify-selectors@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-selectors/-/postcss-minify-selectors-4.0.2.tgz#e2e5eb40bfee500d0cd9243500f5f8ea4262fbd8" + integrity sha512-D5S1iViljXBj9kflQo4YutWnJmwm8VvIsU1GeXJGiG9j8CIg9zs4voPMdQDUmIxetUOh60VilsNzCiAFTOqu3g== + dependencies: + alphanum-sort "^1.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-selector-parser "^3.0.0" + +postcss-modules-extract-imports@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz#818719a1ae1da325f9832446b01136eeb493cd7e" + integrity sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ== + dependencies: + postcss "^7.0.5" + +postcss-modules-local-by-default@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-2.0.6.tgz#dd9953f6dd476b5fd1ef2d8830c8929760b56e63" + integrity sha512-oLUV5YNkeIBa0yQl7EYnxMgy4N6noxmiwZStaEJUSe2xPMcdNc8WmBQuQCx18H5psYbVxz8zoHk0RAAYZXP9gA== + dependencies: + postcss "^7.0.6" + postcss-selector-parser "^6.0.0" + postcss-value-parser "^3.3.1" + +postcss-modules-scope@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.1.0.tgz#ad3f5bf7856114f6fcab901b0502e2a2bc39d4eb" + integrity sha512-91Rjps0JnmtUB0cujlc8KIKCsJXWjzuxGeT/+Q2i2HXKZ7nBUeF9YQTZZTNvHVoNYj1AthsjnGLtqDUE0Op79A== + dependencies: + postcss "^7.0.6" + postcss-selector-parser "^6.0.0" + +postcss-modules-values@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-2.0.0.tgz#479b46dc0c5ca3dc7fa5270851836b9ec7152f64" + integrity sha512-Ki7JZa7ff1N3EIMlPnGTZfUMe69FFwiQPnVSXC9mnn3jozCRBYIxiZd44yJOV2AmabOo4qFf8s0dC/+lweG7+w== + dependencies: + icss-replace-symbols "^1.1.0" + postcss "^7.0.6" + +postcss-nesting@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/postcss-nesting/-/postcss-nesting-7.0.1.tgz#b50ad7b7f0173e5b5e3880c3501344703e04c052" + integrity sha512-FrorPb0H3nuVq0Sff7W2rnc3SmIcruVC6YwpcS+k687VxyxO33iE1amna7wHuRVzM8vfiYofXSBHNAZ3QhLvYg== + dependencies: + postcss "^7.0.2" + +postcss-normalize-charset@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-charset/-/postcss-normalize-charset-4.0.1.tgz#8b35add3aee83a136b0471e0d59be58a50285dd4" + integrity sha512-gMXCrrlWh6G27U0hF3vNvR3w8I1s2wOBILvA87iNXaPvSNo5uZAMYsZG7XjCUf1eVxuPfyL4TJ7++SGZLc9A3g== + dependencies: + postcss "^7.0.0" + +postcss-normalize-display-values@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.2.tgz#0dbe04a4ce9063d4667ed2be476bb830c825935a" + integrity sha512-3F2jcsaMW7+VtRMAqf/3m4cPFhPD3EFRgNs18u+k3lTJJlVe7d0YPO+bnwqo2xg8YiRpDXJI2u8A0wqJxMsQuQ== + dependencies: + cssnano-util-get-match "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-positions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-positions/-/postcss-normalize-positions-4.0.2.tgz#05f757f84f260437378368a91f8932d4b102917f" + integrity sha512-Dlf3/9AxpxE+NF1fJxYDeggi5WwV35MXGFnnoccP/9qDtFrTArZ0D0R+iKcg5WsUd8nUYMIl8yXDCtcrT8JrdA== + dependencies: + cssnano-util-get-arguments "^4.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-repeat-style@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.2.tgz#c4ebbc289f3991a028d44751cbdd11918b17910c" + integrity sha512-qvigdYYMpSuoFs3Is/f5nHdRLJN/ITA7huIoCyqqENJe9PvPmLhNLMu7QTjPdtnVf6OcYYO5SHonx4+fbJE1+Q== + dependencies: + cssnano-util-get-arguments "^4.0.0" + cssnano-util-get-match "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-string@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-string/-/postcss-normalize-string-4.0.2.tgz#cd44c40ab07a0c7a36dc5e99aace1eca4ec2690c" + integrity sha512-RrERod97Dnwqq49WNz8qo66ps0swYZDSb6rM57kN2J+aoyEAJfZ6bMx0sx/F9TIEX0xthPGCmeyiam/jXif0eA== + dependencies: + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-timing-functions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.2.tgz#8e009ca2a3949cdaf8ad23e6b6ab99cb5e7d28d9" + integrity sha512-acwJY95edP762e++00Ehq9L4sZCEcOPyaHwoaFOhIwWCDfik6YvqsYNxckee65JHLKzuNSSmAdxwD2Cud1Z54A== + dependencies: + cssnano-util-get-match "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-unicode@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.1.tgz#841bd48fdcf3019ad4baa7493a3d363b52ae1cfb" + integrity sha512-od18Uq2wCYn+vZ/qCOeutvHjB5jm57ToxRaMeNuf0nWVHaP9Hua56QyMF6fs/4FSUnVIw0CBPsU0K4LnBPwYwg== + dependencies: + browserslist "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-url@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-url/-/postcss-normalize-url-4.0.1.tgz#10e437f86bc7c7e58f7b9652ed878daaa95faae1" + integrity sha512-p5oVaF4+IHwu7VpMan/SSpmpYxcJMtkGppYf0VbdH5B6hN8YNmVyJLuY9FmLQTzY3fag5ESUUHDqM+heid0UVA== + dependencies: + is-absolute-url "^2.0.0" + normalize-url "^3.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-whitespace@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.2.tgz#bf1d4070fe4fcea87d1348e825d8cc0c5faa7d82" + integrity sha512-tO8QIgrsI3p95r8fyqKV+ufKlSHh9hMJqACqbv2XknufqEDhDvbguXGBBqxw9nsQoXWf0qOqppziKJKHMD4GtA== + dependencies: + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize/-/postcss-normalize-7.0.1.tgz#eb51568d962b8aa61a8318383c8bb7e54332282e" + integrity sha512-NOp1fwrG+6kVXWo7P9SizCHX6QvioxFD/hZcI2MLxPmVnFJFC0j0DDpIuNw2tUDeCFMni59gCVgeJ1/hYhj2OQ== + dependencies: + "@csstools/normalize.css" "^9.0.1" + browserslist "^4.1.1" + postcss "^7.0.2" + postcss-browser-comments "^2.0.0" + +postcss-ordered-values@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/postcss-ordered-values/-/postcss-ordered-values-4.1.2.tgz#0cf75c820ec7d5c4d280189559e0b571ebac0eee" + integrity sha512-2fCObh5UanxvSxeXrtLtlwVThBvHn6MQcu4ksNT2tsaV2Fg76R2CV98W7wNSlX+5/pFwEyaDwKLLoEV7uRybAw== + dependencies: + cssnano-util-get-arguments "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-overflow-shorthand@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postcss-overflow-shorthand/-/postcss-overflow-shorthand-2.0.0.tgz#31ecf350e9c6f6ddc250a78f0c3e111f32dd4c30" + integrity sha512-aK0fHc9CBNx8jbzMYhshZcEv8LtYnBIRYQD5i7w/K/wS9c2+0NSR6B3OVMu5y0hBHYLcMGjfU+dmWYNKH0I85g== + dependencies: + postcss "^7.0.2" + +postcss-page-break@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postcss-page-break/-/postcss-page-break-2.0.0.tgz#add52d0e0a528cabe6afee8b46e2abb277df46bf" + integrity sha512-tkpTSrLpfLfD9HvgOlJuigLuk39wVTbbd8RKcy8/ugV2bNBUW3xU+AIqyxhDrQr1VUj1RmyJrBn1YWrqUm9zAQ== + dependencies: + postcss "^7.0.2" + +postcss-place@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-place/-/postcss-place-4.0.1.tgz#e9f39d33d2dc584e46ee1db45adb77ca9d1dcc62" + integrity sha512-Zb6byCSLkgRKLODj/5mQugyuj9bvAAw9LqJJjgwz5cYryGeXfFZfSXoP1UfveccFmeq0b/2xxwcTEVScnqGxBg== + dependencies: + postcss "^7.0.2" + postcss-values-parser "^2.0.0" + +postcss-preset-env@6.7.0: + version "6.7.0" + resolved "https://registry.yarnpkg.com/postcss-preset-env/-/postcss-preset-env-6.7.0.tgz#c34ddacf8f902383b35ad1e030f178f4cdf118a5" + integrity sha512-eU4/K5xzSFwUFJ8hTdTQzo2RBLbDVt83QZrAvI07TULOkmyQlnYlpwep+2yIK+K+0KlZO4BvFcleOCCcUtwchg== + dependencies: + autoprefixer "^9.6.1" + browserslist "^4.6.4" + caniuse-lite "^1.0.30000981" + css-blank-pseudo "^0.1.4" + css-has-pseudo "^0.10.0" + css-prefers-color-scheme "^3.1.1" + cssdb "^4.4.0" + postcss "^7.0.17" + postcss-attribute-case-insensitive "^4.0.1" + postcss-color-functional-notation "^2.0.1" + postcss-color-gray "^5.0.0" + postcss-color-hex-alpha "^5.0.3" + postcss-color-mod-function "^3.0.3" + postcss-color-rebeccapurple "^4.0.1" + postcss-custom-media "^7.0.8" + postcss-custom-properties "^8.0.11" + postcss-custom-selectors "^5.1.2" + postcss-dir-pseudo-class "^5.0.0" + postcss-double-position-gradients "^1.0.0" + postcss-env-function "^2.0.2" + postcss-focus-visible "^4.0.0" + postcss-focus-within "^3.0.0" + postcss-font-variant "^4.0.0" + postcss-gap-properties "^2.0.0" + postcss-image-set-function "^3.0.1" + postcss-initial "^3.0.0" + postcss-lab-function "^2.0.1" + postcss-logical "^3.0.0" + postcss-media-minmax "^4.0.0" + postcss-nesting "^7.0.0" + postcss-overflow-shorthand "^2.0.0" + postcss-page-break "^2.0.0" + postcss-place "^4.0.1" + postcss-pseudo-class-any-link "^6.0.0" + postcss-replace-overflow-wrap "^3.0.0" + postcss-selector-matches "^4.0.0" + postcss-selector-not "^4.0.0" + +postcss-pseudo-class-any-link@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/postcss-pseudo-class-any-link/-/postcss-pseudo-class-any-link-6.0.0.tgz#2ed3eed393b3702879dec4a87032b210daeb04d1" + integrity sha512-lgXW9sYJdLqtmw23otOzrtbDXofUdfYzNm4PIpNE322/swES3VU9XlXHeJS46zT2onFO7V1QFdD4Q9LiZj8mew== + dependencies: + postcss "^7.0.2" + postcss-selector-parser "^5.0.0-rc.3" + +postcss-reduce-initial@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-4.0.3.tgz#7fd42ebea5e9c814609639e2c2e84ae270ba48df" + integrity sha512-gKWmR5aUulSjbzOfD9AlJiHCGH6AEVLaM0AV+aSioxUDd16qXP1PCh8d1/BGVvpdWn8k/HiK7n6TjeoXN1F7DA== + dependencies: + browserslist "^4.0.0" + caniuse-api "^3.0.0" + has "^1.0.0" + postcss "^7.0.0" + +postcss-reduce-transforms@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.2.tgz#17efa405eacc6e07be3414a5ca2d1074681d4e29" + integrity sha512-EEVig1Q2QJ4ELpJXMZR8Vt5DQx8/mo+dGWSR7vWXqcob2gQLyQGsionYcGKATXvQzMPn6DSN1vTN7yFximdIAg== + dependencies: + cssnano-util-get-match "^4.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-replace-overflow-wrap@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-replace-overflow-wrap/-/postcss-replace-overflow-wrap-3.0.0.tgz#61b360ffdaedca84c7c918d2b0f0d0ea559ab01c" + integrity sha512-2T5hcEHArDT6X9+9dVSPQdo7QHzG4XKclFT8rU5TzJPDN7RIRTbO9c4drUISOVemLj03aezStHCR2AIcr8XLpw== + dependencies: + postcss "^7.0.2" + +postcss-safe-parser@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-safe-parser/-/postcss-safe-parser-4.0.1.tgz#8756d9e4c36fdce2c72b091bbc8ca176ab1fcdea" + integrity sha512-xZsFA3uX8MO3yAda03QrG3/Eg1LN3EPfjjf07vke/46HERLZyHrTsQ9E1r1w1W//fWEhtYNndo2hQplN2cVpCQ== + dependencies: + postcss "^7.0.0" + +postcss-selector-matches@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-selector-matches/-/postcss-selector-matches-4.0.0.tgz#71c8248f917ba2cc93037c9637ee09c64436fcff" + integrity sha512-LgsHwQR/EsRYSqlwdGzeaPKVT0Ml7LAT6E75T8W8xLJY62CE4S/l03BWIt3jT8Taq22kXP08s2SfTSzaraoPww== + dependencies: + balanced-match "^1.0.0" + postcss "^7.0.2" + +postcss-selector-not@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-selector-not/-/postcss-selector-not-4.0.0.tgz#c68ff7ba96527499e832724a2674d65603b645c0" + integrity sha512-W+bkBZRhqJaYN8XAnbbZPLWMvZD1wKTu0UxtFKdhtGjWYmxhkUneoeOhRJKdAE5V7ZTlnbHfCR+6bNwK9e1dTQ== + dependencies: + balanced-match "^1.0.0" + postcss "^7.0.2" + +postcss-selector-parser@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz#4f875f4afb0c96573d5cf4d74011aee250a7e865" + integrity sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU= + dependencies: + dot-prop "^4.1.1" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss-selector-parser@^5.0.0, postcss-selector-parser@^5.0.0-rc.3, postcss-selector-parser@^5.0.0-rc.4: + version "5.0.0" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz#249044356697b33b64f1a8f7c80922dddee7195c" + integrity sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ== + dependencies: + cssesc "^2.0.0" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss-selector-parser@^6.0.0: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c" + integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg== + dependencies: + cssesc "^3.0.0" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss-svgo@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-4.0.2.tgz#17b997bc711b333bab143aaed3b8d3d6e3d38258" + integrity sha512-C6wyjo3VwFm0QgBy+Fu7gCYOkCmgmClghO+pjcxvrcBKtiKt0uCF+hvbMO1fyv5BMImRK90SMb+dwUnfbGd+jw== + dependencies: + is-svg "^3.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + svgo "^1.0.0" + +postcss-unique-selectors@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-unique-selectors/-/postcss-unique-selectors-4.0.1.tgz#9446911f3289bfd64c6d680f073c03b1f9ee4bac" + integrity sha512-+JanVaryLo9QwZjKrmJgkI4Fn8SBgRO6WXQBJi7KiAVPlmxikB5Jzc4EvXMT2H0/m0RjrVVm9rGNhZddm/8Spg== + dependencies: + alphanum-sort "^1.0.0" + postcss "^7.0.0" + uniqs "^2.0.0" + +postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.0, postcss-value-parser@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" + integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== + +postcss-value-parser@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz#482282c09a42706d1fc9a069b73f44ec08391dc9" + integrity sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ== + +postcss-values-parser@^2.0.0, postcss-values-parser@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/postcss-values-parser/-/postcss-values-parser-2.0.1.tgz#da8b472d901da1e205b47bdc98637b9e9e550e5f" + integrity sha512-2tLuBsA6P4rYTNKCXYG/71C7j1pU6pK503suYOmn4xYrQIzW+opD+7FAFNuGSdZC/3Qfy334QbeMu7MEb8gOxg== + dependencies: + flatten "^1.0.2" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss@7.0.14: + version "7.0.14" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.14.tgz#4527ed6b1ca0d82c53ce5ec1a2041c2346bbd6e5" + integrity sha512-NsbD6XUUMZvBxtQAJuWDJeeC4QFsmWsfozWxCJPWf3M55K9iu2iMDaKqyoOdTJ1R4usBXuxlVFAIo8rZPQD4Bg== + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.18, postcss@^7.0.2, postcss@^7.0.5, postcss@^7.0.6: + version "7.0.18" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.18.tgz#4b9cda95ae6c069c67a4d933029eddd4838ac233" + integrity sha512-/7g1QXXgegpF+9GJj4iN7ChGF40sYuGYJ8WZu8DZWnmhQ/G36hfdk3q9LBJmoK+lZ+yzZ5KYpOoxq7LF1BxE8g== + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +prepend-http@^1.0.0, prepend-http@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" + integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= + +pretty-bytes@^5.1.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.3.0.tgz#f2849e27db79fb4d6cfe24764fc4134f165989f2" + integrity sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg== + +pretty-error@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3" + integrity sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM= + dependencies: + renderkid "^2.0.1" + utila "~0.4" + +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== + dependencies: + "@jest/types" "^24.9.0" + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + react-is "^16.8.4" + +private@^0.1.6: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= + +progress@^2.0.0, progress@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + +promise-inflight@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" + integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= + +promise@8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/promise/-/promise-8.0.3.tgz#f592e099c6cddc000d538ee7283bb190452b0bf6" + integrity sha512-HeRDUL1RJiLhyA0/grn+PTShlBAcLuh/1BJGtrvjwbvRDCTLLMEz9rOGCV+R3vHY4MixIuoMEd9Yq/XvsTPcjw== + dependencies: + asap "~2.0.6" + +prompts@^2.0.1, prompts@^2.1.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.2.1.tgz#f901dd2a2dfee080359c0e20059b24188d75ad35" + integrity sha512-VObPvJiWPhpZI6C5m60XOzTfnYg/xc/an+r9VYymj9WJW3B/DIH+REzjpAACPf8brwPeP+7vz3bIim3S+AaMjw== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.3" + +prop-types-exact@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/prop-types-exact/-/prop-types-exact-1.2.0.tgz#825d6be46094663848237e3925a98c6e944e9869" + integrity sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA== + dependencies: + has "^1.0.3" + object.assign "^4.1.0" + reflect.ownkeys "^0.2.0" + +prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.7, prop-types@^15.6.2, prop-types@^15.7.2: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + +proxy-addr@~2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" + integrity sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ== + dependencies: + forwarded "~0.1.2" + ipaddr.js "1.9.0" + +proxy-from-env@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" + integrity sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4= + +prr@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + +psl@^1.1.24, psl@^1.1.28: + version "1.4.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" + integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== + +pstree.remy@^1.1.6: + version "1.1.7" + resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.7.tgz#c76963a28047ed61542dc361aa26ee55a7fa15f3" + integrity sha512-xsMgrUwRpuGskEzBFkH8NmTimbZ5PcPup0LA8JJkHIm2IMUbQcpo3yeLNWVrufEYjh8YwtSVh0xz6UeWc5Oh5A== + +public-encrypt@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" + integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== + dependencies: + bn.js "^4.1.0" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + parse-asn1 "^5.0.0" + randombytes "^2.0.1" + safe-buffer "^5.1.2" + +pump@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" + integrity sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +pumpify@^1.3.3: + version "1.5.1" + resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" + integrity sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ== + dependencies: + duplexify "^3.6.0" + inherits "^2.0.3" + pump "^2.0.0" + +pumpify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-2.0.1.tgz#abfc7b5a621307c728b551decbbefb51f0e4aa1e" + integrity sha512-m7KOje7jZxrmutanlkS1daj1dS6z6BgslzOXmcSEpIlCxM3VJH7lG5QLeck/6hgF6F4crFf01UtQmNsJfweTAw== + dependencies: + duplexify "^4.1.1" + inherits "^2.0.3" + pump "^3.0.0" + +punycode@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= + +punycode@^1.2.4, punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +puppeteer@^1.20.0: + version "1.20.0" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.20.0.tgz#e3d267786f74e1d87cf2d15acc59177f471bbe38" + integrity sha512-bt48RDBy2eIwZPrkgbcwHtb51mj2nKvHOPMaSH2IsWiv7lOG9k9zhaRzpDZafrk05ajMc3cu+lSQYYOfH2DkVQ== + dependencies: + debug "^4.1.0" + extract-zip "^1.6.6" + https-proxy-agent "^2.2.1" + mime "^2.0.3" + progress "^2.0.1" + proxy-from-env "^1.0.0" + rimraf "^2.6.1" + ws "^6.1.0" + +q@^1.1.2: + version "1.5.1" + resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" + integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= + +qs@6.7.0: + version "6.7.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" + integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +query-string@^4.1.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" + integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s= + dependencies: + object-assign "^4.1.0" + strict-uri-encode "^1.0.0" + +querystring-es3@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" + integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= + +querystring@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= + +querystringify@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" + integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== + +raf@3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" + integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA== + dependencies: + performance-now "^2.1.0" + +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +randomfill@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" + integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== + dependencies: + randombytes "^2.0.5" + safe-buffer "^5.1.0" + +range-parser@^1.2.1, range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +raw-body@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" + integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== + dependencies: + bytes "3.1.0" + http-errors "1.7.2" + iconv-lite "0.4.24" + unpipe "1.0.0" + +rc@^1.0.1, rc@^1.1.6, rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +react-app-polyfill@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.4.tgz#4dd2636846b585c2d842b1e44e1bc29044345874" + integrity sha512-5Vte6ki7jpNsNCUKaboyofAhmURmCn2Y6Hu7ydJ6Iu4dct1CIGoh/1FT7gUZKAbowVX2lxVPlijvp1nKxfAl4w== + dependencies: + core-js "3.2.1" + object-assign "4.1.1" + promise "8.0.3" + raf "3.4.1" + regenerator-runtime "0.13.3" + whatwg-fetch "3.0.0" + +react-dev-utils@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-9.1.0.tgz#3ad2bb8848a32319d760d0a84c56c14bdaae5e81" + integrity sha512-X2KYF/lIGyGwP/F/oXgGDF24nxDA2KC4b7AFto+eqzc/t838gpSGiaU8trTqHXOohuLxxc5qi1eDzsl9ucPDpg== + dependencies: + "@babel/code-frame" "7.5.5" + address "1.1.2" + browserslist "4.7.0" + chalk "2.4.2" + cross-spawn "6.0.5" + detect-port-alt "1.1.6" + escape-string-regexp "1.0.5" + filesize "3.6.1" + find-up "3.0.0" + fork-ts-checker-webpack-plugin "1.5.0" + global-modules "2.0.0" + globby "8.0.2" + gzip-size "5.1.1" + immer "1.10.0" + inquirer "6.5.0" + is-root "2.1.0" + loader-utils "1.2.3" + open "^6.3.0" + pkg-up "2.0.0" + react-error-overlay "^6.0.3" + recursive-readdir "2.2.2" + shell-quote "1.7.2" + sockjs-client "1.4.0" + strip-ansi "5.2.0" + text-table "0.2.0" + +react-dom@^16.10.2, react-dom@^16.5.1: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.2.tgz#4840bce5409176bc3a1f2bd8cb10b92db452fda6" + integrity sha512-kWGDcH3ItJK4+6Pl9DZB16BXYAZyrYQItU4OMy0jAkv5aNqc+mAKb4TpFtAteI6TJZu+9ZlNhaeNQSVQDHJzkw== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.16.2" + +react-error-overlay@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.3.tgz#c378c4b0a21e88b2e159a3e62b2f531fd63bf60d" + integrity sha512-bOUvMWFQVk5oz8Ded9Xb7WVdEi3QGLC8tH7HmYP0Fdp4Bn3qw0tRFmr5TW6mvahzvmrK4a6bqWGfCevBflP+Xw== + +react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab" + integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA== + +react-outside-click-handler@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/react-outside-click-handler/-/react-outside-click-handler-1.3.0.tgz#3831d541ac059deecd38ec5423f81e80ad60e115" + integrity sha512-Te/7zFU0oHpAnctl//pP3hEAeobfeHMyygHB8MnjP6sX5OR8KHT1G3jmLsV3U9RnIYo+Yn+peJYWu+D5tUS8qQ== + dependencies: + airbnb-prop-types "^2.15.0" + consolidated-events "^1.1.1 || ^2.0.0" + document.contains "^1.0.1" + object.values "^1.1.0" + prop-types "^15.7.2" + +react-redux@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.1.1.tgz#ce6eee1b734a7a76e0788b3309bf78ff6b34fa0a" + integrity sha512-QsW0vcmVVdNQzEkrgzh2W3Ksvr8cqpAv5FhEk7tNEft+5pp7rXxAudTz3VOPawRkLIepItpkEIyLcN/VVXzjTg== + dependencies: + "@babel/runtime" "^7.5.5" + hoist-non-react-statics "^3.3.0" + invariant "^2.2.4" + loose-envify "^1.4.0" + prop-types "^15.7.2" + react-is "^16.9.0" + +react-scripts@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-3.2.0.tgz#58ccd6b4ffa27f1b4d2986cbdcaa916660e9e33c" + integrity sha512-6LzuKbE2B4eFQG6i1FnTScn9HDcWBfXXnOwW9xKFPJ/E3rK8i1ufbOZ0ocKyRPxJAKdN7iqg3i7lt0+oxkSVOA== + dependencies: + "@babel/core" "7.6.0" + "@svgr/webpack" "4.3.2" + "@typescript-eslint/eslint-plugin" "^2.2.0" + "@typescript-eslint/parser" "^2.2.0" + babel-eslint "10.0.3" + babel-jest "^24.9.0" + babel-loader "8.0.6" + babel-plugin-named-asset-import "^0.3.4" + babel-preset-react-app "^9.0.2" + camelcase "^5.2.0" + case-sensitive-paths-webpack-plugin "2.2.0" + css-loader "2.1.1" + dotenv "6.2.0" + dotenv-expand "5.1.0" + eslint "^6.1.0" + eslint-config-react-app "^5.0.2" + eslint-loader "3.0.2" + eslint-plugin-flowtype "3.13.0" + eslint-plugin-import "2.18.2" + eslint-plugin-jsx-a11y "6.2.3" + eslint-plugin-react "7.14.3" + eslint-plugin-react-hooks "^1.6.1" + file-loader "3.0.1" + fs-extra "7.0.1" + html-webpack-plugin "4.0.0-beta.5" + identity-obj-proxy "3.0.0" + is-wsl "^1.1.0" + jest "24.9.0" + jest-environment-jsdom-fourteen "0.1.0" + jest-resolve "24.9.0" + jest-watch-typeahead "0.4.0" + mini-css-extract-plugin "0.8.0" + optimize-css-assets-webpack-plugin "5.0.3" + pnp-webpack-plugin "1.5.0" + postcss-flexbugs-fixes "4.1.0" + postcss-loader "3.0.0" + postcss-normalize "7.0.1" + postcss-preset-env "6.7.0" + postcss-safe-parser "4.0.1" + react-app-polyfill "^1.0.4" + react-dev-utils "^9.1.0" + resolve "1.12.0" + resolve-url-loader "3.1.0" + sass-loader "7.2.0" + semver "6.3.0" + style-loader "1.0.0" + terser-webpack-plugin "1.4.1" + ts-pnp "1.1.4" + url-loader "2.1.0" + webpack "4.41.0" + webpack-dev-server "3.2.1" + webpack-manifest-plugin "2.1.1" + workbox-webpack-plugin "4.3.1" + optionalDependencies: + fsevents "2.0.7" + +react-spinners-kit@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/react-spinners-kit/-/react-spinners-kit-1.9.0.tgz#66d55530268f8b5d53816d8fdf90fa7fe04115ef" + integrity sha512-0O38Pq+PIUHayxeujtsuloLwI+mhmkA1N2z7Kk5p03aY8ntGQuGIQYqtlAs+GHVTnL9JwlPQ4mqBGNu8sY0KuQ== + dependencies: + polished "^1.9.3" + prop-types "^15.6.2" + react "^16.5.2" + react-dom "^16.5.1" + +react@^16.10.2, react@^16.5.2: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react/-/react-16.10.2.tgz#a5ede5cdd5c536f745173c8da47bda64797a4cf0" + integrity sha512-MFVIq0DpIhrHFyqLU0S3+4dIcBhhOvBE8bJ/5kHPVOVaGdo0KuiQzpcjCPsf585WvhypqtrMILyoE2th6dT+Lw== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg-up@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" + integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== + dependencies: + find-up "^3.0.0" + read-pkg "^3.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +read-pkg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= + dependencies: + load-json-file "^4.0.0" + normalize-package-data "^2.3.2" + path-type "^3.0.0" + +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +"readable-stream@2 || 3", readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" + integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readdirp@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" + integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== + dependencies: + graceful-fs "^4.1.11" + micromatch "^3.1.10" + readable-stream "^2.0.2" + +realpath-native@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" + integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== + dependencies: + util.promisify "^1.0.0" + +recursive-readdir@2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.2.tgz#9946fb3274e1628de6e36b2f6714953b4845094f" + integrity sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg== + dependencies: + minimatch "3.0.4" + +redent@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" + integrity sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94= + dependencies: + indent-string "^2.1.0" + strip-indent "^1.0.1" + +redux-devtools-instrument@^1.9.0: + version "1.9.6" + resolved "https://registry.yarnpkg.com/redux-devtools-instrument/-/redux-devtools-instrument-1.9.6.tgz#6b412595f74b9d48cfd4ecc13e585b1588ed6e7e" + integrity sha512-MwvY4cLEB2tIfWWBzrUR02UM9qRG2i7daNzywRvabOSVdvAY7s9BxSwMmVRH1Y/7QWjplNtOwgT0apKhHg2Qew== + dependencies: + lodash "^4.2.0" + symbol-observable "^1.0.2" + +redux-devtools@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/redux-devtools/-/redux-devtools-3.5.0.tgz#d69ab76d4f0f8abdf6d24bcf5954d7a1aa2b6827" + integrity sha512-pGU8TZNvWxPaCCE432AGm6H6alQbAz80gQM5CzM3SjX9/oSNu/HPF17xFdPQJOXasqyih1Gv167kZDTRe7r0iQ== + dependencies: + lodash "^4.2.0" + prop-types "^15.5.7" + redux-devtools-instrument "^1.9.0" + +redux-thunk@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622" + integrity sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw== + +redux@^4.0.0, redux@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.4.tgz#4ee1aeb164b63d6a1bcc57ae4aa0b6e6fa7a3796" + integrity sha512-vKv4WdiJxOWKxK0yRoaK3Y4pxxB0ilzVx6dszU2W8wLxlb2yikRph4iV/ymtdJ6ZxpBLFbyrxklnT5yBbQSl3Q== + dependencies: + loose-envify "^1.4.0" + symbol-observable "^1.2.0" + +reflect.ownkeys@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz#749aceec7f3fdf8b63f927a04809e90c5c0b3460" + integrity sha1-dJrO7H8/34tj+SegSAnpDFwLNGA= + +regenerate-unicode-properties@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== + dependencies: + regenerate "^1.4.0" + +regenerate@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== + +regenerator-runtime@0.13.3, regenerator-runtime@^0.13.2: + version "0.13.3" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" + integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +regenerator-transform@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" + integrity sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ== + dependencies: + private "^0.1.6" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +regex-parser@2.2.10: + version "2.2.10" + resolved "https://registry.yarnpkg.com/regex-parser/-/regex-parser-2.2.10.tgz#9e66a8f73d89a107616e63b39d4deddfee912b37" + integrity sha512-8t6074A68gHfU8Neftl0Le6KTDwfGAj7IyjPIMSfikI2wJUTHDMaIq42bUsfVnj8mhx0R+45rdUXHGpN164avA== + +regexp.prototype.flags@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz#6b30724e306a27833eeb171b66ac8890ba37e41c" + integrity sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA== + dependencies: + define-properties "^1.1.2" + +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + +regexpu-core@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" + integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== + dependencies: + regenerate "^1.4.0" + regenerate-unicode-properties "^8.1.0" + regjsgen "^0.5.0" + regjsparser "^0.6.0" + unicode-match-property-ecmascript "^1.0.4" + unicode-match-property-value-ecmascript "^1.1.0" + +registry-auth-token@^3.0.1: + version "3.4.0" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.4.0.tgz#d7446815433f5d5ed6431cd5dca21048f66b397e" + integrity sha512-4LM6Fw8eBQdwMYcES4yTnn2TqIasbXuwDx3um+QRs7S55aMKCBKBxvPXl2RiUjHwuJLTyYfxSpmfSAjQpcuP+A== + dependencies: + rc "^1.1.6" + safe-buffer "^5.0.1" + +registry-url@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" + integrity sha1-PU74cPc93h138M+aOBQyRE4XSUI= + dependencies: + rc "^1.0.1" + +regjsgen@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.0.tgz#a7634dc08f89209c2049adda3525711fb97265dd" + integrity sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA== + +regjsparser@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" + integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ== + dependencies: + jsesc "~0.5.0" + +relateurl@0.2.x: + version "0.2.7" + resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" + integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk= + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +renderkid@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.3.tgz#380179c2ff5ae1365c522bf2fcfcff01c5b74149" + integrity sha512-z8CLQp7EZBPCwCnncgf9C4XAi3WR0dv+uWu/PjIyhhAb5d6IJ/QZqlHFprHeKT+59//V6BNUsLbvN8+2LarxGA== + dependencies: + css-select "^1.1.0" + dom-converter "^0.2" + htmlparser2 "^3.3.0" + strip-ansi "^3.0.0" + utila "^0.4.0" + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= + dependencies: + is-finite "^1.0.0" + +request-promise-core@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.2.tgz#339f6aababcafdb31c799ff158700336301d3346" + integrity sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag== + dependencies: + lodash "^4.17.11" + +request-promise-native@^1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.7.tgz#a49868a624bdea5069f1251d0a836e0d89aa2c59" + integrity sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w== + dependencies: + request-promise-core "1.1.2" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" + +request@^2.87.0, request@^2.88.0: + version "2.88.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.0" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.4.3" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + +resolve-cwd@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= + dependencies: + resolve-from "^3.0.0" + +resolve-dir@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-0.1.1.tgz#b219259a5602fac5c5c496ad894a6e8cc430261e" + integrity sha1-shklmlYC+sXFxJatiUpujMQwJh4= + dependencies: + expand-tilde "^1.2.2" + global-modules "^0.2.3" + +resolve-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-url-loader@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-3.1.0.tgz#54d8181d33cd1b66a59544d05cadf8e4aa7d37cc" + integrity sha512-2QcrA+2QgVqsMJ1Hn5NnJXIGCX1clQ1F6QJTqOeiaDw9ACo1G2k+8/shq3mtqne03HOFyskAClqfxKyFBriXZg== + dependencies: + adjust-sourcemap-loader "2.0.0" + camelcase "5.0.0" + compose-function "3.0.3" + convert-source-map "1.6.0" + es6-iterator "2.0.3" + loader-utils "1.2.3" + postcss "7.0.14" + rework "1.0.1" + rework-visit "1.0.0" + source-map "0.6.1" + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= + +resolve@1.12.0, resolve@1.x, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +retry-request@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/retry-request/-/retry-request-4.1.1.tgz#f676d0db0de7a6f122c048626ce7ce12101d2bd8" + integrity sha512-BINDzVtLI2BDukjWmjAIRZ0oglnCAkpP2vQjM3jdLhmT62h0xnQgciPwBRDAvHqpkPT2Wo1XuUyLyn6nbGrZQQ== + dependencies: + debug "^4.1.1" + through2 "^3.0.1" + +rework-visit@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/rework-visit/-/rework-visit-1.0.0.tgz#9945b2803f219e2f7aca00adb8bc9f640f842c9a" + integrity sha1-mUWygD8hni96ygCtuLyfZA+ELJo= + +rework@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/rework/-/rework-1.0.1.tgz#30806a841342b54510aa4110850cd48534144aa7" + integrity sha1-MIBqhBNCtUUQqkEQhQzUhTQUSqc= + dependencies: + convert-source-map "^0.3.3" + css "^2.0.0" + +rgb-regex@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1" + integrity sha1-wODWiC3w4jviVKR16O3UGRX+rrE= + +rgba-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" + integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= + +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rsvp@^4.8.4: + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= + dependencies: + is-promise "^2.1.0" + +run-queue@^1.0.0, run-queue@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" + integrity sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec= + dependencies: + aproba "^1.1.1" + +rx@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" + integrity sha1-pfE/957zt0D+MKqAP7CfmIBdR4I= + +rxjs@^6.4.0, rxjs@^6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== + dependencies: + tslib "^1.9.0" + +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sane@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== + dependencies: + "@cnakazawa/watch" "^1.0.3" + anymatch "^2.0.0" + capture-exit "^2.0.0" + exec-sh "^0.3.2" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + +sanitize-html@^1.20.1: + version "1.20.1" + resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-1.20.1.tgz#f6effdf55dd398807171215a62bfc21811bacf85" + integrity sha512-txnH8TQjaQvg2Q0HY06G6CDJLVYCpbnxrdO0WN8gjCKaU5J0KbyGYhZxx5QJg3WLZ1lB7XU9kDkfrCXUozqptA== + dependencies: + chalk "^2.4.1" + htmlparser2 "^3.10.0" + lodash.clonedeep "^4.5.0" + lodash.escaperegexp "^4.1.2" + lodash.isplainobject "^4.0.6" + lodash.isstring "^4.0.1" + lodash.mergewith "^4.6.1" + postcss "^7.0.5" + srcset "^1.0.0" + xtend "^4.0.1" + +sass-graph@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.4.tgz#13fbd63cd1caf0908b9fd93476ad43a51d1e0b49" + integrity sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k= + dependencies: + glob "^7.0.0" + lodash "^4.0.0" + scss-tokenizer "^0.2.3" + yargs "^7.0.0" + +sass-loader@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.2.0.tgz#e34115239309d15b2527cb62b5dfefb62a96ff7f" + integrity sha512-h8yUWaWtsbuIiOCgR9fd9c2lRXZ2uG+h8Dzg/AGNj+Hg/3TO8+BBAW9mEP+mh8ei+qBKqSJ0F1FLlYjNBc61OA== + dependencies: + clone-deep "^4.0.1" + loader-utils "^1.0.1" + neo-async "^2.5.0" + pify "^4.0.1" + semver "^5.5.0" + +sax@^1.2.4, sax@~1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + +saxes@^3.1.9: + version "3.1.11" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-3.1.11.tgz#d59d1fd332ec92ad98a2e0b2ee644702384b1c5b" + integrity sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g== + dependencies: + xmlchars "^2.1.1" + +scheduler@^0.16.2: + version "0.16.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.2.tgz#f74cd9d33eff6fc554edfb79864868e4819132c1" + integrity sha512-BqYVWqwz6s1wZMhjFvLfVR5WXP7ZY32M/wYPo04CcuPM7XZEbV2TBNW7Z0UkguPTl0dWMA59VbNXxK6q+pHItg== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + +schema-utils@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" + integrity sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g== + dependencies: + ajv "^6.1.0" + ajv-errors "^1.0.0" + ajv-keywords "^3.1.0" + +schema-utils@^2.0.0, schema-utils@^2.0.1, schema-utils@^2.2.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.4.1.tgz#e89ade5d056dc8bcaca377574bb4a9c4e1b8be56" + integrity sha512-RqYLpkPZX5Oc3fw/kHHHyP56fg5Y+XBpIpV8nCg0znIALfq3OH+Ea9Hfeac9BAMwG5IICltiZ0vxFvJQONfA5w== + dependencies: + ajv "^6.10.2" + ajv-keywords "^3.4.1" + +scss-tokenizer@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1" + integrity sha1-jrBtualyMzOCTT9VMGQRSYR85dE= + dependencies: + js-base64 "^2.1.8" + source-map "^0.4.2" + +select-hose@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" + integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo= + +selfsigned@^1.9.1: + version "1.10.7" + resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.10.7.tgz#da5819fd049d5574f28e88a9bcc6dbc6e6f3906b" + integrity sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA== + dependencies: + node-forge "0.9.0" + +semver-diff@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36" + integrity sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY= + dependencies: + semver "^5.0.3" + +"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@6.3.0, semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +semver@~5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= + +send@0.17.1: + version "0.17.1" + resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" + integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== + dependencies: + debug "2.6.9" + depd "~1.1.2" + destroy "~1.0.4" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "~1.7.2" + mime "1.6.0" + ms "2.1.1" + on-finished "~2.3.0" + range-parser "~1.2.1" + statuses "~1.5.0" + +serialize-javascript@^1.7.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.9.1.tgz#cfc200aef77b600c47da9bb8149c943e798c2fdb" + integrity sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A== + +serve-index@^1.7.2: + version "1.9.1" + resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" + integrity sha1-03aNabHn2C5c4FD/9bRTvqEqkjk= + dependencies: + accepts "~1.3.4" + batch "0.6.1" + debug "2.6.9" + escape-html "~1.0.3" + http-errors "~1.6.2" + mime-types "~2.1.17" + parseurl "~1.3.2" + +serve-static@1.14.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" + integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.17.1" + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +setimmediate@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= + +setprototypeof@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" + integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== + +setprototypeof@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" + integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== + +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +shallow-clone@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-0.1.2.tgz#5909e874ba77106d73ac414cfec1ffca87d97060" + integrity sha1-WQnodLp3EG1zrEFM/sH/yofZcGA= + dependencies: + is-extendable "^0.1.1" + kind-of "^2.0.1" + lazy-cache "^0.2.3" + mixin-object "^2.0.1" + +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shell-quote@1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== + +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo= + dependencies: + is-arrayish "^0.3.1" + +sisteransi@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.3.tgz#98168d62b79e3a5e758e27ae63c4a053d748f4eb" + integrity sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg== + +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= + +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + +snakeize@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/snakeize/-/snakeize-0.1.0.tgz#10c088d8b58eb076b3229bb5a04e232ce126422d" + integrity sha1-EMCI2LWOsHazIpu1oE4jLOEmQi0= + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +sockjs-client@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.3.0.tgz#12fc9d6cb663da5739d3dc5fb6e8687da95cb177" + integrity sha512-R9jxEzhnnrdxLCNln0xg5uGHqMnkhPSTzUZH2eXcR03S/On9Yvoq2wyUZILRUhZCNVu2PmwWVoyuiPz8th8zbg== + dependencies: + debug "^3.2.5" + eventsource "^1.0.7" + faye-websocket "~0.11.1" + inherits "^2.0.3" + json3 "^3.3.2" + url-parse "^1.4.3" + +sockjs-client@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.4.0.tgz#c9f2568e19c8fd8173b4997ea3420e0bb306c7d5" + integrity sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g== + dependencies: + debug "^3.2.5" + eventsource "^1.0.7" + faye-websocket "~0.11.1" + inherits "^2.0.3" + json3 "^3.3.2" + url-parse "^1.4.3" + +sockjs@0.3.19: + version "0.3.19" + resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.19.tgz#d976bbe800af7bd20ae08598d582393508993c0d" + integrity sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw== + dependencies: + faye-websocket "^0.10.0" + uuid "^3.0.1" + +sort-keys@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" + integrity sha1-RBttTTRnmPG05J6JIK37oOVD+a0= + dependencies: + is-plain-obj "^1.0.0" + +source-list-map@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" + integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== + +source-map-resolve@^0.5.0, source-map-resolve@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-support@^0.5.13, source-map-support@^0.5.6, source-map-support@~0.5.12: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= + +source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +source-map@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + integrity sha1-66T12pwNyZneaAMti092FzZSA2s= + dependencies: + amdefine ">=0.0.4" + +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +spawnd@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/spawnd/-/spawnd-4.0.0.tgz#b27ee6e7ec55c6ec232c05a21418cf35a77e0409" + integrity sha512-ql3qhJnhAkvXpaqKBWOqou1rUTSQhFRaZkyOT+MTFB4xY3X+brgw6LTWV2wHuE9A6YPhrNe1cbg7S+jAYnbC0Q== + dependencies: + exit "^0.1.2" + signal-exit "^3.0.2" + tree-kill "^1.2.1" + wait-port "^0.2.2" + +spdx-correct@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== + +spdy-transport@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31" + integrity sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw== + dependencies: + debug "^4.1.0" + detect-node "^2.0.4" + hpack.js "^2.1.6" + obuf "^1.1.2" + readable-stream "^3.0.6" + wbuf "^1.7.3" + +spdy@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/spdy/-/spdy-4.0.1.tgz#6f12ed1c5db7ea4f24ebb8b89ba58c87c08257f2" + integrity sha512-HeZS3PBdMA+sZSu0qwpCxl3DeALD5ASx8pAX0jZdKXSpPWbQ6SYGnlg3BBmYLx5LtiZrmkAZfErCm2oECBcioA== + dependencies: + debug "^4.1.0" + handle-thing "^2.0.0" + http-deceiver "^1.2.7" + select-hose "^2.0.0" + spdy-transport "^3.0.0" + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +srcset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/srcset/-/srcset-1.0.0.tgz#a5669de12b42f3b1d5e83ed03c71046fc48f41ef" + integrity sha1-pWad4StC87HV6D7QPHEEb8SPQe8= + dependencies: + array-uniq "^1.0.2" + number-is-nan "^1.0.0" + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +ssri@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" + integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== + dependencies: + figgy-pudding "^3.5.1" + +stable@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" + integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== + +stack-trace@0.0.x: + version "0.0.10" + resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" + integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= + +stack-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@~1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= + +stdout-stream@^1.4.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/stdout-stream/-/stdout-stream-1.4.1.tgz#5ac174cdd5cd726104aa0c0b2bd83815d8d535de" + integrity sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA== + dependencies: + readable-stream "^2.0.1" + +stealthy-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= + +stream-browserify@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" + integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== + dependencies: + inherits "~2.0.1" + readable-stream "^2.0.2" + +stream-each@^1.1.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" + integrity sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw== + dependencies: + end-of-stream "^1.1.0" + stream-shift "^1.0.0" + +stream-events@^1.0.1, stream-events@^1.0.4, stream-events@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/stream-events/-/stream-events-1.0.5.tgz#bbc898ec4df33a4902d892333d47da9bf1c406d5" + integrity sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg== + dependencies: + stubs "^3.0.0" + +stream-http@^2.7.2: + version "2.8.3" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.3.tgz#b2d242469288a5a27ec4fe8933acf623de6514fc" + integrity sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw== + dependencies: + builtin-status-codes "^3.0.0" + inherits "^2.0.1" + readable-stream "^2.3.6" + to-arraybuffer "^1.0.0" + xtend "^4.0.0" + +stream-shift@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" + integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= + +strict-uri-encode@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= + +string-length@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= + dependencies: + astral-regex "^1.0.0" + strip-ansi "^4.0.0" + +string-length@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-3.1.0.tgz#107ef8c23456e187a8abd4a61162ff4ac6e25837" + integrity sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA== + dependencies: + astral-regex "^1.0.0" + strip-ansi "^5.2.0" + +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string.prototype.trimleft@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" + integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string.prototype.trimright@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" + integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string_decoder@^1.0.0, string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +stringify-object@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629" + integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw== + dependencies: + get-own-enumerable-property-symbols "^3.0.0" + is-obj "^1.0.1" + is-regexp "^1.0.0" + +strip-ansi@5.2.0, strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= + dependencies: + is-utf8 "^0.2.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-comments@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/strip-comments/-/strip-comments-1.0.2.tgz#82b9c45e7f05873bee53f37168af930aa368679d" + integrity sha512-kL97alc47hoyIQSV165tTt9rG5dn4w1dNnBhOQ3bOU1Nc1hel09jnXANaHJ7vzHLd4Ju8kseDGzlev96pghLFw== + dependencies: + babel-extract-comments "^1.0.0" + babel-plugin-transform-object-rest-spread "^6.26.0" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-indent@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" + integrity sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI= + dependencies: + get-stdin "^4.0.1" + +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +stubs@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/stubs/-/stubs-3.0.0.tgz#e8d2ba1fa9c90570303c030b6900f7d5f89abe5b" + integrity sha1-6NK6H6nJBXAwPAMLaQD31fiavls= + +style-loader@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.0.0.tgz#1d5296f9165e8e2c85d24eee0b7caf9ec8ca1f82" + integrity sha512-B0dOCFwv7/eY31a5PCieNwMgMhVGFe9w+rh7s/Bx8kfFkrth9zfTZquoYvdw8URgiqxObQKcpW51Ugz1HjfdZw== + dependencies: + loader-utils "^1.2.3" + schema-utils "^2.0.1" + +styled-components@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-4.4.0.tgz#4e381e2dab831d0e6ea431c2840a96323e84e21b" + integrity sha512-xQ6vTI/0zNjZ1BBDRxyjvBddrxhQ3DxjeCdaLM1lSn5FDnkTOQgRkmWvcUiTajqc5nJqKVl+7sUioMqktD0+Zw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@emotion/is-prop-valid" "^0.8.1" + "@emotion/unitless" "^0.7.0" + babel-plugin-styled-components ">= 1" + css-to-react-native "^2.2.2" + memoize-one "^5.0.0" + merge-anything "^2.2.4" + prop-types "^15.5.4" + react-is "^16.6.0" + stylis "^3.5.0" + stylis-rule-sheet "^0.0.10" + supports-color "^5.5.0" + +stylehacks@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5" + integrity sha512-7GlLk9JwlElY4Y6a/rmbH2MhVlTyVmiJd1PfTCqFaIBEGMYNsrO/v3SeGTdhBThLg4Z+NbOk/qFMwCa+J+3p/g== + dependencies: + browserslist "^4.0.0" + postcss "^7.0.0" + postcss-selector-parser "^3.0.0" + +stylis-rule-sheet@^0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz#44e64a2b076643f4b52e5ff71efc04d8c3c4a430" + integrity sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw== + +stylis@^3.5.0: + version "3.5.4" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.4.tgz#f665f25f5e299cf3d64654ab949a57c768b73fbe" + integrity sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q== + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +supports-color@^5.2.0, supports-color@^5.3.0, supports-color@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== + dependencies: + has-flag "^3.0.0" + +svg-parser@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/svg-parser/-/svg-parser-2.0.2.tgz#d134cc396fa2681dc64f518330784e98bd801ec8" + integrity sha512-1gtApepKFweigFZj3sGO8KT8LvVZK8io146EzXrpVuWCDAbISz/yMucco3hWTkpZNoPabM+dnMOpy6Swue68Zg== + +svgo@^1.0.0, svgo@^1.2.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.0.tgz#bae51ba95ded9a33a36b7c46ce9c359ae9154313" + integrity sha512-MLfUA6O+qauLDbym+mMZgtXCGRfIxyQoeH6IKVcFslyODEe/ElJNwr0FohQ3xG4C6HK6bk3KYPPXwHVJk3V5NQ== + dependencies: + chalk "^2.4.1" + coa "^2.0.2" + css-select "^2.0.0" + css-select-base-adapter "^0.1.1" + css-tree "1.0.0-alpha.33" + csso "^3.5.1" + js-yaml "^3.13.1" + mkdirp "~0.5.1" + object.values "^1.1.0" + sax "~1.2.4" + stable "^0.1.8" + unquote "~1.1.1" + util.promisify "~1.0.0" + +symbol-observable@^1.0.2, symbol-observable@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== + +symbol-tree@^3.2.2: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== + dependencies: + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" + +tapable@^1.0.0, tapable@^1.1.0, tapable@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" + integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== + +tar@^2.0.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.2.tgz#0ca8848562c7299b8b446ff6a4d60cdbb23edc40" + integrity sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA== + dependencies: + block-stream "*" + fstream "^1.0.12" + inherits "2" + +tar@^4: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.8.6" + minizlib "^1.2.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.3" + +teeny-request@^5.2.1: + version "5.3.0" + resolved "https://registry.yarnpkg.com/teeny-request/-/teeny-request-5.3.0.tgz#c80287b5a51a7c25eef2347ff5467c95e07dac5a" + integrity sha512-sN9E3JvEBe2CFqB/jpJpw1erWD1C7MxyYCxogHFCQSyZfkHYcdf4wzVQSw7FZxbwcfnS+FP0W9BS0mp6SEOKjg== + dependencies: + http-proxy-agent "^2.1.0" + https-proxy-agent "^3.0.0" + node-fetch "^2.2.0" + stream-events "^1.0.5" + uuid "^3.3.2" + +term-size@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69" + integrity sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk= + dependencies: + execa "^0.7.0" + +terser-webpack-plugin@1.4.1, terser-webpack-plugin@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4" + integrity sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg== + dependencies: + cacache "^12.0.2" + find-cache-dir "^2.1.0" + is-wsl "^1.1.0" + schema-utils "^1.0.0" + serialize-javascript "^1.7.0" + source-map "^0.6.1" + terser "^4.1.2" + webpack-sources "^1.4.0" + worker-farm "^1.7.0" + +terser@^4.1.2: + version "4.3.8" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.8.tgz#707f05f3f4c1c70c840e626addfdb1c158a17136" + integrity sha512-otmIRlRVmLChAWsnSFNO0Bfk6YySuBp6G9qrHiJwlLDd4mxe2ta4sjI7TzIR+W1nBMjilzrMcPOz9pSusgx3hQ== + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + +test-exclude@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" + integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== + dependencies: + glob "^7.1.3" + minimatch "^3.0.4" + read-pkg-up "^4.0.0" + require-main-filename "^2.0.0" + +text-hex@1.0.x: + version "1.0.0" + resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" + integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== + +text-table@0.2.0, text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +throat@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= + +through2@^2.0.0: + version "2.0.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + dependencies: + readable-stream "~2.3.6" + xtend "~4.0.1" + +through2@^3.0.0, through2@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/through2/-/through2-3.0.1.tgz#39276e713c3302edf9e388dd9c812dd3b825bd5a" + integrity sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww== + dependencies: + readable-stream "2 || 3" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +thunky@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.0.3.tgz#f5df732453407b09191dae73e2a8cc73f381a826" + integrity sha512-YwT8pjmNcAXBZqrubu22P4FYsh2D4dxRmnWBOL8Jk8bUcRUtc5326kx32tuTmFDAZtLOGEVNl8POAR8j896Iow== + +timed-out@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= + +timers-browserify@^2.0.4: + version "2.0.11" + resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.11.tgz#800b1f3eee272e5bc53ee465a04d0e804c31211f" + integrity sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ== + dependencies: + setimmediate "^1.0.4" + +timsort@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +tmp@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.1.0.tgz#ee434a4e22543082e294ba6201dcc6eafefa2877" + integrity sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw== + dependencies: + rimraf "^2.6.3" + +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + +to-arraybuffer@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" + integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +toidentifier@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" + integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== + +touch@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" + integrity sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA== + dependencies: + nopt "~1.0.10" + +tough-cookie@^2.3.3, tough-cookie@^2.3.4, tough-cookie@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tough-cookie@~2.4.3: + version "2.4.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== + dependencies: + psl "^1.1.24" + punycode "^1.4.1" + +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= + dependencies: + punycode "^2.1.0" + +tree-kill@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a" + integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q== + +trim-newlines@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" + integrity sha1-WIeWa7WCpFA6QetST301ARgVphM= + +triple-beam@^1.2.0, triple-beam@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9" + integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw== + +"true-case-path@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-1.0.3.tgz#f813b5a8c86b40da59606722b144e3225799f47d" + integrity sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew== + dependencies: + glob "^7.1.2" + +ts-jest@^24.1.0: + version "24.1.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.1.0.tgz#2eaa813271a2987b7e6c3fefbda196301c131734" + integrity sha512-HEGfrIEAZKfu1pkaxB9au17b1d9b56YZSqz5eCVE8mX68+5reOvlM93xGOzzCREIov9mdH7JBG+s0UyNAqr0tQ== + dependencies: + bs-logger "0.x" + buffer-from "1.x" + fast-json-stable-stringify "2.x" + json5 "2.x" + lodash.memoize "4.x" + make-error "1.x" + mkdirp "0.x" + resolve "1.x" + semver "^5.5" + yargs-parser "10.x" + +ts-node@^8.4.1: + version "8.4.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.4.1.tgz#270b0dba16e8723c9fa4f9b4775d3810fd994b4f" + integrity sha512-5LpRN+mTiCs7lI5EtbXmF/HfMeCjzt7DH9CZwtkr6SywStrNQC723wG+aOWFiLNn7zT3kD/RnFqi3ZUfr4l5Qw== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.6" + yn "^3.0.0" + +ts-pnp@1.1.4, ts-pnp@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.4.tgz#ae27126960ebaefb874c6d7fa4729729ab200d90" + integrity sha512-1J/vefLC+BWSo+qe8OnJQfWTYRS6ingxjwqmHMqaMxXMj7kFtKLgAaYW3JeX3mktjgUL+etlU8/B4VUAUI9QGw== + +tsconfig-paths@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +tslib@^1.8.1, tslib@^1.9.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + +tty-browserify@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" + integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY= + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +type-fest@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" + integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== + +type-is@~1.6.17, type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + +typescript@3.6.4, typescript@~3.6.3: + version "3.6.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" + integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== + +uglify-js@3.4.x: + version "3.4.10" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f" + integrity sha512-Y2VsbPVs0FIshJztycsO2SfPk7/KAF/T72qzv9u5EpQ4kB2hQoHlhNQTsNyy6ul7lQtqJN/AoWeS23OzEiEFxw== + dependencies: + commander "~2.19.0" + source-map "~0.6.1" + +uglify-js@^3.1.4: + version "3.6.1" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.1.tgz#ae7688c50e1bdcf2f70a0e162410003cf9798311" + integrity sha512-+dSJLJpXBb6oMHP+Yvw8hUgElz4gLTh82XuX68QiJVTXaE5ibl6buzhNkQdYhBlIhozWOC9ge16wyRmjG4TwVQ== + dependencies: + commander "2.20.0" + source-map "~0.6.1" + +undefsafe@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.2.tgz#225f6b9e0337663e0d8e7cfd686fc2836ccace76" + integrity sha1-Il9rngM3Zj4Njnz9aG/Cg2zKznY= + dependencies: + debug "^2.2.0" + +unicode-canonical-property-names-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== + +unicode-match-property-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== + dependencies: + unicode-canonical-property-names-ecmascript "^1.0.4" + unicode-property-aliases-ecmascript "^1.0.4" + +unicode-match-property-value-ecmascript@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277" + integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== + +unicode-property-aliases-ecmascript@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" + integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== + +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + +uniq@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" + integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= + +uniqs@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/uniqs/-/uniqs-2.0.0.tgz#ffede4b36b25290696e6e165d4a59edb998e6b02" + integrity sha1-/+3ks2slKQaW5uFl1KWe25mOawI= + +unique-filename@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" + integrity sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ== + dependencies: + unique-slug "^2.0.0" + +unique-slug@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" + integrity sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w== + dependencies: + imurmurhash "^0.1.4" + +unique-string@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a" + integrity sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo= + dependencies: + crypto-random-string "^1.0.0" + +unique-string@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-2.0.0.tgz#39c6451f81afb2749de2b233e3f7c5e8843bd89d" + integrity sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg== + dependencies: + crypto-random-string "^2.0.0" + +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= + +unquote@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/unquote/-/unquote-1.1.1.tgz#8fded7324ec6e88a0ff8b905e7c098cdc086d544" + integrity sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ= + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +unzip-response@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" + integrity sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c= + +upath@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" + integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== + +update-notifier@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.5.0.tgz#d0744593e13f161e406acb1d9408b72cad08aff6" + integrity sha512-gwMdhgJHGuj/+wHJJs9e6PcCszpxR1b236igrOkUofGhqJuG+amlIKwApH1IW1WWl7ovZxsX49lMBWLxSdm5Dw== + dependencies: + boxen "^1.2.1" + chalk "^2.0.1" + configstore "^3.0.0" + import-lazy "^2.1.0" + is-ci "^1.0.10" + is-installed-globally "^0.1.0" + is-npm "^1.0.0" + latest-version "^3.0.0" + semver-diff "^2.0.0" + xdg-basedir "^3.0.0" + +upper-case@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" + integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg= + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +url-loader@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-2.1.0.tgz#bcc1ecabbd197e913eca23f5e0378e24b4412961" + integrity sha512-kVrp/8VfEm5fUt+fl2E0FQyrpmOYgMEkBsv8+UDP1wFhszECq5JyGF33I7cajlVY90zRZ6MyfgKXngLvHYZX8A== + dependencies: + loader-utils "^1.2.3" + mime "^2.4.4" + schema-utils "^2.0.0" + +url-parse-lax@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" + integrity sha1-evjzA2Rem9eaJy56FKxovAYJ2nM= + dependencies: + prepend-http "^1.0.1" + +url-parse@^1.4.3: + version "1.4.7" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" + integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + +url@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= + dependencies: + punycode "1.3.2" + querystring "0.2.0" + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util.promisify@1.0.0, util.promisify@^1.0.0, util.promisify@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== + dependencies: + define-properties "^1.1.2" + object.getownpropertydescriptors "^2.0.3" + +util@0.10.3: + version "0.10.3" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" + integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= + dependencies: + inherits "2.0.1" + +util@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/util/-/util-0.11.1.tgz#3236733720ec64bb27f6e26f421aaa2e1b588d61" + integrity sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ== + dependencies: + inherits "2.0.3" + +utila@^0.4.0, utila@~0.4: + version "0.4.0" + resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" + integrity sha1-ihagXURWV6Oupe7MWxKk+lN5dyw= + +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= + +uuid@^3.0.1, uuid@^3.3.2: + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= + +vendors@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.3.tgz#a6467781abd366217c050f8202e7e50cc9eef8c0" + integrity sha512-fOi47nsJP5Wqefa43kyWSg80qF+Q3XA6MUkgi7Hp1HQaKDQW4cQrK2D0P7mmbFtsV1N89am55Yru/nyEwRubcw== + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +vm-browserify@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" + integrity sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw== + +w3c-hr-time@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= + dependencies: + browser-process-hrtime "^0.1.2" + +w3c-xmlserializer@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz#30485ca7d70a6fd052420a3d12fd90e6339ce794" + integrity sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg== + dependencies: + domexception "^1.0.1" + webidl-conversions "^4.0.2" + xml-name-validator "^3.0.0" + +wait-on@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-3.3.0.tgz#9940981d047a72a9544a97b8b5fca45b2170a082" + integrity sha512-97dEuUapx4+Y12aknWZn7D25kkjMk16PbWoYzpSdA8bYpVfS6hpl2a2pOWZ3c+Tyt3/i4/pglyZctG3J4V1hWQ== + dependencies: + "@hapi/joi" "^15.0.3" + core-js "^2.6.5" + minimist "^1.2.0" + request "^2.88.0" + rx "^4.1.0" + +wait-port@^0.2.2: + version "0.2.6" + resolved "https://registry.yarnpkg.com/wait-port/-/wait-port-0.2.6.tgz#261e615adb2e10c8b91c836722c85919ccf081cc" + integrity sha512-nXE5Yp0Zs1obhFVc0Da7WVJc3y0LxoCq3j4mtV0NdI5P/ZvRdKp5yhuojvMOcOxSwpQL1hGbOgMNQ+4wpRpwCA== + dependencies: + chalk "^2.4.2" + commander "^3.0.2" + debug "^4.1.1" + +walker@^1.0.7, walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= + dependencies: + makeerror "1.0.x" + +watchpack@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" + integrity sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA== + dependencies: + chokidar "^2.0.2" + graceful-fs "^4.1.2" + neo-async "^2.5.0" + +wbuf@^1.1.0, wbuf@^1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/wbuf/-/wbuf-1.7.3.tgz#c1d8d149316d3ea852848895cb6a0bfe887b87df" + integrity sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA== + dependencies: + minimalistic-assert "^1.0.0" + +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== + +webpack-dev-middleware@^3.5.1: + version "3.7.2" + resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz#0019c3db716e3fa5cecbf64f2ab88a74bab331f3" + integrity sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw== + dependencies: + memory-fs "^0.4.1" + mime "^2.4.4" + mkdirp "^0.5.1" + range-parser "^1.2.1" + webpack-log "^2.0.0" + +webpack-dev-server@3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.2.1.tgz#1b45ce3ecfc55b6ebe5e36dab2777c02bc508c4e" + integrity sha512-sjuE4mnmx6JOh9kvSbPYw3u/6uxCLHNWfhWaIPwcXWsvWOPN+nc5baq4i9jui3oOBRXGonK9+OI0jVkaz6/rCw== + dependencies: + ansi-html "0.0.7" + bonjour "^3.5.0" + chokidar "^2.0.0" + compression "^1.5.2" + connect-history-api-fallback "^1.3.0" + debug "^4.1.1" + del "^3.0.0" + express "^4.16.2" + html-entities "^1.2.0" + http-proxy-middleware "^0.19.1" + import-local "^2.0.0" + internal-ip "^4.2.0" + ip "^1.1.5" + killable "^1.0.0" + loglevel "^1.4.1" + opn "^5.1.0" + portfinder "^1.0.9" + schema-utils "^1.0.0" + selfsigned "^1.9.1" + semver "^5.6.0" + serve-index "^1.7.2" + sockjs "0.3.19" + sockjs-client "1.3.0" + spdy "^4.0.0" + strip-ansi "^3.0.0" + supports-color "^6.1.0" + url "^0.11.0" + webpack-dev-middleware "^3.5.1" + webpack-log "^2.0.0" + yargs "12.0.2" + +webpack-log@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-2.0.0.tgz#5b7928e0637593f119d32f6227c1e0ac31e1b47f" + integrity sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg== + dependencies: + ansi-colors "^3.0.0" + uuid "^3.3.2" + +webpack-manifest-plugin@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/webpack-manifest-plugin/-/webpack-manifest-plugin-2.1.1.tgz#6b3e280327815b83152c79f42d0ca13b665773c4" + integrity sha512-2zqJ6mvc3yoiqfDjghAIpljhLSDh/G7vqGrzYcYqqRCd/ZZZCAuc/YPE5xG0LGpLgDJRhUNV1H+znyyhIxahzA== + dependencies: + fs-extra "^7.0.0" + lodash ">=3.5 <5" + object.entries "^1.1.0" + tapable "^1.0.0" + +webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1: + version "1.4.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" + integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ== + dependencies: + source-list-map "^2.0.0" + source-map "~0.6.1" + +webpack@4.41.0: + version "4.41.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.0.tgz#db6a254bde671769f7c14e90a1a55e73602fc70b" + integrity sha512-yNV98U4r7wX1VJAj5kyMsu36T8RPPQntcb5fJLOsMz/pt/WrKC0Vp1bAlqPLkA1LegSwQwf6P+kAbyhRKVQ72g== + dependencies: + "@webassemblyjs/ast" "1.8.5" + "@webassemblyjs/helper-module-context" "1.8.5" + "@webassemblyjs/wasm-edit" "1.8.5" + "@webassemblyjs/wasm-parser" "1.8.5" + acorn "^6.2.1" + ajv "^6.10.2" + ajv-keywords "^3.4.1" + chrome-trace-event "^1.0.2" + enhanced-resolve "^4.1.0" + eslint-scope "^4.0.3" + json-parse-better-errors "^1.0.2" + loader-runner "^2.4.0" + loader-utils "^1.2.3" + memory-fs "^0.4.1" + micromatch "^3.1.10" + mkdirp "^0.5.1" + neo-async "^2.6.1" + node-libs-browser "^2.2.1" + schema-utils "^1.0.0" + tapable "^1.1.3" + terser-webpack-plugin "^1.4.1" + watchpack "^1.6.0" + webpack-sources "^1.4.1" + +websocket-driver@>=0.5.1: + version "0.7.3" + resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9" + integrity sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg== + dependencies: + http-parser-js ">=0.4.0 <0.4.11" + safe-buffer ">=5.1.0" + websocket-extensions ">=0.1.1" + +websocket-extensions@>=0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" + integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== + +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3, whatwg-encoding@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== + dependencies: + iconv-lite "0.4.24" + +whatwg-fetch@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" + integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== + +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== + +whatwg-url@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +whatwg-url@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.0.0.tgz#fde926fa54a599f3adf82dff25a9f7be02dc6edd" + integrity sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +which-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + integrity sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8= + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@1, which@^1.2.12, which@^1.2.9, which@^1.3.0, which@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + +widest-line@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.1.tgz#7438764730ec7ef4381ce4df82fb98a53142a3fc" + integrity sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA== + dependencies: + string-width "^2.1.1" + +winston-transport@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.3.0.tgz#df68c0c202482c448d9b47313c07304c2d7c2c66" + integrity sha512-B2wPuwUi3vhzn/51Uukcao4dIduEiPOcOt9HJ3QeaXgkJ5Z7UwpBzxS4ZGNHtrxrUvTwemsQiSys0ihOf8Mp1A== + dependencies: + readable-stream "^2.3.6" + triple-beam "^1.2.0" + +winston@*, winston@^3.0.0, winston@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/winston/-/winston-3.2.1.tgz#63061377976c73584028be2490a1846055f77f07" + integrity sha512-zU6vgnS9dAWCEKg/QYigd6cgMVVNwyTzKs81XZtTFuRwJOcDdBg7AU0mXVyNbs7O5RH2zdv+BdNZUlx7mXPuOw== + dependencies: + async "^2.6.1" + diagnostics "^1.1.1" + is-stream "^1.1.0" + logform "^2.1.1" + one-time "0.0.4" + readable-stream "^3.1.1" + stack-trace "0.0.x" + triple-beam "^1.3.0" + winston-transport "^4.3.0" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +workbox-background-sync@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-background-sync/-/workbox-background-sync-4.3.1.tgz#26821b9bf16e9e37fd1d640289edddc08afd1950" + integrity sha512-1uFkvU8JXi7L7fCHVBEEnc3asPpiAL33kO495UMcD5+arew9IbKW2rV5lpzhoWcm/qhGB89YfO4PmB/0hQwPRg== + dependencies: + workbox-core "^4.3.1" + +workbox-broadcast-update@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-broadcast-update/-/workbox-broadcast-update-4.3.1.tgz#e2c0280b149e3a504983b757606ad041f332c35b" + integrity sha512-MTSfgzIljpKLTBPROo4IpKjESD86pPFlZwlvVG32Kb70hW+aob4Jxpblud8EhNb1/L5m43DUM4q7C+W6eQMMbA== + dependencies: + workbox-core "^4.3.1" + +workbox-build@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-build/-/workbox-build-4.3.1.tgz#414f70fb4d6de47f6538608b80ec52412d233e64" + integrity sha512-UHdwrN3FrDvicM3AqJS/J07X0KXj67R8Cg0waq1MKEOqzo89ap6zh6LmaLnRAjpB+bDIz+7OlPye9iii9KBnxw== + dependencies: + "@babel/runtime" "^7.3.4" + "@hapi/joi" "^15.0.0" + common-tags "^1.8.0" + fs-extra "^4.0.2" + glob "^7.1.3" + lodash.template "^4.4.0" + pretty-bytes "^5.1.0" + stringify-object "^3.3.0" + strip-comments "^1.0.2" + workbox-background-sync "^4.3.1" + workbox-broadcast-update "^4.3.1" + workbox-cacheable-response "^4.3.1" + workbox-core "^4.3.1" + workbox-expiration "^4.3.1" + workbox-google-analytics "^4.3.1" + workbox-navigation-preload "^4.3.1" + workbox-precaching "^4.3.1" + workbox-range-requests "^4.3.1" + workbox-routing "^4.3.1" + workbox-strategies "^4.3.1" + workbox-streams "^4.3.1" + workbox-sw "^4.3.1" + workbox-window "^4.3.1" + +workbox-cacheable-response@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-cacheable-response/-/workbox-cacheable-response-4.3.1.tgz#f53e079179c095a3f19e5313b284975c91428c91" + integrity sha512-Rp5qlzm6z8IOvnQNkCdO9qrDgDpoPNguovs0H8C+wswLuPgSzSp9p2afb5maUt9R1uTIwOXrVQMmPfPypv+npw== + dependencies: + workbox-core "^4.3.1" + +workbox-core@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-core/-/workbox-core-4.3.1.tgz#005d2c6a06a171437afd6ca2904a5727ecd73be6" + integrity sha512-I3C9jlLmMKPxAC1t0ExCq+QoAMd0vAAHULEgRZ7kieCdUd919n53WC0AfvokHNwqRhGn+tIIj7vcb5duCjs2Kg== + +workbox-expiration@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-expiration/-/workbox-expiration-4.3.1.tgz#d790433562029e56837f341d7f553c4a78ebe921" + integrity sha512-vsJLhgQsQouv9m0rpbXubT5jw0jMQdjpkum0uT+d9tTwhXcEZks7qLfQ9dGSaufTD2eimxbUOJfWLbNQpIDMPw== + dependencies: + workbox-core "^4.3.1" + +workbox-google-analytics@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-google-analytics/-/workbox-google-analytics-4.3.1.tgz#9eda0183b103890b5c256e6f4ea15a1f1548519a" + integrity sha512-xzCjAoKuOb55CBSwQrbyWBKqp35yg1vw9ohIlU2wTy06ZrYfJ8rKochb1MSGlnoBfXGWss3UPzxR5QL5guIFdg== + dependencies: + workbox-background-sync "^4.3.1" + workbox-core "^4.3.1" + workbox-routing "^4.3.1" + workbox-strategies "^4.3.1" + +workbox-navigation-preload@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-navigation-preload/-/workbox-navigation-preload-4.3.1.tgz#29c8e4db5843803b34cd96dc155f9ebd9afa453d" + integrity sha512-K076n3oFHYp16/C+F8CwrRqD25GitA6Rkd6+qAmLmMv1QHPI2jfDwYqrytOfKfYq42bYtW8Pr21ejZX7GvALOw== + dependencies: + workbox-core "^4.3.1" + +workbox-precaching@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-precaching/-/workbox-precaching-4.3.1.tgz#9fc45ed122d94bbe1f0ea9584ff5940960771cba" + integrity sha512-piSg/2csPoIi/vPpp48t1q5JLYjMkmg5gsXBQkh/QYapCdVwwmKlU9mHdmy52KsDGIjVaqEUMFvEzn2LRaigqQ== + dependencies: + workbox-core "^4.3.1" + +workbox-range-requests@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-range-requests/-/workbox-range-requests-4.3.1.tgz#f8a470188922145cbf0c09a9a2d5e35645244e74" + integrity sha512-S+HhL9+iTFypJZ/yQSl/x2Bf5pWnbXdd3j57xnb0V60FW1LVn9LRZkPtneODklzYuFZv7qK6riZ5BNyc0R0jZA== + dependencies: + workbox-core "^4.3.1" + +workbox-routing@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-routing/-/workbox-routing-4.3.1.tgz#a675841af623e0bb0c67ce4ed8e724ac0bed0cda" + integrity sha512-FkbtrODA4Imsi0p7TW9u9MXuQ5P4pVs1sWHK4dJMMChVROsbEltuE79fBoIk/BCztvOJ7yUpErMKa4z3uQLX+g== + dependencies: + workbox-core "^4.3.1" + +workbox-strategies@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-strategies/-/workbox-strategies-4.3.1.tgz#d2be03c4ef214c115e1ab29c9c759c9fe3e9e646" + integrity sha512-F/+E57BmVG8dX6dCCopBlkDvvhg/zj6VDs0PigYwSN23L8hseSRwljrceU2WzTvk/+BSYICsWmRq5qHS2UYzhw== + dependencies: + workbox-core "^4.3.1" + +workbox-streams@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-streams/-/workbox-streams-4.3.1.tgz#0b57da70e982572de09c8742dd0cb40a6b7c2cc3" + integrity sha512-4Kisis1f/y0ihf4l3u/+ndMkJkIT4/6UOacU3A4BwZSAC9pQ9vSvJpIi/WFGQRH/uPXvuVjF5c2RfIPQFSS2uA== + dependencies: + workbox-core "^4.3.1" + +workbox-sw@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-sw/-/workbox-sw-4.3.1.tgz#df69e395c479ef4d14499372bcd84c0f5e246164" + integrity sha512-0jXdusCL2uC5gM3yYFT6QMBzKfBr2XTk0g5TPAV4y8IZDyVNDyj1a8uSXy3/XrvkVTmQvLN4O5k3JawGReXr9w== + +workbox-webpack-plugin@4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-webpack-plugin/-/workbox-webpack-plugin-4.3.1.tgz#47ff5ea1cc074b6c40fb5a86108863a24120d4bd" + integrity sha512-gJ9jd8Mb8wHLbRz9ZvGN57IAmknOipD3W4XNE/Lk/4lqs5Htw4WOQgakQy/o/4CoXQlMCYldaqUg+EJ35l9MEQ== + dependencies: + "@babel/runtime" "^7.0.0" + json-stable-stringify "^1.0.1" + workbox-build "^4.3.1" + +workbox-window@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/workbox-window/-/workbox-window-4.3.1.tgz#ee6051bf10f06afa5483c9b8dfa0531994ede0f3" + integrity sha512-C5gWKh6I58w3GeSc0wp2Ne+rqVw8qwcmZnQGpjiek8A2wpbxSJb1FdCoQVO+jDJs35bFgo/WETgl1fqgsxN0Hg== + dependencies: + workbox-core "^4.3.1" + +worker-farm@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8" + integrity sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw== + dependencies: + errno "~0.1.7" + +worker-rpc@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/worker-rpc/-/worker-rpc-0.1.1.tgz#cb565bd6d7071a8f16660686051e969ad32f54d5" + integrity sha512-P1WjMrUB3qgJNI9jfmpZ/htmBEjFh//6l/5y8SD9hg1Ef5zTTVVoRjTrTEzPrNBQvmhMxkoTsjOXN10GWU7aCg== + dependencies: + microevent.ts "~0.1.1" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write-file-atomic@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" + integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write-file-atomic@^2.0.0: + version "2.4.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write-file-atomic@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.1.tgz#558328352e673b5bb192cf86500d60b230667d4b" + integrity sha512-JPStrIyyVJ6oCSz/691fAjFtefZ6q+fP6tm+OS4Qw6o+TGQxNp1ziY2PgS+X/m0V8OWhZiO/m4xSj+Pr4RrZvw== + dependencies: + imurmurhash "^0.1.4" + is-typedarray "^1.0.0" + signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" + +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== + dependencies: + async-limiter "~1.0.0" + +ws@^6.1.0, ws@^6.1.2: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" + integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== + dependencies: + async-limiter "~1.0.0" + +xdg-basedir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" + integrity sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ= + +xdg-basedir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13" + integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q== + +xhr2-cookies@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz#7d77449d0999197f155cb73b23df72505ed89d48" + integrity sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg= + dependencies: + cookiejar "^2.1.1" + +xml-name-validator@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== + +xmlchars@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + +xregexp@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" + integrity sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg== + +xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= + +"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yamljs@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/yamljs/-/yamljs-0.3.0.tgz#dc060bf267447b39f7304e9b2bfbe8b5a7ddb03b" + integrity sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ== + dependencies: + argparse "^1.0.7" + glob "^7.0.5" + +yargs-parser@10.x, yargs-parser@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== + dependencies: + camelcase "^4.1.0" + +yargs-parser@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" + integrity sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo= + dependencies: + camelcase "^3.0.0" + +yargs@12.0.2: + version "12.0.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.2.tgz#fe58234369392af33ecbef53819171eff0f5aadc" + integrity sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ== + dependencies: + cliui "^4.0.0" + decamelize "^2.0.0" + find-up "^3.0.0" + get-caller-file "^1.0.1" + os-locale "^3.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1 || ^4.0.0" + yargs-parser "^10.1.0" + +yargs@^13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" + +yargs@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" + integrity sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg= + dependencies: + camelcase "^3.0.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.2" + which-module "^1.0.0" + y18n "^3.2.1" + yargs-parser "^5.0.0" + +yauzl@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.4.1.tgz#9528f442dab1b2284e58b4379bb194e22e0c4005" + integrity sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU= + dependencies: + fd-slicer "~1.0.1" + +yn@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== From 560ae6e0bc4efb7ec4b6d8f2e6e11c99eba5123c Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Fri, 7 Feb 2020 11:10:47 +0100 Subject: [PATCH 027/119] Remove block skips. --- src/test/contracts/bitwise_arithmetic.ligo | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/contracts/bitwise_arithmetic.ligo b/src/test/contracts/bitwise_arithmetic.ligo index 3b5c9d30d..ce40fab44 100644 --- a/src/test/contracts/bitwise_arithmetic.ligo +++ b/src/test/contracts/bitwise_arithmetic.ligo @@ -1,16 +1,16 @@ // Test PascaLIGO bitwise operators function or_op (const n : nat) : nat is - begin skip end with bitwise_or(n , 4n) + bitwise_or(n , 4n) function and_op (const n : nat) : nat is - begin skip end with bitwise_and(n , 7n) + bitwise_and(n , 7n) function xor_op (const n : nat) : nat is - begin skip end with bitwise_xor(n , 7n) + bitwise_xor(n , 7n) function lsl_op (const n : nat) : nat is - begin skip end with bitwise_lsl(n , 7n) + bitwise_lsl(n , 7n) function lsr_op (const n : nat) : nat is - begin skip end with bitwise_lsr(n , 7n) \ No newline at end of file + bitwise_lsr(n , 7n) \ No newline at end of file From 4c45eb9fb377e9dbdf55ab4894e80f11379ce8dd Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 7 Feb 2020 05:27:23 -0800 Subject: [PATCH 028/119] Add string reference page to docs --- gitlab-pages/docs/reference/string.md | 81 +++++++++++++++++++++++++++ src/test/md_file_tests.ml | 1 + 2 files changed, 82 insertions(+) create mode 100644 gitlab-pages/docs/reference/string.md diff --git a/gitlab-pages/docs/reference/string.md b/gitlab-pages/docs/reference/string.md new file mode 100644 index 000000000..84d54cfd2 --- /dev/null +++ b/gitlab-pages/docs/reference/string.md @@ -0,0 +1,81 @@ +--- +id: string-reference +title: String +--- + +## String.size(s: string) : nat + +Get the size of a string. [Michelson only supports ASCII strings](http://tezos.gitlab.io/whitedoc/michelson.html#constants) +so for now you can assume that each character takes one byte of storage. + + + + +```pascaligo +function string_size (const s: string) : nat is size(s) +``` + + +```cameligo +let size_op (s: string) : nat = String.size s +``` + + +```reasonligo +let size_op = (s: string): nat => String.size(s); +``` + + + +## String.length(s: string) : nat + +Alias for `String.size`. + +## String.slice(pos1: nat, pos2: nat, s: string) : string + +Get the substring of `s` between `pos1` inclusive and `pos2` inclusive. For example +the string "tata" given to the function below would return "at". + + + +```pascaligo +function slice_op (const s : string) : string is + begin skip end with string_slice(1n , 2n , s) +``` + +```cameligo +let slice_op (s: string) : string = String.slice 1n 2n s +``` + +```reasonligo +let slice_op = (s: string): string => String.slice(1n, 2n, s); +``` + + +## String.sub(pos1: nat, pos2: nat, s: string) : string + +Alias for `String.slice`. + +## String.concat(s1: string, s2: string) : string + +Concatenate two strings and return the result. + + + + +```pascaligo +function concat_op (const s : string) : string is + begin skip end with string_concat(s , "toto") +``` + + +```cameligo +let concat_syntax (s: string) = s ^ "test_literal" +``` + + +```reasonligo +let concat_syntax = (s: string) => s ++ "test_literal"; +``` + + diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 86aefeb89..f697a18d4 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -122,6 +122,7 @@ let md_files = [ "/gitlab-pages/docs/advanced/timestamps-addresses.md"; "/gitlab-pages/docs/api/cli-commands.md"; "/gitlab-pages/docs/api/cheat-sheet.md"; + "/gitlab-pages/docs/reference/string.md"; ] let md_root = "../../gitlab-pages/docs/language-basics/" From 54f4ffd413118f44f7872bb91cdf0b6ae5a33798 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 6 Feb 2020 11:53:50 +0100 Subject: [PATCH 029/119] Fix assetion with a default string "failed assertion" --- src/passes/operators/operators.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 9025b3295..142c3d087 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -1122,7 +1122,7 @@ module Compiler = struct | C_SIZE -> ok @@ simple_unary @@ prim I_SIZE | C_FAILWITH -> ok @@ simple_unary @@ prim I_FAILWITH | C_ASSERT_INFERRED -> ok @@ simple_binary @@ i_if (seq [i_failwith]) (seq [i_drop ; i_push_unit]) - | C_ASSERTION -> ok @@ simple_unary @@ i_if (seq [i_push_unit]) (seq [i_push_unit ; i_failwith]) + | C_ASSERTION -> ok @@ simple_unary @@ i_if (seq [i_push_unit]) (seq [i_push_string "failed assertion" ; i_failwith]) | C_INT -> ok @@ simple_unary @@ prim I_INT | C_ABS -> ok @@ simple_unary @@ prim I_ABS | C_IS_NAT -> ok @@ simple_unary @@ prim I_ISNAT From 5ef61d352028bb89cd0b5b34990a78bcb1268638 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 6 Feb 2020 12:05:13 +0100 Subject: [PATCH 030/119] add assert primitive for pascaligo --- src/bin/expect_tests/failwith_tests.ml | 36 ++++++++++++++++++++++++++ src/passes/operators/operators.ml | 3 ++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/bin/expect_tests/failwith_tests.ml diff --git a/src/bin/expect_tests/failwith_tests.ml b/src/bin/expect_tests/failwith_tests.ml new file mode 100644 index 000000000..d957f03c0 --- /dev/null +++ b/src/bin/expect_tests/failwith_tests.ml @@ -0,0 +1,36 @@ +open Cli_expect + +let contract basename = + "../../test/contracts/" ^ basename +let bad_contract basename = + "../../test/contracts/negative/" ^ basename + +let%expect_test _ = + run_ligo_good [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ] ; + [%expect {| + failwith("some_string") |}]; + + run_ligo_good [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ; "--format=json" ] ; + [%expect {| + {"status":"ok","content":"failwith(\"some_string\")"} |}]; + + + run_ligo_good [ "dry-run" ; contract "subtle_nontail_fail.mligo" ; "main" ; "()" ; "()" ] ; + [%expect {| + failwith("This contract always fails") |}]; + + run_ligo_good [ "interpret" ; "assert(1=1)" ; "--syntax=pascaligo" ] ; + [%expect {| + Unit |}]; + + run_ligo_good [ "interpret" ; "assert(1=2)" ; "--syntax=pascaligo" ] ; + [%expect {| + failwith("failed assertion") |}]; + + run_ligo_good [ "interpret" ; "assert(1=1)" ; "--syntax=cameligo" ] ; + [%expect {| + Unit |}]; + + run_ligo_good [ "interpret" ; "assert(1=2)" ; "--syntax=cameligo" ] ; + [%expect {| + failwith("failed assertion") |}]; diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 142c3d087..be1196ad1 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -66,7 +66,7 @@ module Simplify = struct module Pascaligo = struct let constants = function - | "get_force" -> ok C_MAP_FIND + | "assert" -> ok C_ASSERTION | "get_chain_id" -> ok C_CHAIN_ID | "transaction" -> ok C_CALL | "get_contract" -> ok C_CONTRACT @@ -106,6 +106,7 @@ module Simplify = struct | "list_iter" -> ok C_LIST_ITER | "list_fold" -> ok C_LIST_FOLD | "list_map" -> ok C_LIST_MAP + | "get_force" -> ok C_MAP_FIND | "map_iter" -> ok C_MAP_ITER | "map_map" -> ok C_MAP_MAP | "map_fold" -> ok C_MAP_FOLD From 7d94a41d92f013d48535073594ab9b279deec187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jev=20Bj=C3=B6rsell?= Date: Fri, 7 Feb 2020 08:01:07 -0800 Subject: [PATCH 031/119] Missed one stray environment variable --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8710225f7..dfd014a85 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -131,7 +131,7 @@ build-and-publish-latest-docker-image: - sh scripts/build_docker_image.sh - sh scripts/test_cli.sh - docker login -u $LIGO_REGISTRY_USER -p $LIGO_REGISTRY_PASSWORD - - docker push $LIGO_REGISTRY_IMAGE:next + - docker push $LIGO_REGISTRY_IMAGE_BASE_NAME:next only: - dev From 74198fd61f1955e5796bb6f298f902dfdc094d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jev=20Bj=C3=B6rsell?= Date: Fri, 7 Feb 2020 08:09:05 -0800 Subject: [PATCH 032/119] Add trigger to kick off the webide child ci pipeline --- .gitlab-ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfd014a85..73e26e8b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ variables: stages: - test + - ide - build_and_package_binaries - build_docker - build_and_deploy_docker @@ -141,7 +142,7 @@ build-and-package-debian-9: <<: *docker # To run in sequence and save CPU usage, use stage: build_and_package_binaries stage: test - variables: + variables: target_os_family: "debian" target_os: "debian" target_os_version: "9" @@ -153,7 +154,7 @@ build-and-package-debian-10: <<: *docker # To run in sequence and save CPU usage, use stage: build_and_package_binaries stage: test - variables: + variables: target_os_family: "debian" target_os: "debian" target_os_version: "10" @@ -169,7 +170,7 @@ build-and-package-ubuntu-18-04: <<: *docker # To run in sequence and save CPU usage, use stage: build_and_package_binaries stage: test - variables: + variables: target_os_family: "debian" target_os: "ubuntu" target_os_version: "18.04" @@ -181,7 +182,7 @@ build-and-package-ubuntu-19-04: <<: *docker # To run in sequence and save CPU usage, use stage: build_and_package_binaries stage: test - variables: + variables: target_os_family: "debian" target_os: "ubuntu" target_os_version: "19.04" @@ -189,6 +190,13 @@ build-and-package-ubuntu-19-04: only: - dev + +trigger-webide: + stage: ide + trigger: + include: tools/webide/webide-ci.yml + + # Pages are deployed from dev, be careful not to override 'next' # in case something gets merged into 'dev' while releasing. pages: From 613d7309c1237b9bad83a6b1d8a471725c0ec5a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jev=20Bj=C3=B6rsell?= Date: Fri, 7 Feb 2020 08:30:58 -0800 Subject: [PATCH 033/119] Update trigger to point to new private deploy repo. --- tools/webide/webide-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/webide/webide-ci.yml b/tools/webide/webide-ci.yml index af2364e74..3f7d68731 100644 --- a/tools/webide/webide-ci.yml +++ b/tools/webide/webide-ci.yml @@ -66,5 +66,5 @@ deploy-handoff: variables: IDE_DOCKER_IMAGE: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide" LIGO_COMMIT_REF_NAME: "${CI_COMMIT_REF_NAME}" - trigger: jevonearth/ligoweb-deploy + trigger: ligolang/ligo-webide-deploy From bffa1585b02358002fb43a23f553a6e63a7ddd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jev=20Bj=C3=B6rsell?= Date: Fri, 7 Feb 2020 09:14:50 -0800 Subject: [PATCH 034/119] Fix docker tag to use default docker hub registry Follow the same logic as `scripts/build_docker_image.sh` This could use some further refactoring simplification. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 73e26e8b9..fc95f2f4b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -132,7 +132,7 @@ build-and-publish-latest-docker-image: - sh scripts/build_docker_image.sh - sh scripts/test_cli.sh - docker login -u $LIGO_REGISTRY_USER -p $LIGO_REGISTRY_PASSWORD - - docker push $LIGO_REGISTRY_IMAGE_BASE_NAME:next + - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next only: - dev From fff734dd00c12acc227411686f3864a5b37347b2 Mon Sep 17 00:00:00 2001 From: Justin Wilson Date: Fri, 7 Feb 2020 14:24:15 -0700 Subject: [PATCH 035/119] Changes add function to a single tuple param, resolving example LIGO statement --- gitlab-pages/docs/language-basics/variables-and-constants.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab-pages/docs/language-basics/variables-and-constants.md b/gitlab-pages/docs/language-basics/variables-and-constants.md index 372f30180..d2746d827 100644 --- a/gitlab-pages/docs/language-basics/variables-and-constants.md +++ b/gitlab-pages/docs/language-basics/variables-and-constants.md @@ -88,7 +88,7 @@ with a new value being bound in place of the old one. ```cameligo -let add (a: int) (b: int) : int = +let add (a,b: int * int): int = let c : int = a + b in c ``` From 02c59db8b8d5b2d8b1189949d23d44468470a18f Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 7 Feb 2020 14:03:57 -0800 Subject: [PATCH 036/119] Simplify a few pascaligo functions in string reference page --- gitlab-pages/docs/reference/string.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gitlab-pages/docs/reference/string.md b/gitlab-pages/docs/reference/string.md index 84d54cfd2..4b64bbc4b 100644 --- a/gitlab-pages/docs/reference/string.md +++ b/gitlab-pages/docs/reference/string.md @@ -39,8 +39,7 @@ the string "tata" given to the function below would return "at". ```pascaligo -function slice_op (const s : string) : string is - begin skip end with string_slice(1n , 2n , s) +function slice_op (const s : string) : string is string_slice(1n , 2n , s) ``` ```cameligo @@ -64,8 +63,7 @@ Concatenate two strings and return the result. ```pascaligo -function concat_op (const s : string) : string is - begin skip end with string_concat(s , "toto") +function concat_op (const s : string) : string is s ^ "toto" ``` From 8db8f6f03971d338814c75cfff03cb6a3f72b3d2 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 7 Feb 2020 20:17:13 -0800 Subject: [PATCH 037/119] Add list reference page to docs and add unit tests for List.size --- gitlab-pages/docs/reference/list.md | 140 ++++++++++++++++++++++++++++ src/test/contracts/list.ligo | 3 +- src/test/contracts/list.mligo | 2 + src/test/contracts/list.religo | 2 + src/test/integration_tests.ml | 2 + src/test/md_file_tests.ml | 1 + 6 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 gitlab-pages/docs/reference/list.md diff --git a/gitlab-pages/docs/reference/list.md b/gitlab-pages/docs/reference/list.md new file mode 100644 index 000000000..569c7f013 --- /dev/null +++ b/gitlab-pages/docs/reference/list.md @@ -0,0 +1,140 @@ +--- +id: list-reference +title: List +--- + +## List.size(lst: a' list) : nat + +Get the number of elements in a list. + + + + +```pascaligo +function size_ (const m : list(int)) : nat is size(m) +``` + + +```cameligo +let size_ (s: int list) : nat = List.size s +``` + + +```reasonligo +let size_ = (s: list(int)): nat => List.size(s); +``` + + + +## List.length(lst: a' list) : nat + +Alias of `List.size`. + +## List.map(map_function: a' -> a', lst: a' list) : 'a list + +Apply an operation defined by `map_function` to each element of a list and return +a list of the modified elements. + + + +```pascaligo group=b +function increment(const i: int): int is block { skip } with i + 1; +// Creates a new list with elements incremented by 1 +const incremented_list: list(int) = list_map(increment, list 1; 2; 3; end ); +``` + + + +```cameligo group=b +let increment (i: int) : int = i + 1 +(* Creates a new list with elements incremented by 1 *) +let incremented_list: int list = List.map increment [1; 2; 3] +``` + + + + +```reasonligo group=b +let increment = (i: int): int => i + 1; +(* Creates a new list with elements incremented by 1 *) +let incremented_list: list(int) = List.map(increment, [1, 2, 3]); +``` + + + +## List.iter(iter_function: a' -> unit, lst: a' list) : unit + +Apply a side effecting function `iter_function` to each element of a list with no +return value. This is useful for asserting that each element of a list satisfies +a particular property. + + + + +```pascaligo +function iter_op (const s : list(int)) : int is + begin + var r : int := 0 ; + function aggregate (const i : int) : unit is + begin + r := r + i ; + end with unit ; + list_iter(aggregate, s) ; + end with r +``` + + +```cameligo +let iter_op (s : int list) : unit = + let do_nothing = fun (_: int) -> unit + in List.iter do_nothing s +``` + + +```reasonligo +let iter_op = (s: list(int)): unit => { + let do_nothing = (z: int) => unit; + List.iter(do_nothing, s); +}; +``` + + + +## List.fold(fold_function: (a' * a') -> a', lst: a' list, acc: a') : 'a + +Combine the elements of a list into one value using the operation defined by +`fold_function'. For example, you could define summation by folding a list of +integers. Starting with some initial accumulator value `acc`, the fold: + +1. Consumes an element of the list. +2. Passes the accumulator value to `fold_function` along with the element to produce +a new accumulated value. +3. The new accumulated value replaces the previous one. +4. IF there are still elements in the list go back to 1, ELSE return the accumulator + +Summation would be defined then by using a `fold_function` that takes two integers and +adds them together. Each step of the fold would consume an element from the list +and add it to the total until you've summed over the list. + + + +```pascaligo group=b +function sum(const result: int; const i: int): int is result + i; +const sum_of_a_list: int = list_fold(sum, list 1; 2; 3; end, 0); +``` + + + +```cameligo group=b +let sum (result, i: int * int) : int = result + i +let sum_of_a_list: int = List.fold sum [1; 2; 3] 0 +``` + + + +```reasonligo group=b +let sum = ((result, i): (int, int)): int => result + i; +let sum_of_a_list: int = List.fold(sum, [1, 2, 3], 0); +``` + + diff --git a/src/test/contracts/list.ligo b/src/test/contracts/list.ligo index 77f8beec3..2e02c2e85 100644 --- a/src/test/contracts/list.ligo +++ b/src/test/contracts/list.ligo @@ -11,8 +11,7 @@ const fb2 : foobar = 144 # fb const fb3 : foobar = cons(688 , fb2) -function size_ (const m : foobar) : nat is - block {skip} with (size(m)) +function size_ (const m : foobar) : nat is size(m) // function hdf (const m : foobar) : int is begin skip end with hd(m) diff --git a/src/test/contracts/list.mligo b/src/test/contracts/list.mligo index dfcad6a0b..06a914514 100644 --- a/src/test/contracts/list.mligo +++ b/src/test/contracts/list.mligo @@ -13,6 +13,8 @@ let main (p, s: param * storage) = | hd::tl -> s.0 + hd, tl in ([] : operation list), storage +let size_ (s: int list) : nat = List.size s + let fold_op (s: int list) : int = let aggregate = fun (t: int * int) -> t.0 + t.1 in List.fold aggregate s 10 diff --git a/src/test/contracts/list.religo b/src/test/contracts/list.religo index c54a445fc..9f9a2ec1c 100644 --- a/src/test/contracts/list.religo +++ b/src/test/contracts/list.religo @@ -17,6 +17,8 @@ let main2 = (p: param, storage) => { let main = (x: (param, storage)) => main2(x[0],x[1]); +let size_ = (s: list(int)): nat => List.size(s); + let fold_op = (s: list(int)): int => { let aggregate = (prec_cur: (int, int)) => prec_cur[0] + prec_cur[1]; List.fold(aggregate, s, 10); diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 13d03872e..46777e09a 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1564,6 +1564,7 @@ let match_matej_re () : unit result = let mligo_list () : unit result = let%bind program = mtype_file "./contracts/list.mligo" in + let%bind () = expect_eq program "size_" (e_list [e_int 0; e_int 1; e_int 2]) (e_nat 3) in let aux lst = e_list @@ List.map e_int lst in let%bind () = expect_eq program "fold_op" (aux [ 1 ; 2 ; 3 ]) (e_int 16) in let%bind () = @@ -1585,6 +1586,7 @@ let mligo_list () : unit result = let religo_list () : unit result = let%bind program = retype_file "./contracts/list.religo" in + let%bind () = expect_eq program "size_" (e_list [e_int 0; e_int 1; e_int 2]) (e_nat 3) in let aux lst = e_list @@ List.map e_int lst in let%bind () = expect_eq program "fold_op" (aux [ 1 ; 2 ; 3 ]) (e_int 16) in let%bind () = diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 86aefeb89..91419879a 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -122,6 +122,7 @@ let md_files = [ "/gitlab-pages/docs/advanced/timestamps-addresses.md"; "/gitlab-pages/docs/api/cli-commands.md"; "/gitlab-pages/docs/api/cheat-sheet.md"; + "/gitlab-pages/docs/reference/list.md"; ] let md_root = "../../gitlab-pages/docs/language-basics/" From 0ce2a603a347ac37b064b8ba2e0ab141add1367c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Sun, 9 Feb 2020 00:19:43 +0100 Subject: [PATCH 038/119] Fix "hanging sudo" bug. --- scripts/installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 scripts/installer.sh diff --git a/scripts/installer.sh b/scripts/installer.sh old mode 100755 new mode 100644 index c8623c6a7..ca7c17b83 --- a/scripts/installer.sh +++ b/scripts/installer.sh @@ -62,7 +62,7 @@ else # && redirect the output of the wget download to the temporary file # ) || clean up temporary file if any command in the previous block failed - wget "$url" -O - \ + (wget "$url" -O - 2>/dev/null || echo "ERROR: wget $url failed.") \ | sed -e "s/next/$version/g" \ | sudo sh -c ' \ ( \ From ae82144418fe9f1f7102fb0b51b5f551bfcfa32e Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Wed, 4 Dec 2019 18:30:52 +0100 Subject: [PATCH 039/119] removing assign, tuples, sequences, --- src/bin/cli.ml | 3 +- src/bin/expect_tests/contract_tests.ml | 841 ++++++++++-------- src/bin/expect_tests/failwith_tests.ml | 4 +- src/bin/expect_tests/literals.ml | 4 +- src/bin/expect_tests/misc_cli_commands.ml | 2 +- src/bin/expect_tests/typer_error_tests.ml | 2 +- src/main/compile/of_simplified.ml | 8 +- src/main/compile/of_typed.ml | 18 +- src/main/compile/wrapper.ml | 12 + src/main/uncompile/uncompile.ml | 6 +- src/passes/1-parser/cameligo/AST.ml | 8 +- src/passes/1-parser/pascaligo/AST.ml | 3 + src/passes/2-simplify/cameligo.ml | 42 +- src/passes/2-simplify/pascaligo.ml | 688 +++++++------- src/passes/3-self_ast_simplified/helpers.ml | 217 +++-- src/passes/3-self_ast_simplified/literals.ml | 31 +- .../3-self_ast_simplified/none_variant.ml | 8 +- .../self_ast_simplified.ml | 2 + .../tezos_type_annotation.ml | 10 +- src/passes/4-typer-new/PP.ml | 1 - src/passes/4-typer-new/solver.ml | 165 ++-- src/passes/4-typer-new/typer.ml | 374 ++++---- src/passes/4-typer-new/typer.mli | 12 +- src/passes/4-typer-old/typer.ml | 478 +++++----- src/passes/4-typer-old/typer.mli | 8 +- src/passes/4-typer/typer.mli | 4 +- src/passes/6-transpiler/helpers.ml | 10 +- src/passes/6-transpiler/transpiler.ml | 280 ++---- src/passes/6-transpiler/transpiler.mli | 10 +- src/passes/6-transpiler/untranspiler.ml | 35 +- src/passes/7-self_mini_c/helpers.ml | 16 +- .../7-self_mini_c/michelson_restrictions.ml | 2 +- src/passes/7-self_mini_c/self_mini_c.ml | 19 +- src/passes/7-self_mini_c/subst.ml | 24 +- src/passes/8-compiler/compiler_environment.ml | 2 +- src/passes/8-compiler/compiler_program.ml | 14 +- src/passes/8-compiler/compiler_program.mli | 2 +- src/passes/8-compiler/compiler_type.ml | 98 +- src/passes/operators/helpers.ml | 36 +- src/passes/operators/helpers.mli | 48 +- src/passes/operators/operators.ml | 90 +- src/passes/operators/operators.mli | 15 +- src/stages/ast_simplified/PP.ml | 186 ++-- src/stages/ast_simplified/PP.mli | 47 - src/stages/ast_simplified/ast_simplified.ml | 4 +- src/stages/ast_simplified/combinators.ml | 148 +-- src/stages/ast_simplified/combinators.mli | 40 +- src/stages/ast_simplified/misc.ml | 47 +- src/stages/ast_simplified/misc.mli | 1 - src/stages/ast_simplified/types.ml | 143 +-- src/stages/ast_typed/PP.ml | 126 ++- src/stages/ast_typed/PP.mli | 33 - src/stages/ast_typed/combinators.ml | 258 +++--- src/stages/ast_typed/combinators.mli | 267 +++--- .../ast_typed/combinators_environment.ml | 3 +- .../ast_typed/combinators_environment.mli | 35 +- src/stages/ast_typed/environment.ml | 32 +- src/stages/ast_typed/environment.mli | 24 +- src/stages/ast_typed/misc.ml | 161 ++-- src/stages/ast_typed/misc.mli | 27 +- src/stages/ast_typed/misc_smart.ml | 64 +- src/stages/ast_typed/misc_smart.mli | 3 +- src/stages/ast_typed/types.ml | 193 ++-- src/stages/common/PP.ml | 210 +++-- src/stages/common/PP.mli | 16 - src/stages/common/ast_common.ml | 2 +- src/stages/common/helpers.ml | 30 + src/stages/common/misc.ml | 94 -- src/stages/common/misc.mli | 9 - src/stages/common/types.ml | 236 +++-- src/stages/mini_c/PP.ml | 199 ++++- src/stages/mini_c/PP.mli | 2 + src/stages/mini_c/combinators.ml | 10 +- src/stages/mini_c/misc.ml | 4 +- src/stages/mini_c/types.ml | 21 +- src/stages/typesystem/core.ml | 52 +- src/stages/typesystem/misc.ml | 189 ++-- src/stages/typesystem/shorthands.ml | 12 +- src/test/coase_tests.ml | 18 +- src/test/contracts/bytes_unpack.ligo | 2 +- src/test/contracts/key_hash.ligo | 2 +- src/test/contracts/key_hash.mligo | 2 +- src/test/contracts/option.ligo | 2 +- src/test/id_tests.ml | 56 +- src/test/integration_tests.ml | 38 +- src/test/multisig_tests.ml | 4 +- src/test/multisig_v2_tests.ml | 4 +- src/test/test_helpers.ml | 3 +- src/test/time_lock_repeat_tests.ml | 2 +- src/test/typer_tests.ml | 12 +- src/test/vote_tests.ml | 4 +- vendors/ligo-utils/simple-utils/var.ml | 5 + vendors/ligo-utils/simple-utils/var.mli | 3 +- 93 files changed, 3395 insertions(+), 3342 deletions(-) create mode 100644 src/main/compile/wrapper.ml delete mode 100644 src/stages/ast_simplified/PP.mli delete mode 100644 src/stages/ast_typed/PP.mli delete mode 100644 src/stages/common/PP.mli create mode 100644 src/stages/common/helpers.ml delete mode 100644 src/stages/common/misc.ml delete mode 100644 src/stages/common/misc.mli diff --git a/src/bin/cli.ml b/src/bin/cli.ml index 3356401b2..21f888c07 100644 --- a/src/bin/cli.ml +++ b/src/bin/cli.ml @@ -259,7 +259,7 @@ let interpret = let%bind failstring = Run.failwith_to_string fail_res in ok @@ Format.asprintf "%s" failstring | Success value' -> - let%bind simplified_output = Uncompile.uncompile_expression typed_exp.type_annotation value' in + let%bind simplified_output = Uncompile.uncompile_expression typed_exp.type_expression value' in ok @@ Format.asprintf "%a\n" Ast_simplified.PP.expression simplified_output in let term = @@ -342,6 +342,7 @@ let run_function = let env = Ast_typed.program_environment typed_prg in let%bind mini_c_prg = Compile.Of_typed.compile typed_prg in + let%bind simplified_param = Compile.Of_source.compile_expression v_syntax parameter in let%bind app = Compile.Of_simplified.apply entry_point simplified_param in let%bind (typed_app,_) = Compile.Of_simplified.compile_expression ~env ~state app in diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index cc0b054d2..812278a43 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -7,13 +7,13 @@ let bad_contract basename = let%expect_test _ = run_ligo_good [ "measure-contract" ; contract "coase.ligo" ; "main" ] ; - [%expect {| 2062 bytes |}] ; + [%expect {| 1747 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig.ligo" ; "main" ] ; - [%expect {| 1093 bytes |}] ; + [%expect {| 1358 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ; - [%expect {| 2713 bytes |}] ; + [%expect {| 3294 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ; [%expect {| 642 bytes |}] ; @@ -97,65 +97,56 @@ let%expect_test _ = COMPARE ; GT ; IF { PUSH string "Not enough money" ; FAILWITH } { PUSH unit Unit } ; - DROP ; - NIL operation ; DIP 2 { DUP } ; DIG 2 ; - CDR ; - PUSH nat 1 ; - ADD ; - DIP { DIP 2 { DUP } ; DIG 2 ; CAR } ; - SWAP ; - PAIR ; - DIP 3 { DROP } ; - DUG 2 ; DIP 3 { DUP } ; DIG 3 ; - CAR ; - CAR ; - DIP 5 { DUP } ; - DIG 5 ; - DIP { DIP 3 { DUP } ; DIG 3 ; SOME ; DIP { DUP } } ; - UPDATE ; - DIP { DROP } ; - DUP ; - DIP { DIP 4 { DUP } ; DIG 4 ; DUP ; CDR ; SWAP ; CAR ; CDR } ; - PAIR ; - PAIR ; - DIP 5 { DROP } ; - DUG 4 ; - DIP 4 { DUP } ; - DIG 4 ; - CAR ; - CDR ; - DIP 5 { DUP } ; - DIG 5 ; - CDR ; - DIP { DIP 6 { DUP } ; DIG 6 ; SOURCE ; PAIR ; SOME ; DIP { DUP } } ; - UPDATE ; - DIP { DROP } ; - DUP ; - DIP { DIP 5 { DUP } ; DIG 5 ; DUP ; CDR ; SWAP ; CAR ; CAR } ; - SWAP ; - PAIR ; - PAIR ; - DIP 6 { DROP } ; - DUG 5 ; - DIP 5 { DUP } ; - DIG 5 ; CDR ; PUSH nat 1 ; ADD ; - DIP { DIP 5 { DUP } ; DIG 5 ; CAR } ; + SWAP ; + CAR ; + PAIR ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 6 { DUP } ; + DIG 6 ; + DIP { DIP { DUP } ; + SWAP ; + SOME ; + DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CAR } } ; + UPDATE ; + DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; + PAIR ; + PAIR ; + DUP ; + DIP { DUP } ; + SWAP ; + CDR ; + DIP { DIP 7 { DUP } ; + DIG 7 ; + SOURCE ; + PAIR ; + SOME ; + DIP { DIP { DUP } ; SWAP ; CAR ; CDR } } ; + UPDATE ; + DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; - DIP 6 { DROP } ; - DUG 5 ; - DIP 2 { DUP } ; - DIG 2 ; - DIP { DIP 5 { DUP } ; DIG 5 } ; PAIR ; - DIP { DROP 9 } } + DUP ; + DIP { DUP } ; + SWAP ; + CDR ; + PUSH nat 1 ; + ADD ; + SWAP ; + CAR ; + PAIR ; + DUP ; + NIL operation ; + PAIR ; + DIP { DROP 11 } } { DUP ; DIP { DIP 2 { DUP } ; DIG 2 } ; PAIR ; @@ -177,54 +168,40 @@ let%expect_test _ = NEQ ; IF { PUSH string "This card doesn't belong to you" ; FAILWITH } { PUSH unit Unit } ; - DROP ; - DUP ; + DIP { DUP } ; + SWAP ; CDR ; - DIP { DIP { DUP } ; SWAP ; CAR ; CAR } ; + DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CAR } ; GET ; IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; + DIP { DUP } ; + SWAP ; CDR ; PUSH nat 1 ; SWAP ; SUB ; ABS ; - DIP { DUP ; CAR } ; SWAP ; + CAR ; PAIR ; - DIP { DROP } ; - DIP 2 { DUP } ; - DIG 2 ; - CAR ; - CAR ; - DIP 2 { DUP } ; - DIG 2 ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 4 { DUP } ; + DIG 4 ; CDR ; - DIP { DIP { DUP } ; SWAP ; SOME ; DIP { DUP } } ; + DIP { DIP { DUP } ; + SWAP ; + SOME ; + DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CAR } } ; UPDATE ; - DIP { DROP } ; - DUP ; - DIP { DIP 3 { DUP } ; DIG 3 ; DUP ; CDR ; SWAP ; CAR ; CDR } ; + DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; - DIP 4 { DROP } ; - DUG 3 ; - DIP 3 { DUP } ; - DIG 3 ; - CAR ; - CDR ; - DIP 5 { DUP } ; - DIG 5 ; - DIP { DUP ; NONE (pair (address %card_owner) (nat %card_pattern)) } ; + DIP 6 { DUP } ; + DIG 6 ; + DIP { DUP ; CAR ; CDR ; NONE (pair (address %card_owner) (nat %card_pattern)) } ; UPDATE ; - DIP { DROP } ; - DUP ; - DIP { DIP 4 { DUP } ; DIG 4 ; DUP ; CDR ; SWAP ; CAR ; CAR } ; - SWAP ; - PAIR ; - PAIR ; - DIP 5 { DROP } ; - DUG 4 ; DIP 2 { DUP } ; DIG 2 ; CAR ; @@ -242,9 +219,16 @@ let%expect_test _ = NIL operation ; SWAP ; CONS ; - DIP { DIP 7 { DUP } ; DIG 7 } ; + DIP { DIP 4 { DUP } ; + DIG 4 ; + DIP 4 { DUP } ; + DIG 4 ; + DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; + SWAP ; + PAIR ; + PAIR } ; PAIR ; - DIP { DROP 11 } } ; + DIP { DROP 13 } } ; DIP { DROP } } { DUP ; DIP { DIP { DUP } ; SWAP } ; @@ -271,33 +255,30 @@ let%expect_test _ = NEQ ; IF { PUSH string "This card doesn't belong to you" ; FAILWITH } { PUSH unit Unit } ; - DROP ; - DIP 3 { DUP } ; - DIG 3 ; - CDR ; - DIP { DUP ; CDR } ; - PAIR ; - DIP { DROP } ; DIP 3 { DUP } ; DIG 3 ; + DIP 5 { DUP } ; + DIG 5 ; CAR ; - DIP { DUP ; SOME ; DIP { DIP { DUP } ; SWAP } } ; + DIP { DIP 2 { DUP } ; + DIG 2 ; + DIP 6 { DUP } ; + DIG 6 ; + CDR ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + SOME ; + DIP { DIP 3 { DUP } ; DIG 3 } } ; UPDATE ; - DIP { DIP { DUP } ; SWAP ; DROP } ; - SWAP ; - DIP { DIP { DROP } ; DUP } ; - SWAP ; - DIP { DIP 2 { DUP } ; DIG 2 ; DUP ; CDR ; SWAP ; CAR ; CAR } ; + DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; PAIR ; - DIP 3 { DROP } ; - DUG 2 ; - DIP 2 { DUP } ; - DIG 2 ; NIL operation ; PAIR ; - DIP { DROP 6 } } ; + DIP { DROP 7 } } ; DIP { DROP 2 } } } |} ] let%expect_test _ = @@ -305,7 +286,7 @@ let%expect_test _ = [%expect {| { parameter (pair (pair (nat %counter) (lambda %message unit (list operation))) - (list %signatures (pair key_hash signature))) ; + (list %signatures (pair (key_hash %0) (signature %1)))) ; storage (pair (pair (list %auth key) (nat %counter)) (pair (string %id) (nat %threshold))) ; code { DUP ; @@ -321,112 +302,170 @@ let%expect_test _ = SWAP ; CAR ; CDR ; - DIP 2 { DUP } ; - DIG 2 ; + DUP ; + DIP { DIP 2 { DUP } ; DIG 2 } ; + PAIR ; + DIP { DIP { DUP } ; SWAP } ; + PAIR ; + DIP 3 { DUP } ; + DIG 3 ; CAR ; CAR ; - DIP { DIP { DUP } ; SWAP ; CAR ; CDR } ; + DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CDR } ; COMPARE ; NEQ ; IF { PUSH string "Counters does not match" ; FAILWITH } - { DUP ; - DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CAR } ; - PAIR ; - DIP { DIP { DUP } ; SWAP ; CDR ; CAR ; CHAIN_ID ; SWAP ; PAIR } ; - PAIR ; - PACK ; - PUSH nat 0 ; - DIP 3 { DUP } ; + { DIP 3 { DUP } ; DIG 3 ; - CAR ; - CAR ; - DIP 5 { DUP } ; - DIG 5 ; CDR ; - DIP { DUP ; DIP { DIP { DUP } ; SWAP } ; PAIR } ; + DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CAR ; PUSH nat 0 ; SWAP ; PAIR } ; ITER { SWAP ; PAIR ; DUP ; CAR ; - DIP { DUP } ; - SWAP ; - CDR ; + CAR ; DIP { DUP } ; SWAP ; CAR ; + CDR ; + DIP 2 { DUP } ; + DIG 2 ; + CDR ; + DIP 2 { DUP } ; + DIG 2 ; + DIP { DIP { DUP } ; SWAP } ; + PAIR ; + DIP 3 { DUP } ; + DIG 3 ; IF_CONS - { DIP { DUP } ; - SWAP ; - DIP { DIP 3 { DUP } ; DIG 3 ; CDR } ; - PAIR ; - DIP 4 { DROP } ; - DUG 3 ; - DIP 2 { DUP } ; - DIG 2 ; + { DIP 4 { DUP } ; + DIG 4 ; + DIP 4 { DUP } ; + DIG 4 ; CAR ; - DIP { DUP ; HASH_KEY } ; + DIP { DIP { DUP } ; SWAP ; HASH_KEY } ; COMPARE ; EQ ; - IF { DUP ; - DIP { DIP 2 { DUP } ; DIG 2 ; CDR ; DIP { DIP 7 { DUP } ; DIG 7 } } ; + IF { DIP 5 { DUP } ; + DIG 5 ; + DIP 2 { DUP } ; + DIG 2 ; + DIP { DIP 5 { DUP } ; + DIG 5 ; + CDR ; + DIP { DIP 10 { DUP } ; + DIG 10 ; + DIP { DIP 12 { DUP } ; DIG 12 ; CAR ; CAR } ; + PAIR ; + DIP { DIP 11 { DUP } ; DIG 11 ; CDR ; CAR ; CHAIN_ID ; SWAP ; PAIR } ; + PAIR ; + PACK } } ; CHECK_SIGNATURE ; - IF { DIP 3 { DUP } ; - DIG 3 ; - CDR ; + IF { DIP 6 { DUP } ; + DIG 6 ; PUSH nat 1 ; ADD ; - DIP { DIP 3 { DUP } ; DIG 3 ; CAR } ; + DIP { DUP } ; SWAP ; - PAIR ; - DIP 4 { DROP } ; - DUG 3 ; - PUSH unit Unit } - { PUSH string "Invalid signature" ; FAILWITH } } - { PUSH unit Unit } ; - DIP { DROP 2 } } - { PUSH unit Unit } ; - DROP ; + DIP { DUP } ; + SWAP ; + DIP { DROP 2 } } + { PUSH string "Invalid signature" ; FAILWITH } ; + DIP { DROP ; DUP } ; + SWAP ; + DIP { DUP } ; + SWAP ; + DIP { DROP 2 } } + { DUP } ; + DIP { DROP } ; + DIP 3 { DUP } ; + DIG 3 ; + DIP 3 { DUP } ; + DIG 3 ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + CAR ; + DIP { DUP } ; + PAIR ; + DIP { DROP 3 } } + { DUP } ; + DIP { DROP } ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 5 { DUP } ; + DIG 5 ; + CAR ; + DIP 2 { DUP } ; + DIG 2 ; + CDR ; + SWAP ; + CAR ; + PAIR ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + DUP ; DIP { DUP } ; SWAP ; - DIP { DROP 3 } } ; - DUP ; - CAR ; - DIP { DIP { DUP } ; SWAP ; DROP } ; - SWAP ; - DIP { DIP { DROP } } ; - DUP ; - CDR ; - DIP { DIP 2 { DUP } ; DIG 2 ; DROP } ; - DIP 3 { DROP } ; - DUG 2 ; - DROP ; + CAR ; + DIP 3 { DUP } ; + DIG 3 ; + CAR ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + CAR ; + DIP { DROP 6 } } ; + DIP 3 { DUP } ; + DIG 3 ; DIP { DUP } ; SWAP ; + CDR ; DIP { DIP 4 { DUP } ; DIG 4 ; CDR ; CDR } ; COMPARE ; LT ; IF { PUSH string "Not enough signatures passed the check" ; FAILWITH } { DIP 4 { DUP } ; DIG 4 ; + DIP 5 { DUP } ; + DIG 5 ; CAR ; CDR ; PUSH nat 1 ; ADD ; - DIP { DIP 4 { DUP } ; DIG 4 ; DUP ; CDR ; SWAP ; CAR ; CAR } ; + DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; PAIR ; - DIP 5 { DROP } ; - DUG 4 ; - PUSH unit Unit } ; - DIP { DROP 3 } } ; - DROP ; + DIP { DUP } ; + SWAP ; + DIP { DUP } ; + SWAP ; + DIP { DROP 2 } } ; + DIP { DROP } ; + DIP 2 { DUP } ; + DIG 2 ; + CAR ; + DIP { DUP } ; + PAIR ; + DIP { DROP 2 } } ; + DIP { DROP } ; DUP ; + CAR ; + CAR ; UNIT ; EXEC ; - DIP { DIP { DUP } ; SWAP } ; + DIP { DUP ; CDR } ; PAIR ; - DIP { DROP 5 } } } |} ] + DIP { DROP 6 } } } |} ] let%expect_test _ = run_ligo_good [ "compile-contract" ; contract "multisig-v2.ligo" ; "main" ] ; @@ -461,28 +500,31 @@ let%expect_test _ = MEM ; NOT ; IF { PUSH string "Unauthorized address" ; FAILWITH } { PUSH unit Unit } ; - DROP ; - DIP { DUP } ; - SWAP ; + DIP 2 { DUP } ; + DIG 2 ; CAR ; DUP ; PACK ; DUP ; SIZE ; - DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CAR ; CDR } ; + DIP { DIP 3 { DUP } ; DIG 3 ; CAR ; CAR ; CDR } ; COMPARE ; GT ; IF { PUSH string "Message size exceed maximum limit" ; FAILWITH } { PUSH unit Unit } ; - DROP ; - DUP ; + DIP 4 { DUP } ; + DIG 4 ; EMPTY_SET address ; - SWAP ; - DIP { DIP 3 { DUP } ; DIG 3 ; CAR ; CDR ; CDR } ; + PAIR ; + DIP 2 { DUP } ; + DIG 2 ; + DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CDR ; CDR } ; GET ; IF_NONE - { DIP 3 { DUP } ; - DIG 3 ; + { DIP 5 { DUP } ; + DIG 5 ; + DIP 6 { DUP } ; + DIG 6 ; CDR ; CAR ; CAR ; @@ -492,38 +534,39 @@ let%expect_test _ = PUSH nat 1 ; ADD ; SOME ; - DIP { DIP 3 { DUP } ; DIG 3 ; CDR ; CAR ; CAR } ; + DIP { DIP 6 { DUP } ; DIG 6 ; CDR ; CAR ; CAR } ; SENDER ; UPDATE ; - DIP { DIP 3 { DUP } ; - DIG 3 ; - DUP ; - CAR ; - SWAP ; - CDR ; - DUP ; - CDR ; - SWAP ; - CAR ; - CDR } ; + DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; SWAP ; PAIR ; - DIP 4 { DROP } ; - DUG 3 ; + DIP { DUP } ; + SWAP ; + CAR ; + DIP { DUP } ; + PAIR ; EMPTY_SET address ; PUSH bool True ; SENDER ; UPDATE ; - DIP { DROP } ; - PUSH unit Unit } - { DUP ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + DIP { DROP } } + { DIP 6 { DUP } ; + DIG 6 ; + DIP { DUP } ; + SWAP ; SENDER ; MEM ; - IF { PUSH unit Unit } - { DIP 4 { DUP } ; - DIG 4 ; + IF { DUP } + { DIP 7 { DUP } ; + DIG 7 ; + DIP 8 { DUP } ; + DIG 8 ; CDR ; CAR ; CAR ; @@ -533,40 +576,42 @@ let%expect_test _ = PUSH nat 1 ; ADD ; SOME ; - DIP { DIP 4 { DUP } ; DIG 4 ; CDR ; CAR ; CAR } ; + DIP { DIP 8 { DUP } ; DIG 8 ; CDR ; CAR ; CAR } ; SENDER ; UPDATE ; - DIP { DIP 4 { DUP } ; - DIG 4 ; - DUP ; - CAR ; - SWAP ; - CDR ; - DUP ; - CDR ; - SWAP ; - CAR ; - CDR } ; + DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; SWAP ; PAIR ; - DIP 5 { DROP } ; - DUG 4 ; - PUSH unit Unit } ; - DROP ; - DUP ; + DIP { DUP } ; + SWAP ; + DIP { DUP } ; + SWAP ; + DIP { DROP 2 } } ; + DIP { DROP } ; + DIP 2 { DUP } ; + DIG 2 ; + CAR ; + DIP { DUP } ; + PAIR ; + DIP 2 { DUP } ; + DIG 2 ; PUSH bool True ; SENDER ; UPDATE ; - DIP { DIP { DUP } ; SWAP ; DROP } ; SWAP ; - DROP ; - DIP { DROP } ; - PUSH unit Unit } ; - DROP ; - DIP 3 { DUP } ; - DIG 3 ; + CDR ; + SWAP ; + PAIR ; + DIP { DROP 2 } } ; + DIP { DROP } ; + DUP ; + CAR ; + DIP { DUP } ; + SWAP ; + CDR ; + DUP ; CDR ; CAR ; CAR ; @@ -574,81 +619,64 @@ let%expect_test _ = GET ; IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; - DIP { DIP 4 { DUP } ; DIG 4 ; CAR ; CDR ; CAR } ; + DIP { DIP { DUP } ; SWAP ; CAR ; CDR ; CAR } ; COMPARE ; GT ; IF { PUSH string "Maximum number of proposal reached" ; FAILWITH } { PUSH unit Unit } ; - DROP ; - NIL operation ; - DIP 2 { DUP } ; - DIG 2 ; + DIP 7 { DUP } ; + DIG 7 ; + DIP { DIP 3 { DUP } ; DIG 3 } ; + PAIR ; + DIP { DIP 6 { DUP } ; DIG 6 ; NIL operation ; SWAP ; PAIR } ; + PAIR ; + DIP { DIP 2 { DUP } ; DIG 2 } ; + PAIR ; + DIP 4 { DUP } ; + DIG 4 ; SIZE ; - DIP { DIP 5 { DUP } ; DIG 5 ; CDR ; CDR } ; + DIP { DIP 3 { DUP } ; DIG 3 ; CDR ; CDR } ; COMPARE ; GE ; IF { DIP 3 { DUP } ; DIG 3 ; - DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CDR ; CDR ; NONE (set address) } ; + DIP 8 { DUP } ; + DIG 8 ; + DIP { DIP 4 { DUP } ; DIG 4 ; CAR ; CDR ; CDR ; NONE (set address) } ; UPDATE ; - DIP { DIP 5 { DUP } ; - DIG 5 ; - DUP ; - CDR ; - SWAP ; - CAR ; - DUP ; - CAR ; - SWAP ; - CDR ; - CAR } ; + DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; - DIP 6 { DROP } ; - DUG 5 ; - DIP 5 { DUP } ; - DIG 5 ; + DUP ; CDR ; CAR ; CDR ; - DIP { DIP 4 { DUP } ; DIG 4 } ; + DIP { DIP 9 { DUP } ; DIG 9 } ; EXEC ; - DIP { DROP } ; - DIP 5 { DUP } ; - DIG 5 ; + DIP { DUP } ; + SWAP ; + DIP 2 { DUP } ; + DIG 2 ; CDR ; CAR ; CDR ; - DIP { DIP 3 { DUP } ; DIG 3 } ; + DIP { DIP 10 { DUP } ; DIG 10 } ; CONCAT ; SHA256 ; - DIP { DIP 5 { DUP } ; - DIG 5 ; - DUP ; - CAR ; - SWAP ; - CDR ; - DUP ; - CDR ; - SWAP ; - CAR ; - CAR } ; + DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CAR } ; SWAP ; PAIR ; PAIR ; SWAP ; PAIR ; - DIP 6 { DROP } ; - DUG 5 ; - DIP 5 { DUP } ; - DIG 5 ; + DUP ; CDR ; CAR ; CAR ; - DIP { DIP 5 { DUP } ; DIG 5 } ; + DIP { DUP } ; ITER { SWAP ; PAIR ; DUP ; @@ -663,78 +691,103 @@ let%expect_test _ = CDR ; DIP { DUP } ; SWAP ; - DIP { DIP 6 { DUP } ; DIG 6 } ; + DIP { DUP } ; + PAIR ; + DIP { DIP 2 { DUP } ; DIG 2 } ; + PAIR ; + DIP 2 { DUP } ; + DIG 2 ; + DIP { DIP 12 { DUP } ; DIG 12 } ; MEM ; - IF { DIP { DUP } ; - SWAP ; - DIP { DUP ; + IF { DIP 3 { DUP } ; + DIG 3 ; + DIP 3 { DUP } ; + DIG 3 ; + DIP { DIP 2 { DUP } ; + DIG 2 ; PUSH nat 1 ; SWAP ; SUB ; ABS ; SOME ; - DIP { DIP 2 { DUP } ; DIG 2 ; CDR ; CAR ; CAR } } ; + DIP { DIP 4 { DUP } ; DIG 4 ; CDR ; CAR ; CAR } } ; UPDATE ; - DIP { DIP 2 { DUP } ; - DIG 2 ; - DUP ; - CAR ; - SWAP ; - CDR ; - DUP ; - CDR ; - SWAP ; - CAR ; - CDR } ; + DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; SWAP ; PAIR ; - DIP 3 { DROP } ; - DUG 2 ; - PUSH unit Unit } - { PUSH unit Unit } ; - DROP ; + DIP { DUP } ; + SWAP ; + CAR ; + DIP { DUP } ; + PAIR ; + DIP { DROP } } + { DUP } ; + DIP { DROP } ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 5 { DUP } ; + DIG 5 ; + CAR ; DIP 2 { DUP } ; DIG 2 ; - DIP { DROP 4 } } ; - DUP ; - DIP { DIP 6 { DUP } ; DIG 6 ; DROP } ; - DIP 7 { DROP } ; - DUG 6 ; - DROP ; - PUSH unit Unit } - { DIP 3 { DUP } ; + CDR ; + DIP { DROP ; CDR } ; + PAIR ; + CAR ; + DIP { DROP 5 } } ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 4 { DUP } ; + DIG 4 ; + SWAP ; + CAR ; + PAIR ; + DIP 3 { DUP } ; DIG 3 ; - DIP { DIP 2 { DUP } ; - DIG 2 ; + DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ; + SWAP ; + PAIR ; + SWAP ; + PAIR ; + PAIR ; + DIP 2 { DUP } ; + DIG 2 ; + SWAP ; + CAR ; + PAIR ; + CAR ; + DIP { DUP } ; + PAIR ; + DIP { DROP 4 } } + { DUP ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 9 { DUP } ; + DIG 9 ; + DIP { DIP 6 { DUP } ; + DIG 6 ; SOME ; DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CDR ; CDR } } ; UPDATE ; - DIP { DIP 5 { DUP } ; - DIG 5 ; - DUP ; - CDR ; - SWAP ; - CAR ; - DUP ; - CAR ; - SWAP ; - CDR ; - CAR } ; + DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; - DIP 6 { DROP } ; - DUG 5 ; - PUSH unit Unit } ; - DROP ; + SWAP ; + CAR ; + PAIR } ; + DIP { DROP } ; DUP ; - DIP { DIP 5 { DUP } ; DIG 5 } ; + CAR ; + CDR ; + CDR ; + DIP { DUP ; CDR } ; PAIR ; - DIP { DROP 8 } } ; + DIP { DROP 13 } } ; DIP { DROP } } { DUP ; DIP { DIP { DUP } ; SWAP } ; @@ -744,25 +797,32 @@ let%expect_test _ = DIP { DUP } ; SWAP ; CAR ; - DUP ; PACK ; DUP ; + DIP { DIP { DUP } ; SWAP } ; + PAIR ; + DIP { DUP } ; + SWAP ; DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CDR ; CDR } ; GET ; IF_NONE - { PUSH unit Unit } + { DUP } { DUP ; PUSH bool False ; SENDER ; UPDATE ; - DIP { DUP } ; - SWAP ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 2 { DUP } ; + DIG 2 ; SIZE ; - DIP { DUP ; SIZE } ; + DIP { DIP { DUP } ; SWAP ; SIZE } ; COMPARE ; NEQ ; - IF { DIP 4 { DUP } ; - DIG 4 ; + IF { DIP 5 { DUP } ; + DIG 5 ; + DIP 6 { DUP } ; + DIG 6 ; CDR ; CAR ; CAR ; @@ -774,85 +834,112 @@ let%expect_test _ = SUB ; ABS ; SOME ; - DIP { DIP 4 { DUP } ; DIG 4 ; CDR ; CAR ; CAR } ; + DIP { DIP 6 { DUP } ; DIG 6 ; CDR ; CAR ; CAR } ; SENDER ; UPDATE ; - DIP { DIP 4 { DUP } ; - DIG 4 ; - DUP ; - CAR ; - SWAP ; - CDR ; - DUP ; - CDR ; - SWAP ; - CAR ; - CDR } ; + DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ; PAIR ; PAIR ; SWAP ; PAIR ; - DIP 5 { DROP } ; - DUG 4 ; - PUSH unit Unit } - { PUSH unit Unit } ; - DROP ; + DIP { DUP } ; + SWAP ; + DIP { DUP } ; + SWAP ; + DIP { DROP 2 } } + { DUP } ; + DIP { DROP } ; DUP ; + DIP 2 { DUP } ; + DIG 2 ; + DIP { DIP 5 { DUP } ; DIG 5 } ; + PAIR ; + DIP { DUP } ; + PAIR ; + DIP 3 { DUP } ; + DIG 3 ; SIZE ; PUSH nat 0 ; SWAP ; COMPARE ; EQ ; - IF { DIP 2 { DUP } ; - DIG 2 ; - DIP { DIP 4 { DUP } ; DIG 4 ; CAR ; CDR ; CDR ; NONE (set address) } ; + IF { DIP { DUP } ; + SWAP ; + DIP 7 { DUP } ; + DIG 7 ; + DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CDR ; CDR ; NONE (set address) } ; UPDATE ; - DIP { DIP 4 { DUP } ; - DIG 4 ; - DUP ; - CDR ; - SWAP ; - CAR ; - DUP ; - CAR ; - SWAP ; - CDR ; - CAR } ; + DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; - DIP 5 { DROP } ; - DUG 4 ; - PUSH unit Unit } - { DIP 2 { DUP } ; + DIP { DUP } ; + SWAP ; + CAR ; + DIP { DUP } ; + PAIR ; + DIP { DROP } } + { DUP ; + DIP 2 { DUP } ; DIG 2 ; - DIP { DUP ; SOME ; DIP { DIP 4 { DUP } ; DIG 4 ; CAR ; CDR ; CDR } } ; + DIP 8 { DUP } ; + DIG 8 ; + DIP { DIP 5 { DUP } ; + DIG 5 ; + SOME ; + DIP { DIP 3 { DUP } ; DIG 3 ; CAR ; CDR ; CDR } } ; UPDATE ; - DIP { DIP 4 { DUP } ; - DIG 4 ; - DUP ; - CDR ; - SWAP ; - CAR ; - DUP ; - CAR ; - SWAP ; - CDR ; - CAR } ; + DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR ; - DIP 5 { DROP } ; - DUG 4 ; - PUSH unit Unit } ; - DIP { DROP 2 } } ; - DROP ; - DIP 2 { DUP } ; - DIG 2 ; + SWAP ; + CAR ; + PAIR } ; + DIP { DROP } ; + DIP 5 { DUP } ; + DIG 5 ; + DIP 2 { DUP } ; + DIG 2 ; + SWAP ; + CAR ; + PAIR ; + DIP { DUP } ; + SWAP ; + CAR ; + CDR ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + DIP { DUP } ; + SWAP ; + CDR ; + SWAP ; + CAR ; + PAIR ; + DIP { DUP } ; + SWAP ; + CAR ; + CDR ; + SWAP ; + CDR ; + SWAP ; + PAIR ; + DIP { DUP } ; + SWAP ; + CDR ; + SWAP ; + CAR ; + PAIR ; + DIP { DROP 5 } } ; + DIP { DROP } ; + DUP ; + CDR ; NIL operation ; PAIR ; DIP { DROP 5 } } ; @@ -978,7 +1065,7 @@ let%expect_test _ = let%expect_test _ = run_ligo_bad [ "compile-contract" ; contract "bad_address_format.religo" ; "main" ] ; [%expect {| - ligo: in file "bad_address_format.religo", line 2, characters 25-47. Badly formatted literal: address "KT1badaddr" {"location":"in file \"bad_address_format.religo\", line 2, characters 25-47"} + ligo: in file "bad_address_format.religo", line 2, characters 25-47. Badly formatted literal: @"KT1badaddr" {"location":"in file \"bad_address_format.religo\", line 2, characters 25-47"} If you're not sure how to fix this error, you can @@ -1005,11 +1092,11 @@ let%expect_test _ = let%expect_test _ = run_ligo_good [ "dry-run" ; contract "redeclaration.ligo" ; "main" ; "unit" ; "0" ] ; - [%expect {|( [] , 0 ) |}] + [%expect {|record[1 -> 0 , 0 -> list[]] |}] let%expect_test _ = run_ligo_good [ "dry-run" ; contract "double_main.ligo" ; "main" ; "unit" ; "0" ] ; - [%expect {|( [] , 2 ) |}] + [%expect {|record[1 -> 2 , 0 -> list[]] |}] let%expect_test _ = run_ligo_good [ "compile-contract" ; contract "subtle_nontail_fail.mligo" ; "main" ] ; diff --git a/src/bin/expect_tests/failwith_tests.ml b/src/bin/expect_tests/failwith_tests.ml index d957f03c0..a66d462ee 100644 --- a/src/bin/expect_tests/failwith_tests.ml +++ b/src/bin/expect_tests/failwith_tests.ml @@ -21,7 +21,7 @@ let%expect_test _ = run_ligo_good [ "interpret" ; "assert(1=1)" ; "--syntax=pascaligo" ] ; [%expect {| - Unit |}]; + unit |}]; run_ligo_good [ "interpret" ; "assert(1=2)" ; "--syntax=pascaligo" ] ; [%expect {| @@ -29,7 +29,7 @@ let%expect_test _ = run_ligo_good [ "interpret" ; "assert(1=1)" ; "--syntax=cameligo" ] ; [%expect {| - Unit |}]; + unit |}]; run_ligo_good [ "interpret" ; "assert(1=2)" ; "--syntax=cameligo" ] ; [%expect {| diff --git a/src/bin/expect_tests/literals.ml b/src/bin/expect_tests/literals.ml index 9d945c4d0..da8a4333d 100644 --- a/src/bin/expect_tests/literals.ml +++ b/src/bin/expect_tests/literals.ml @@ -2,12 +2,12 @@ open Cli_expect let%expect_test _ = run_ligo_good ["interpret" ; "(\"edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7\":signature)" ; "--syntax=pascaligo"] ; - [%expect {| signature edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7 |}] + [%expect {| Signature edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7 |}] let%expect_test _ = run_ligo_bad ["interpret" ; "(\"thisisnotasignature\":signature)" ; "--syntax=pascaligo"] ; [%expect {| - ligo: in file "", line 0, characters 1-32. Badly formatted literal: signature thisisnotasignature {"location":"in file \"\", line 0, characters 1-32"} + ligo: in file "", line 0, characters 1-32. Badly formatted literal: Signature thisisnotasignature {"location":"in file \"\", line 0, characters 1-32"} If you're not sure how to fix this error, you can diff --git a/src/bin/expect_tests/misc_cli_commands.ml b/src/bin/expect_tests/misc_cli_commands.ml index b18de4873..1ac2d3744 100644 --- a/src/bin/expect_tests/misc_cli_commands.ml +++ b/src/bin/expect_tests/misc_cli_commands.ml @@ -4,7 +4,7 @@ open Cli_expect let%expect_test _ = run_ligo_good [ "evaluate-value" ; "../../test/contracts/evaluation_tests.ligo" ; "a" ] ; [%expect {| - {foo = +0 , bar = "bar"} |} ]; + record[foo -> +0 , bar -> "bar"] |} ]; run_ligo_good [ "evaluate-value" ; "../../test/contracts/evaluation_tests.ligo" ; "b" ] ; [%expect {| diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 511831b28..665abebbe 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -41,7 +41,7 @@ let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_3.mligo" ; "main" ] ; [%expect {| - ligo: in file "error_typer_3.mligo", line 3, characters 34-53. different number of arguments to type constructors: Expected these two n-ary type constructors to be the same, but they have different numbers of arguments (both use the TC_tuple type constructor, but they have 3 and 2 arguments, respectively) {"a":"(TO_tuple[int , string , bool])","b":"(TO_tuple[int , string])","op":"TC_tuple","len_a":"3","len_b":"2"} + ligo: in file "error_typer_3.mligo", line 3, characters 34-53. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[2 -> bool , 1 -> string , 0 -> int]","b":"record[1 -> string , 0 -> int]"} If you're not sure how to fix this error, you can diff --git a/src/main/compile/of_simplified.ml b/src/main/compile/of_simplified.ml index 6d98bccc5..488e809ac 100644 --- a/src/main/compile/of_simplified.ml +++ b/src/main/compile/of_simplified.ml @@ -6,17 +6,17 @@ let compile (program : Ast_simplified.program) : (Ast_typed.program * Typer.Solv ok @@ (prog_typed, state) let compile_expression ?(env = Ast_typed.Environment.full_empty) ~(state : Typer.Solver.state) (ae : Ast_simplified.expression) - : (Ast_typed.value * Typer.Solver.state) result = + : (Ast_typed.expression * Typer.Solver.state) result = let () = Typer.Solver.discard_state state in Typer.type_expression_subst env state ae let apply (entry_point : string) (param : Ast_simplified.expression) : Ast_simplified.expression result = let name = Var.of_name entry_point in let entry_point_var : Ast_simplified.expression = - { expression = Ast_simplified.E_variable name ; + { expression_content = Ast_simplified.E_variable name ; location = Virtual "generated entry-point variable" } in - let applied : Ast_simplified.expression = - { expression = Ast_simplified.E_application (entry_point_var, param) ; + let applied : Ast_simplified.expression = + { expression_content = Ast_simplified.E_application {expr1=entry_point_var; expr2=param} ; location = Virtual "generated application" } in ok applied diff --git a/src/main/compile/of_typed.ml b/src/main/compile/of_typed.ml index c1b2930ef..75f4afae3 100644 --- a/src/main/compile/of_typed.ml +++ b/src/main/compile/of_typed.ml @@ -4,20 +4,22 @@ open Ast_typed let compile : Ast_typed.program -> Mini_c.program result = fun p -> Transpiler.transpile_program p -let compile_expression : annotated_expression -> Mini_c.expression result = fun e -> +let compile_expression : expression -> Mini_c.expression result = fun e -> Transpiler.transpile_annotated_expression e type check_type = Check_parameter | Check_storage -let assert_equal_contract_type : check_type -> string -> Ast_typed.program -> Ast_typed.value -> unit result = +let assert_equal_contract_type : check_type -> string -> Ast_typed.program -> Ast_typed.expression -> unit result = fun c entry contract param -> Trace.trace (simple_info "Check argument type against contract type") ( let%bind entry_point = Ast_typed.get_entry contract entry in - match entry_point.type_annotation.type_value' with - | T_arrow (args,_) -> ( - match args.type_value' with - | T_operator (TC_tuple [param_exp;storage_exp]) -> ( + match entry_point.type_expression.type_content with + | T_arrow {type1=args} -> ( + match args.type_content with + | T_record m when LMap.cardinal m = 2 -> ( + let param_exp = LMap.find (Label "0") m in + let storage_exp = LMap.find (Label "1") m in match c with - | Check_parameter -> assert_type_value_eq (param_exp, param.type_annotation) - | Check_storage -> assert_type_value_eq (storage_exp, param.type_annotation) + | Check_parameter -> assert_type_expression_eq (param_exp, param.type_expression) + | Check_storage -> assert_type_expression_eq (storage_exp, param.type_expression) ) | _ -> dummy_fail ) diff --git a/src/main/compile/wrapper.ml b/src/main/compile/wrapper.ml new file mode 100644 index 000000000..ae8f9043e --- /dev/null +++ b/src/main/compile/wrapper.ml @@ -0,0 +1,12 @@ +open Trace + +let source_to_typed syntax source_file = + let%bind simplified = Of_source.compile source_file syntax in + let%bind typed,state = Of_simplified.compile simplified in + let env = Ast_typed.program_environment typed in + ok (typed,state,env) + +let source_to_typed_expression ~env ~state parameter syntax = + let%bind simplified = Of_source.compile_expression syntax parameter in + let%bind (typed,_) = Of_simplified.compile_expression ~env ~state simplified in + ok typed diff --git a/src/main/uncompile/uncompile.ml b/src/main/uncompile/uncompile.ml index 2fa1ee14d..6d43fba15 100644 --- a/src/main/uncompile/uncompile.ml +++ b/src/main/uncompile/uncompile.ml @@ -4,9 +4,9 @@ type ret_type = Function | Expression let uncompile_value func_or_expr program entry ex_ty_value = let%bind entry_expression = Ast_typed.get_entry program entry in let%bind output_type = match func_or_expr with - | Expression -> ok entry_expression.type_annotation + | Expression -> ok entry_expression.type_expression | Function -> - let%bind (_,output_type) = Ast_typed.get_t_function entry_expression.type_annotation in + let%bind (_,output_type) = Ast_typed.get_t_function entry_expression.type_expression in ok output_type in let%bind mini_c = Compiler.Uncompiler.translate_value ex_ty_value in let%bind typed = Transpiler.untranspile mini_c output_type in @@ -21,4 +21,4 @@ let uncompile_typed_program_entry_function_result program entry ex_ty_value = let uncompile_expression type_value ex_ty_value = let%bind mini_c = Compiler.Uncompiler.translate_value ex_ty_value in let%bind typed = Transpiler.untranspile mini_c type_value in - Typer.untype_expression typed \ No newline at end of file + Typer.untype_expression typed diff --git a/src/passes/1-parser/cameligo/AST.ml b/src/passes/1-parser/cameligo/AST.ml index 551d82077..84aebb96e 100644 --- a/src/passes/1-parser/cameligo/AST.ml +++ b/src/passes/1-parser/cameligo/AST.ml @@ -464,10 +464,10 @@ let expr_to_region = function | EList e -> list_expr_to_region e | EConstr e -> constr_expr_to_region e | EAnnot {region;_ } | ELetIn {region;_} | EFun {region;_} -| ECond {region;_} | ETuple {region;_} | ECase {region;_} -| ECall {region;_} | EVar {region; _} | EProj {region; _} -| EUnit {region;_} | EPar {region;_} | EBytes {region; _} -| ESeq {region; _} | ERecord {region; _} | EUpdate {region; _} -> region +| ECond {region;_} | ETuple {region;_} | ECase {region;_} +| ECall {region;_} | EVar {region; _} | EProj {region; _} +| EUnit {region;_} | EPar {region;_} | EBytes {region; _} +| ESeq {region; _} | ERecord {region; _} | EUpdate {region; _} -> region let selection_to_region = function FieldName f -> f.region diff --git a/src/passes/1-parser/pascaligo/AST.ml b/src/passes/1-parser/pascaligo/AST.ml index 27dfdd585..3591cb94b 100644 --- a/src/passes/1-parser/pascaligo/AST.ml +++ b/src/passes/1-parser/pascaligo/AST.ml @@ -789,3 +789,6 @@ let rhs_to_region = expr_to_region let selection_to_region = function FieldName {region; _} | Component {region; _} -> region + +let map_ne_injection f ne_injection = + { ne_injection with ne_elements = nsepseq_map f ne_injection.ne_elements } diff --git a/src/passes/2-simplify/cameligo.ml b/src/passes/2-simplify/cameligo.ml index 40c238ca8..1680caf96 100644 --- a/src/passes/2-simplify/cameligo.ml +++ b/src/passes/2-simplify/cameligo.ml @@ -194,13 +194,13 @@ let rec simpl_type_expression : Raw.type_expr -> type_expression result = fun te | Error _ -> ok @@ make_t @@ T_variable (Var.of_name v.value) ) | TFun x -> ( - let%bind (a , b) = + let%bind (type1 , type2) = let (a , _ , b) = x.value in let%bind a = simpl_type_expression a in let%bind b = simpl_type_expression b in ok (a , b) in - ok @@ make_t @@ T_arrow (a , b) + ok @@ make_t @@ T_arrow {type1;type2} ) | TApp x -> ( let (name, tuple) = x.value in @@ -247,7 +247,7 @@ and simpl_list_type_expression (lst:Raw.type_expr list) : type_expression result | [hd] -> simpl_type_expression hd | lst -> let%bind lst = bind_map_list simpl_type_expression lst in - ok @@ make_t @@ T_operator (TC_tuple lst) + ok @@ t_tuple lst let rec simpl_expression : Raw.expr -> expr result = fun t -> @@ -261,13 +261,13 @@ let rec simpl_expression : let path' = let aux (s:Raw.selection) = match s with - FieldName property -> Access_record property.value - | Component index -> Access_tuple (Z.to_int (snd index.value)) + FieldName property -> property.value + | Component index -> Z.to_string (snd index.value) in List.map aux @@ npseq_to_list path in - return @@ e_accessor ~loc var path' + return @@ List.fold_left (e_accessor ~loc ) var path' in - let simpl_path : Raw.path -> string * Ast_simplified.access_path = fun p -> + let simpl_path : Raw.path -> string * label list = fun p -> match p with | Raw.Name v -> (v.value , []) | Raw.Path p -> ( @@ -277,8 +277,8 @@ let rec simpl_expression : let path' = let aux (s:Raw.selection) = match s with - | FieldName property -> Access_record property.value - | Component index -> Access_tuple (Z.to_int (snd index.value)) + | FieldName property -> Label property.value + | Component index -> Label (Z.to_string (snd index.value)) in List.map aux @@ npseq_to_list path in (var , path') @@ -289,7 +289,9 @@ let rec simpl_expression : let (name, path) = simpl_path u.record in let record = match path with | [] -> e_variable (Var.of_name name) - | _ -> e_accessor (e_variable (Var.of_name name)) path in + | _ -> + let aux expr (Label l) = e_accessor expr l in + List.fold_left aux (e_variable (Var.of_name name)) path in let updates = u.updates.value.ne_elements in let%bind updates' = let aux (f:Raw.field_path_assign Raw.reg) = @@ -304,7 +306,7 @@ let rec simpl_expression : | [] -> failwith "error in parsing" | hd :: [] -> ok @@ e_update ~loc record hd expr | hd :: tl -> - let%bind expr = (aux (e_accessor ~loc record [Access_record hd]) tl) in + let%bind expr = (aux (e_accessor ~loc record hd) tl) in ok @@ e_update ~loc record hd expr in aux ur path in @@ -352,19 +354,20 @@ let rec simpl_expression : match variables with | hd :: [] -> if (List.length prep_vars = 1) - then e_let_in hd inline rhs_b_expr body - else e_let_in hd inline (e_accessor rhs_b_expr [Access_tuple ((List.length prep_vars) - 1)]) body + then e_let_in hd false inline rhs_b_expr body + else e_let_in hd false inline (e_accessor rhs_b_expr (string_of_int ((List.length prep_vars) - 1))) body | hd :: tl -> e_let_in hd + false inline - (e_accessor rhs_b_expr [Access_tuple ((List.length prep_vars) - (List.length tl) - 1)]) + (e_accessor rhs_b_expr (string_of_int ((List.length prep_vars) - (List.length tl) - 1))) (chain_let_in tl body) | [] -> body (* Precluded by corner case assertion above *) in if List.length prep_vars = 1 then ok (chain_let_in prep_vars body) (* Bind the right hand side so we only evaluate it once *) - else ok (e_let_in (rhs_b, ty_opt) inline rhs' (chain_let_in prep_vars body)) + else ok (e_let_in (rhs_b, ty_opt) false inline rhs' (chain_let_in prep_vars body)) (* let f p1 ps... = rhs in body *) | (f, p1 :: ps) -> @@ -413,8 +416,7 @@ let rec simpl_expression : @@ List.map (fun ((k : _ Raw.reg), v) -> let%bind v = simpl_expression v in ok (k.value, v)) @@ List.map (fun (x:Raw.field_assign Raw.reg) -> (x.value.field_name, x.value.field_expr)) @@ npseq_to_list r.ne_elements in - let map = SMap.of_list fields in - return @@ e_record ~loc map + return @@ e_record_ez ~loc fields | EProj p -> simpl_projection p | EUpdate u -> simpl_update u | EConstr (ESomeApp a) -> @@ -501,7 +503,7 @@ let rec simpl_expression : | Raw.PVar y -> let var_name = Var.of_name y.value in let%bind type_expr = simpl_type_expression x'.type_expr in - return @@ e_let_in (var_name , Some type_expr) false e rhs + return @@ e_let_in (var_name , Some type_expr) false false e rhs | _ -> default_action () ) | _ -> default_action () @@ -810,7 +812,7 @@ and simpl_declaration : Raw.declaration -> declaration Location.wrap list result ok @@ [loc x @@ (Declaration_constant (Var.of_name var.value , None , inline, rhs'))] ) -and simpl_cases : type a . (Raw.pattern * a) list -> (a, unit) matching result = +and simpl_cases : type a . (Raw.pattern * a) list -> (a, unit) matching_content result = fun t -> let open Raw in let rec get_var (t:Raw.pattern) = @@ -931,5 +933,5 @@ and simpl_cases : type a . (Raw.pattern * a) list -> (a, unit) matching result = in bind_or (as_option () , as_variant ()) let simpl_program : Raw.ast -> program result = fun t -> - let%bind decls = bind_list (List.map simpl_declaration @@ nseq_to_list t.decl) in + let%bind decls = bind_map_list simpl_declaration @@ nseq_to_list t.decl in ok @@ List.concat @@ decls diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index 80e184042..901bf7818 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -16,17 +16,17 @@ let pseq_to_list = function let get_value : 'a Raw.reg -> 'a = fun x -> x.value let is_compiler_generated name = String.contains (Var.to_name name) '#' -let detect_local_declarations (for_body : expression) = +let _detect_local_declarations (for_body : expression) = let%bind aux = Self_ast_simplified.fold_expression (fun (nlist, cur_loop : expression_variable list * bool) (ass_exp : expression) -> - if cur_loop then - match ass_exp.expression with - | E_let_in {binder;rhs = _;result = _} -> - let (name,_) = binder in + if cur_loop then + match ass_exp.expression_content with + | E_let_in {let_binder;mut=false;rhs = _;let_result = _} -> + let (name,_) = let_binder in ok (name::nlist, cur_loop) - | E_constant (C_MAP_FOLD, _) - | E_constant (C_SET_FOLD, _) - | E_constant (C_LIST_FOLD, _) -> ok @@ (nlist, false) + | E_constant {cons_name=C_MAP_FOLD;arguments= _} + | E_constant {cons_name=C_SET_FOLD;arguments= _} + | E_constant {cons_name=C_LIST_FOLD;arguments= _} -> ok @@ (nlist, false) | _ -> ok (nlist, cur_loop) else ok @@ (nlist, cur_loop) @@ -35,18 +35,15 @@ let detect_local_declarations (for_body : expression) = for_body in ok @@ fst aux -let detect_free_variables (for_body : expression) (local_decl_names : expression_variable list) = +let _detect_free_variables (for_body : expression) (local_decl_names : expression_variable list) = let%bind captured_names = Self_ast_simplified.fold_expression (fun (prev : expression_variable list) (ass_exp : expression) -> - match ass_exp.expression with - | E_assign ( name , _ , _ ) -> - if is_compiler_generated name then ok prev - else ok (name::prev) - | E_constant (n, [a;b]) + match ass_exp.expression_content with + | E_constant {cons_name=n;arguments=[a;b]} when n=C_OR || n=C_AND || n=C_LT || n=C_GT || n=C_LE || n=C_GE || n=C_EQ || n=C_NEQ -> ( - match (a.expression,b.expression) with - | E_variable na , E_variable nb -> + match (a.expression_content,b.expression_content) with + | E_variable na , E_variable nb -> let ret = [] in let ret = if not (is_compiler_generated na) then na::ret else ret in @@ -66,6 +63,92 @@ let detect_free_variables (for_body : expression) (local_decl_names : expression ok @@ SSet.elements @@ SSet.diff (SSet.of_list captured_names) (SSet.of_list local_decl_names) +and repair_mutable_variable (for_body : expression) (element_names : expression_variable list) (env : expression_variable) = + let%bind captured_names = Self_ast_simplified.fold_map_expression + (* TODO : these should use Variables sets *) + (fun (decl_var,free_var : expression_variable list * expression_variable list) (ass_exp : expression) -> + match ass_exp.expression_content with + | E_let_in {let_binder;mut=false;rhs;let_result} -> + let (name,_) = let_binder in + ok (true,(name::decl_var, free_var),e_let_in let_binder false false rhs let_result) + | E_let_in {let_binder;mut=true; rhs;let_result} -> + let (name,_) = let_binder in + if List.mem name decl_var then + ok (true,(decl_var, free_var), e_let_in let_binder false false rhs let_result) + else( + let free_var = if (List.mem name free_var) then free_var else name::free_var in + let expr = e_let_in (env,None) false false (e_update (e_variable env) (Var.show name) (e_variable name)) let_result in + ok (true,(decl_var, free_var), e_let_in let_binder false false rhs expr) + ) + | E_variable name -> + if List.mem name decl_var || List.mem name free_var || Var.equal name env then + ok (true,(decl_var, free_var), e_variable name) + else + ok (true, (decl_var, name::free_var), e_variable name) + | E_constant {cons_name=C_MAP_FOLD;arguments= _} + | E_constant {cons_name=C_SET_FOLD;arguments= _} + | E_constant {cons_name=C_LIST_FOLD;arguments= _} + | E_matching _ -> ok @@ (false, (decl_var,free_var),ass_exp) + | _ -> ok (true, (decl_var, free_var),ass_exp) + ) + (element_names,[]) + for_body in + ok @@ captured_names + +and repair_mutable_variable_for_collect (for_body : expression) (element_names : expression_variable list) (env : expression_variable) = + let%bind captured_names = Self_ast_simplified.fold_map_expression + (* TODO : these should use Variables sets *) + (fun (decl_var,free_var : expression_variable list * expression_variable list) (ass_exp : expression) -> + match ass_exp.expression_content with + | E_let_in {let_binder;mut=false;rhs;let_result} -> + let (name,_) = let_binder in + ok (true,(name::decl_var, free_var),e_let_in let_binder false false rhs let_result) + | E_let_in {let_binder;mut=true; rhs;let_result} -> + let (name,_) = let_binder in + if List.mem name decl_var then + ok (true,(decl_var, free_var), e_let_in let_binder false false rhs let_result) + else( + let free_var = if (List.mem name free_var) then free_var else name::free_var in + let expr = e_let_in (env,None) false false ( + e_update (e_variable env) ("0") + (e_update (e_accessor (e_variable env) "0") (Var.show name) (e_variable name)) + ) + let_result in + ok (true,(decl_var, free_var), e_let_in let_binder false false rhs expr) + ) + | E_variable name -> + if List.mem name decl_var || List.mem name free_var || Var.equal name env then + ok (true,(decl_var, free_var), e_variable name) + else + ok (true,(decl_var, name::free_var), e_variable name) + | E_constant {cons_name=C_MAP_FOLD;arguments= _} + | E_constant {cons_name=C_SET_FOLD;arguments= _} + | E_constant {cons_name=C_LIST_FOLD;arguments= _} + | E_matching _ -> ok @@ (false,(decl_var,free_var),ass_exp) + | _ -> ok (true,(decl_var, free_var),ass_exp) + ) + (element_names,[]) + for_body in + ok @@ captured_names + +and store_mutable_variable (free_vars : expression_variable list) = + if (List.length free_vars == 0) then + e_unit () + else + let aux var = (Var.show var, e_variable var) in + e_record_ez (List.map aux free_vars) + +and restore_mutable_variable (expr : expression) (free_vars : expression_variable list) (env :expression_variable) = + let aux (f:expression -> expression) (ev:expression_variable) = + ok @@ fun expr -> f (e_let_in (ev,None) true false (e_accessor (e_variable env) (Var.show ev)) expr) + in + let%bind ef = bind_fold_list aux (fun e -> e) free_vars in + ok @@ fun expr'_opt -> match expr'_opt with + | None -> ok @@ e_let_in (env,None) false false expr (ef (e_skip ())) + | Some expr' -> ok @@ e_let_in (env,None) false false expr (ef expr') + + + module Errors = struct let unsupported_cst_constr p = let title () = "" in @@ -78,18 +161,6 @@ module Errors = struct ] in error ~data title message - let corner_case ~loc message = - let title () = "\nCorner case" in - let content () = "We do not have a good error message for this case. \ - We are striving find ways to better report them and \ - find the use-cases that generate them. \ - Please report this to the developers.\n" in - let data = [ - ("location" , fun () -> loc) ; - ("message" , fun () -> message) ; - ] in - error ~data title content - let unknown_predefined_type name = let title () = "\nType constants" in let message () = @@ -196,16 +267,17 @@ let r_split = Location.r_split [return_statement] is used for non-let-in statements. *) -let return_let_in ?loc binder inline rhs = ok @@ fun expr'_opt -> +let return_let_in ?loc binder mut inline rhs = ok @@ fun expr'_opt -> match expr'_opt with - | None -> fail @@ corner_case ~loc:__LOC__ "missing return" - | Some expr' -> ok @@ e_let_in ?loc binder inline rhs expr' + | None -> ok @@ e_let_in ?loc binder mut inline rhs (e_skip ()) + | Some expr' -> ok @@ e_let_in ?loc binder mut inline rhs expr' let return_statement expr = ok @@ fun expr'_opt -> match expr'_opt with | None -> ok @@ expr | Some expr' -> ok @@ e_sequence expr expr' + let rec simpl_type_expression (t:Raw.type_expr) : type_expression result = match t with TPar x -> simpl_type_expression x.value.inside @@ -218,7 +290,7 @@ let rec simpl_type_expression (t:Raw.type_expr) : type_expression result = let%bind (a , b) = let (a , _ , b) = x.value in bind_map_pair simpl_type_expression (a , b) in - ok @@ make_t @@ T_arrow (a , b) + ok @@ make_t @@ T_arrow {type1=a;type2=b} ) | TApp x -> let (name, tuple) = x.value in @@ -268,7 +340,7 @@ and simpl_list_type_expression (lst:Raw.type_expr list) : type_expression result | [hd] -> simpl_type_expression hd | lst -> let%bind lst = bind_list @@ List.map simpl_type_expression lst in - ok @@ make_t @@ T_operator (TC_tuple lst) + ok @@ t_tuple lst let simpl_projection : Raw.projection Region.reg -> _ = fun p -> let (p' , loc) = r_split p in @@ -279,11 +351,11 @@ let simpl_projection : Raw.projection Region.reg -> _ = fun p -> let path' = let aux (s:Raw.selection) = match s with - | FieldName property -> Access_record property.value - | Component index -> Access_tuple (Z.to_int (snd index.value)) + | FieldName property -> property.value + | Component index -> (Z.to_string (snd index.value)) in List.map aux @@ npseq_to_list path in - ok @@ e_accessor ~loc var path' + ok @@ List.fold_left (e_accessor ~loc) var path' let rec simpl_expression (t:Raw.expr) : expr result = @@ -409,7 +481,11 @@ let rec simpl_expression (t:Raw.expr) : expr result = let%bind expr = simpl_expression c.test in let%bind match_true = simpl_expression c.ifso in let%bind match_false = simpl_expression c.ifnot in - return @@ e_matching expr ~loc (Match_bool {match_true; match_false}) + let match_expr = e_matching expr ~loc (Match_bool {match_true; match_false}) in + let env = Var.fresh () in + let%bind (_, match_expr) = repair_mutable_variable match_expr [] env in + return @@ match_expr + | ECase c -> ( let (c , loc) = r_split c in let%bind e = simpl_expression c.expr in @@ -422,7 +498,10 @@ let rec simpl_expression (t:Raw.expr) : expr result = @@ List.map get_value @@ npseq_to_list c.cases.value in let%bind cases = simpl_cases lst in - return @@ e_matching ~loc e cases + let match_expr = e_matching ~loc e cases in + let env = Var.fresh () in + let%bind (_, match_expr) = repair_mutable_variable match_expr [] env in + return @@ match_expr ) | EMap (MapInj mi) -> ( let (mi , loc) = r_split mi in @@ -471,7 +550,7 @@ and simpl_update = fun (u:Raw.update Region.reg) -> let (name, path) = simpl_path u.record in let record = match path with | [] -> e_variable (Var.of_name name) - | _ -> e_accessor (e_variable (Var.of_name name)) path in + | _ -> e_accessor_list (e_variable (Var.of_name name)) path in let updates = u.updates.value.ne_elements in let%bind updates' = let aux (f:Raw.field_path_assign Raw.reg) = @@ -486,7 +565,7 @@ and simpl_update = fun (u:Raw.update Region.reg) -> | [] -> failwith "error in parsing" | hd :: [] -> ok @@ e_update ~loc record hd expr | hd :: tl -> - let%bind expr = (aux (e_accessor ~loc record [Access_record hd]) tl) in + let%bind expr = (aux (e_accessor ~loc record hd) tl) in ok @@ e_update ~loc record hd expr in aux ur path in @@ -584,7 +663,7 @@ and simpl_data_declaration : Raw.data_decl -> _ result = let name = x.name.value in let%bind t = simpl_type_expression x.var_type in let%bind expression = simpl_expression x.init in - return_let_in ~loc (Var.of_name name, Some t) false expression + return_let_in ~loc (Var.of_name name, Some t) false false expression | LocalConst x -> let (x , loc) = r_split x in let name = x.name.value in @@ -596,7 +675,7 @@ and simpl_data_declaration : Raw.data_decl -> _ result = | Some {value; _} -> npseq_to_list value.ne_elements |> List.exists (fun Region.{value; _} -> value = "\"inline\"") - in return_let_in ~loc (Var.of_name name, Some t) inline expression + in return_let_in ~loc (Var.of_name name, Some t) false inline expression | LocalFun f -> let (f , loc) = r_split f in let%bind (binder, expr) = simpl_fun_decl ~loc f in @@ -606,22 +685,22 @@ and simpl_data_declaration : Raw.data_decl -> _ result = | Some {value; _} -> npseq_to_list value.ne_elements |> List.exists (fun Region.{value; _} -> value = "\"inline\"") - in return_let_in ~loc binder inline expr + in return_let_in ~loc binder false inline expr and simpl_param : - Raw.param_decl -> (expression_variable * type_expression) result = + Raw.param_decl -> (string * type_expression) result = fun t -> match t with | ParamConst c -> let c = c.value in - let type_name = Var.of_name c.var.value in + let param_name = c.var.value in let%bind type_expression = simpl_type_expression c.param_type in - ok (type_name , type_expression) + ok (param_name , type_expression) | ParamVar v -> let c = v.value in - let type_name = Var.of_name c.var.value in + let param_name = c.var.value in let%bind type_expression = simpl_type_expression c.param_type in - ok (type_name , type_expression) + ok (param_name , type_expression) and simpl_fun_decl : loc:_ -> Raw.fun_decl -> @@ -652,10 +731,10 @@ and simpl_fun_decl : let%bind result = let aux prec cur = cur (Some prec) in bind_fold_right_list aux result body in - let expression : expression = e_lambda ~loc binder (Some input_type) + let expression : expression = e_lambda ~loc (Var.of_name binder) (Some input_type) (Some output_type) result in let type_annotation = - Some (make_t @@ T_arrow (input_type, output_type)) in + Some (make_t @@ T_arrow {type1=input_type;type2=output_type}) in ok ((Var.of_name fun_name.value, type_annotation), expression) ) | lst -> ( @@ -667,11 +746,11 @@ and simpl_fun_decl : let type_expression = t_tuple (List.map snd params) in (arguments_name , type_expression) in let%bind tpl_declarations = - let aux = fun i x -> + let aux = fun i (param, type_expr) -> let expr = - e_accessor (e_variable arguments_name) [Access_tuple i] in - let type_variable = Some (snd x) in - let ass = return_let_in (fst x , type_variable) inline expr in + e_accessor (e_variable arguments_name) (string_of_int i) in + let type_variable = Some type_expr in + let ass = return_let_in (Var.of_name param , type_variable) false inline expr in ass in bind_list @@ List.mapi aux params in @@ -683,8 +762,8 @@ and simpl_fun_decl : let aux prec cur = cur (Some prec) in bind_fold_right_list aux result body in let expression = - e_lambda ~loc binder (Some input_type) (Some output_type) result in - let type_annotation = Some (make_t @@ T_arrow (input_type, output_type)) in + e_lambda ~loc binder (Some (input_type)) (Some output_type) result in + let type_annotation = Some (make_t @@ T_arrow {type1=input_type; type2=output_type}) in ok ((Var.of_name fun_name.value, type_annotation), expression) ) ) @@ -706,11 +785,10 @@ and simpl_fun_expression : let%bind result = let aux prec cur = cur (Some prec) in bind_fold_right_list aux result body in - let expression : expression = e_lambda ~loc binder (Some input_type) + let expression : expression = e_lambda ~loc (Var.of_name binder) (Some input_type) (Some output_type) result in - let type_annotation = - Some (make_t @@ T_arrow (input_type, output_type)) in - ok (type_annotation, expression) + let type_annotation = Some (make_t @@ T_arrow {type1=input_type;type2=output_type}) in + ok (type_annotation , expression) ) | lst -> ( let lst = npseq_to_list lst in @@ -721,11 +799,10 @@ and simpl_fun_expression : let type_expression = t_tuple (List.map snd params) in (arguments_name , type_expression) in let%bind tpl_declarations = - let aux = fun i x -> - let expr = - e_accessor (e_variable arguments_name) [Access_tuple i] in - let type_variable = Some (snd x) in - let ass = return_let_in (fst x , type_variable) false expr in + let aux = fun i (param, param_type) -> + let expr = e_accessor (e_variable arguments_name) (string_of_int i) in + let type_variable = Some param_type in + let ass = return_let_in (Var.of_name param , type_variable) false false expr in ass in bind_list @@ List.mapi aux params in @@ -738,8 +815,8 @@ and simpl_fun_expression : bind_fold_right_list aux result body in let expression = e_lambda ~loc binder (Some (input_type)) (Some output_type) result in - let type_annotation = Some (make_t @@ T_arrow (input_type, output_type)) in - ok (type_annotation, expression) + let type_annotation = Some (make_t @@ T_arrow {type1=input_type;type2=output_type}) in + ok (type_annotation , expression) ) ) @@ -770,6 +847,35 @@ and simpl_statement_list statements = hook (simpl_data_declaration d :: acc) statements in bind_list @@ hook [] (List.rev statements) +and get_case_variables (t:Raw.pattern) : expression_variable list result = + match t with + | PConstr PFalse _ + | PConstr PTrue _ + | PConstr PNone _ -> ok @@ [] + | PConstr PSomeApp v -> (let (_,v) = v.value in get_case_variables (v.value.inside)) + | PConstr PConstrApp v -> ( + match v.value with + | constr, None -> ok @@ [ Var.of_name constr.value] + | constr, pat_opt -> + let%bind pat = + trace_option (unsupported_cst_constr t) @@ + pat_opt in + let pat = npseq_to_list pat.value.inside in + let%bind var = bind_map_list get_case_variables pat in + ok @@ [Var.of_name constr.value ] @ (List.concat var) + ) + | PList PNil _ -> ok @@ [] + | PList PCons c -> ( + match c.value with + | a, [(_, b)] -> + let%bind a = get_case_variables a in + let%bind b = get_case_variables b in + ok @@ a@b + | _ -> fail @@ unsupported_deep_list_patterns c + ) + | PVar v -> ok @@ [Var.of_name v.value] + | p -> fail @@ unsupported_cst_constr p + and simpl_single_instruction : Raw.instruction -> (_ -> expression result) result = fun t -> match t with @@ -799,19 +905,14 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul return_statement @@ e_skip ~loc () ) | Loop (While l) -> - let l = l.value in - let%bind cond = simpl_expression l.cond in - let%bind body = simpl_block l.block.value in - let%bind body = body None in - return_statement @@ e_loop cond body - | Loop (For (ForInt fi)) -> + simpl_while_loop l.value + | Loop (For (ForInt fi)) -> ( let%bind loop = simpl_for_int fi.value in - let%bind loop = loop None in - return_statement @@ loop + ok loop + ) | Loop (For (ForCollect fc)) -> let%bind loop = simpl_for_collect fc.value in - let%bind loop = loop None in - return_statement @@ loop + ok loop | Cond c -> ( let (c , loc) = r_split c in let%bind expr = simpl_expression c.test in @@ -833,9 +934,22 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul simpl_block value | ShortBlock {value; _} -> simpl_statements @@ fst value.inside in - let%bind match_true = match_true None in - let%bind match_false = match_false None in - return_statement @@ e_matching expr ~loc (Match_bool {match_true; match_false}) + let env = Var.fresh () in + + let%bind match_true' = match_true None in + let%bind match_false' = match_false None in + let%bind match_true = match_true @@ Some (e_variable env) in + let%bind match_false = match_false @@ Some (e_variable env) in + + let%bind ((_,free_vars_true), match_true) = repair_mutable_variable match_true [] env in + let%bind ((_,free_vars_false), match_false) = repair_mutable_variable match_false [] env in + let free_vars = free_vars_true @ free_vars_false in + if (List.length free_vars != 0) then + let match_expr = e_matching expr ~loc (Match_bool {match_true; match_false}) in + let return_expr = e_let_in (env,None) false false (store_mutable_variable free_vars) match_expr in + restore_mutable_variable return_expr free_vars env + else + return_statement @@ e_matching expr ~loc (Match_bool {match_true=match_true'; match_false=match_false'}) ) | Assign a -> ( let (a , loc) = r_split a in @@ -843,7 +957,8 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul match a.lhs with | Path path -> ( let (name , path') = simpl_path path in - return_statement @@ e_assign ~loc name path' value_expr + let (let_binder, mut, rhs, inline) = e_assign_with_let ~loc name path' value_expr in + return_let_in let_binder mut inline rhs ) | MapPath v -> ( let v' = v.value in @@ -856,14 +971,16 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul in let%bind key_expr = simpl_expression v'.index.value.inside in let expr' = e_map_add key_expr value_expr map in - return_statement @@ e_assign ~loc varname path expr' + let (let_binder, mut, rhs, inline) = e_assign_with_let ~loc varname path expr' in + return_let_in let_binder mut inline rhs ) ) | CaseInstr c -> ( let (c , loc) = r_split c in let%bind expr = simpl_expression c.expr in - let%bind cases = - let aux (x : Raw.if_clause Raw.case_clause Raw.reg) = + let env = Var.fresh () in + let%bind (fv,cases) = + let aux fv (x : Raw.if_clause Raw.case_clause Raw.reg) = let%bind case_clause = match x.value.rhs with ClauseInstr i -> @@ -874,42 +991,43 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul simpl_block value | ShortBlock {value; _} -> simpl_statements @@ fst value.inside in - let%bind case_clause = case_clause None in - ok (x.value.pattern, case_clause) in - bind_list - @@ List.map aux - @@ npseq_to_list c.cases.value in - let%bind m = simpl_cases cases in - return_statement @@ e_matching ~loc expr m + let%bind case_clause'= case_clause @@ None in + let%bind case_clause = case_clause @@ Some(e_variable env) in + let%bind case_vars = get_case_variables x.value.pattern in + let%bind ((_,free_vars), case_clause) = repair_mutable_variable case_clause case_vars env in + ok (free_vars::fv,(x.value.pattern, case_clause, case_clause')) in + bind_fold_map_list aux [] (npseq_to_list c.cases.value) in + let free_vars = List.concat fv in + if (List.length free_vars == 0) then ( + let cases = List.map (fun case -> let (a,_,b) = case in (a,b)) cases in + let%bind m = simpl_cases cases in + return_statement @@ e_matching ~loc expr m + ) else ( + let cases = List.map (fun case -> let (a,b,_) = case in (a,b)) cases in + let%bind m = simpl_cases cases in + let match_expr = e_matching ~loc expr m in + let return_expr = e_let_in (env,None) false false (store_mutable_variable free_vars) match_expr in + restore_mutable_variable return_expr free_vars env + ) ) | RecordPatch r -> ( - let r = r.value in - let (name , access_path) = simpl_path r.path in - - let head, tail = r.record_inj.value.ne_elements in - - let%bind tail' = bind_list - @@ List.map (fun (x: Raw.field_assign Region.reg) -> - let (x , loc) = r_split x in - let%bind e = simpl_expression x.field_expr - in ok (x.field_name.value, e , loc) - ) - @@ List.map snd tail in - - let%bind head' = - let (x , loc) = r_split head in - let%bind e = simpl_expression x.field_expr - in ok (x.field_name.value, e , loc) in - - let%bind expr = - let aux = fun (access , v , loc) -> - e_assign ~loc name (access_path @ [Access_record access]) v in - - let hd, tl = aux head', List.map aux tail' in - let aux acc cur = e_sequence acc cur in - ok @@ List.fold_left aux hd tl + let reg = r.region in + let (r,loc) = r_split r in + let aux (fa :Raw.field_assign Raw.reg) : Raw.field_path_assign Raw.reg= + {value = {field_path = (fa.value.field_name, []); equal=fa.value.equal; field_expr = fa.value.field_expr}; + region = fa.region} in - return_statement @@ expr + let update : Raw.field_path_assign Raw.reg Raw.ne_injection Raw.reg = { + value = Raw.map_ne_injection aux r.record_inj.value; + region=r.record_inj.region + } in + let u : Raw.update = {record=r.path;kwd_with=r.kwd_with; updates=update} in + let%bind expr = simpl_update {value=u;region=reg} in + let (name , access_path) = simpl_path r.path in + let loc = Some loc in + let (binder, mut, rhs, inline) = e_assign_with_let ?loc name access_path expr in + return_let_in binder mut inline rhs + ) | MapPatch patch -> ( let (map_p, loc) = r_split patch in @@ -923,16 +1041,16 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul in ok @@ (key', value') ) @@ npseq_to_list map_p.map_inj.value.ne_elements in - let expr = - match inj with - | [] -> e_skip ~loc () - | _ :: _ -> - let assigns = List.fold_right - (fun (key, value) map -> (e_map_add key value map)) - inj - (e_accessor ~loc (e_variable (Var.of_name name)) access_path) - in e_assign ~loc name access_path assigns - in return_statement @@ expr + match inj with + | [] -> return_statement @@ e_skip ~loc () + | _ :: _ -> + let assigns = List.fold_right + (fun (key, value) map -> (e_map_add key value map)) + inj + (e_accessor_list ~loc (e_variable (Var.of_name name)) access_path) + in + let (binder, mut, rhs, inline) = e_assign_with_let ~loc name access_path assigns in + return_let_in binder mut inline rhs ) | SetPatch patch -> ( let (setp, loc) = r_split patch in @@ -941,15 +1059,14 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul bind_list @@ List.map simpl_expression @@ npseq_to_list setp.set_inj.value.ne_elements in - let expr = - match inj with - | [] -> e_skip ~loc () - | _ :: _ -> - let assigns = List.fold_right - (fun hd s -> e_constant C_SET_ADD [hd ; s]) - inj (e_accessor ~loc (e_variable (Var.of_name name)) access_path) in - e_assign ~loc name access_path assigns in - return_statement @@ expr + match inj with + | [] -> return_statement @@ e_skip ~loc () + | _ :: _ -> + let assigns = List.fold_right + (fun hd s -> e_constant C_SET_ADD [hd ; s]) + inj (e_accessor_list ~loc (e_variable (Var.of_name name)) access_path) in + let (binder, mut, rhs, inline) = e_assign_with_let ~loc name access_path assigns in + return_let_in binder mut inline rhs ) | MapRemove r -> ( let (v , loc) = r_split r in @@ -963,7 +1080,8 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul in let%bind key' = simpl_expression key in let expr = e_constant ~loc C_MAP_REMOVE [key' ; map] in - return_statement @@ e_assign ~loc varname path expr + let (binder, mut, rhs, inline) = e_assign_with_let ~loc varname path expr in + return_let_in binder mut inline rhs ) | SetRemove r -> ( let (set_rm, loc) = r_split r in @@ -976,10 +1094,11 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul in let%bind removed' = simpl_expression set_rm.element in let expr = e_constant ~loc C_SET_REMOVE [removed' ; set] in - return_statement @@ e_assign ~loc varname path expr + let (binder, mut, rhs, inline) = e_assign_with_let ~loc varname path expr in + return_let_in binder mut inline rhs ) -and simpl_path : Raw.path -> string * Ast_simplified.access_path = fun p -> +and simpl_path : Raw.path -> string * string list = fun p -> match p with | Raw.Name v -> (v.value , []) | Raw.Path p -> ( @@ -989,14 +1108,14 @@ and simpl_path : Raw.path -> string * Ast_simplified.access_path = fun p -> let path' = let aux (s:Raw.selection) = match s with - | FieldName property -> Access_record property.value - | Component index -> Access_tuple (Z.to_int (snd index.value)) + | FieldName property -> property.value + | Component index -> (Z.to_string (snd index.value)) in List.map aux @@ npseq_to_list path in (var , path') ) -and simpl_cases : type a . (Raw.pattern * a) list -> (a, unit) matching result = fun t -> +and simpl_cases : (Raw.pattern * expression) list -> matching_expr result = fun t -> let open Raw in let get_var (t:Raw.pattern) = match t with @@ -1105,223 +1224,108 @@ and simpl_statements : Raw.statements -> (_ -> expression result) result = and simpl_block : Raw.block -> (_ -> expression result) result = fun t -> simpl_statements t.statements +and simpl_while_loop : Raw.while_loop -> (_ -> expression result) result = fun wl -> + let env_rec = Var.fresh () in + let binder = Var.fresh () in + + let%bind cond = simpl_expression wl.cond in + let%bind for_body = simpl_block wl.block.value in + + let ctrl = + (e_variable binder) + in + let%bind for_body = for_body @@ Some( ctrl ) in + let%bind ((_,captured_name_list),for_body) = repair_mutable_variable for_body [] binder in + + let aux name expr= + e_let_in (name,None) false false (e_accessor (e_variable binder) (Var.to_name name)) expr + in + let init_rec = store_mutable_variable @@ captured_name_list in + let restore = fun expr -> List.fold_right aux captured_name_list expr in + let continue_expr = e_constant C_CONTINUE [for_body] in + let stop_expr = e_constant C_STOP [e_variable binder] in + let aux_func = e_cond cond continue_expr (stop_expr) in + let aux_func = (restore (aux_func)) in + let aux_func = e_lambda binder None None @@ aux_func in + let loop = e_constant C_FOLD_WHILE [aux_func; e_variable env_rec] in + let return_expr = e_let_in (env_rec,None) false false init_rec (loop) in + restore_mutable_variable return_expr captured_name_list env_rec + + and simpl_for_int : Raw.for_int -> (_ -> expression result) result = fun fi -> - (* cond part *) - let var = e_variable (Var.of_name fi.assign.value.name.value) in + let env_rec = Var.fresh () in + let binder = Var.fresh () in + let name = fi.assign.value.name.value in + let it = Var.of_name name in + let var = e_variable it in + (*Make the cond and the step *) let%bind value = simpl_expression fi.assign.value.expr in let%bind bound = simpl_expression fi.bound in - let comp = e_annotation (e_constant C_LE [var ; bound]) t_bool - in - (* body part *) - let%bind body = simpl_block fi.block.value in - let%bind body = body None in + let cond = e_annotation (e_constant C_LE [var ; bound]) t_bool in let step = e_int 1 in - let ctrl = e_assign - fi.assign.value.name.value [] (e_constant C_ADD [ var ; step ]) in - let rec add_to_seq expr = match expr.expression with - | E_sequence (_,a) -> add_to_seq a - | _ -> e_sequence body ctrl in - let body' = add_to_seq body in - let loop = e_loop comp body' in - return_statement @@ e_let_in (Var.of_name fi.assign.value.name.value, Some t_int) false value loop + let ctrl = + e_let_in (it,Some t_int) false false (e_constant C_ADD [ var ; step ]) + (e_let_in (binder, None) false false (e_update (e_variable binder) name var) + (e_variable binder)) + in + (* Modify the body loop*) + let%bind for_body = simpl_block fi.block.value in + let%bind for_body = for_body @@ Some( ctrl ) in + let%bind ((_,captured_name_list),for_body) = repair_mutable_variable for_body [it] binder in -(** simpl_for_collect - For loops over collections, like + let aux name expr= + e_let_in (name,None) false false (e_accessor (e_variable binder) (Var.to_name name)) expr + in - ``` concrete syntax : - for x : int in set myset - begin - myint := myint + x ; - myst := myst ^ "to" ; - end - ``` + (* restores the initial value of the free_var*) + let restore = fun expr -> List.fold_right aux captured_name_list expr in - are implemented using a MAP_FOLD, LIST_FOLD or SET_FOLD: + (*Prep the lambda for the fold*) + let continue_expr = e_constant C_CONTINUE [for_body] in + let stop_expr = e_constant C_STOP [e_variable binder] in + let aux_func = e_cond cond continue_expr (stop_expr) in + let aux_func = e_let_in (it,Some t_int) false false (e_accessor (e_variable binder) name) (restore (aux_func)) in + let aux_func = e_lambda binder None None @@ aux_func in - ``` pseudo Ast_simplified - let #COMPILER#folded_record = list_fold( mylist , - record st = st; acc = acc; end; - lamby = fun arguments -> ( - let #COMPILER#acc = arguments.0 in - let #COMPILER#elt_x = arguments.1 in - #COMPILER#acc.myint := #COMPILER#acc.myint + #COMPILER#elt_x ; - #COMPILER#acc.myst := #COMPILER#acc.myst ^ "to" ; - #COMPILER#acc - ) - ) in - { - myst := #COMPILER#folded_record.myst ; - myint := #COMPILER#folded_record.myint ; - } - ``` + (* Make the fold_while en precharge the vakye *) + let loop = e_constant C_FOLD_WHILE [aux_func; e_variable env_rec] in + let init_rec = store_mutable_variable @@ it::captured_name_list in + let return_expr = e_let_in (env_rec,None) false false init_rec (loop) in + let return_expr = e_let_in (it, Some t_int) false false value @@ return_expr in + restore_mutable_variable return_expr captured_name_list env_rec - We are performing the following steps: - 1) Simplifying the for body using ̀simpl_block` - - 2) Detect the free variables and build a list of their names - (myint and myst in the previous example) - Free variables are simply variables being assigned but not defined - locally. - Note: In the case of a nested loops, assignements to a compiler - generated value (#COMPILER#acc) correspond to variables - that were already renamed in the inner loop. - e.g : - ``` - #COMPILER#acc.myint := #COMPILER#acc.myint + #COMPILER#elt_x ; - #COMPILER#acc.myst := #COMPILER#acc.myst ^ "to" ; - ``` - They must not be considered as free variables - - 3) Build the initial record (later passed as 2nd argument of - `MAP/SET/LIST_FOLD`) capturing the environment using the - free variables list of (2) - - 4) In the filtered body of (1), replace occurences: - - free variable of name X as rhs ==> accessor `#COMPILER#acc.X` - - free variable of name X as lhs ==> accessor `#COMPILER#acc.X` - And, in the case of a map: - - references to the iterated key ==> variable `#COMPILER#elt_K` - - references to the iterated value ==> variable `#COMPILER#elt_V` - in the case of a set/list: - - references to the iterated value ==> variable `#COMPILER#elt_X` - Note: In the case of an inner loop capturing variable from an outer loop - the free variable name can be `#COMPILER#acc.Y` and because we do not - capture the accumulator record in the inner loop, we do not want to - generate `#COMPILER#acc.#COMPILER#acc.Y` but `#COMPILER#acc.Y` - - 5) Append the return value to the body - - 6) Prepend the declaration of the lambda arguments to the body which - is a serie of `let .. in`'s - Note that the parameter of the lambda ̀arguments` is a tree of - tuple holding: - * In the case of `list` or ̀set`: - ( folding record , current list/set element ) as - ( #COMPILER#acc , #COMPILER#elt_X ) - * In the case of `map`: - ( folding record , current map key , current map value ) as - ( #COMPILER#acc , #COMPILER#elt_K , #COMPILER#elt_V ) - Note: X , K and V above have to be replaced with their given name - - 7) Build the lambda using the final body of (6) - - 8) Build a sequence of assignments for all the captured variables - to their new value, namely an access to the folded record - (#COMPILER#folded_record) - - 9) Attach the sequence of 8 to the ̀let .. in` declaration - of #COMPILER#folded_record - -**) and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun fc -> - let elt_name = "#COMPILER#elt_"^fc.var.value in - let elt_v_name = match fc.bind_to with - | Some v -> "#COMPILER#elt_"^(snd v).value - | None -> "#COMPILER#elt_unused" in - let element_names = ok @@ match fc.bind_to with + let _elt_name = fc.var.value in + let binder = Var.of_name "arguments" in + let%bind element_names = ok @@ match fc.bind_to with | Some v -> [Var.of_name fc.var.value;Var.of_name (snd v).value] | None -> [Var.of_name fc.var.value] in - (* STEP 1 *) + + let env = Var.fresh () in let%bind for_body = simpl_block fc.block.value in - let%bind for_body = for_body None in - (* STEP 2 *) - let%bind local_decl_name_list = bind_concat (detect_local_declarations for_body) element_names in - let%bind captured_name_list = detect_free_variables for_body local_decl_name_list in - (* STEP 3 *) - let add_to_record (prev: expression SMap.t) (captured_name: string) = - SMap.add captured_name (e_variable (Var.of_name captured_name)) prev in - let init_record = e_record (List.fold_left add_to_record SMap.empty captured_name_list) in - (* STEP 4 *) - let replace exp = - match exp.expression with - (* replace references to fold accumulator as lhs *) - | E_assign ( name , path , expr ) -> ( - if (List.mem name local_decl_name_list ) then - ok @@ exp - else - let name = Var.to_name name in - let path' = List.filter - ( fun el -> - match el with - | Access_record name -> not @@ is_compiler_generated (Var.of_name name) - | _ -> true ) - ((Access_record name)::path) in - ok @@ e_assign "#COMPILER#acc" path' expr ) - | E_variable name -> ( - let name = Var.to_name name in - if (List.mem name captured_name_list) then - (* replace references to fold accumulator as rhs *) - ok @@ e_accessor (e_variable (Var.of_name "#COMPILER#acc")) [Access_record name] (* TODO fresh *) - else match fc.collection with - (* loop on map *) - | Map _ -> - let k' = e_variable (Var.of_name elt_name) in - if ( name = fc.var.value ) then - ok @@ k' (* replace references to the the key *) - else ( - match fc.bind_to with - | Some (_,v) -> - let v' = e_variable (Var.of_name elt_v_name) in - if ( name = v.value ) then - ok @@ v' (* replace references to the the value *) - else ok @@ exp - | None -> ok @@ exp - ) - (* loop on set or list *) - | (Set _ | List _) -> - if (name = fc.var.value ) then - (* replace references to the collection element *) - ok @@ (e_variable (Var.of_name elt_name)) - else ok @@ exp - ) - | _ -> ok @@ exp in - let%bind for_body = Self_ast_simplified.map_expression replace for_body in - (* STEP 5 *) - let rec add_return (expr : expression) = match expr.expression with - | E_sequence (a,b) -> e_sequence a (add_return b) - | _ -> (* TODO fresh *) - e_sequence expr (e_variable (Var.of_name "#COMPILER#acc")) in - let for_body = add_return for_body in - (* STEP 6 *) - let for_body = - let ( arg_access: Types.access_path -> expression ) = - e_accessor (e_variable (Var.of_name "arguments")) in (* TODO fresh *) - ( match fc.collection with - | Map _ -> - let acc = arg_access [Access_tuple 0 ] in - let collec_elt_v = arg_access [Access_tuple 1 ; Access_tuple 0] in - let collec_elt_k = arg_access [Access_tuple 1 ; Access_tuple 1] in - e_let_in (Var.of_name "#COMPILER#acc", None) false acc @@ (* TODO fresh *) - e_let_in (Var.of_name elt_name, None) false collec_elt_v @@ - e_let_in (Var.of_name elt_v_name, None) false collec_elt_k (for_body) - | _ -> - let acc = arg_access [Access_tuple 0] in - let collec_elt = arg_access [Access_tuple 1] in - e_let_in (Var.of_name "#COMPILER#acc", None) false acc @@ (* TODO fresh *) - e_let_in (Var.of_name elt_name, None) false collec_elt (for_body) - ) in - (* STEP 7 *) + let%bind _for_body' = for_body None in + let%bind for_body = for_body @@ Some (e_accessor (e_variable binder) "0") in + let%bind ((_,free_vars), for_body) = repair_mutable_variable_for_collect for_body element_names binder in + + let init_record = store_mutable_variable free_vars in let%bind collect = simpl_expression fc.expr in - let lambda = e_lambda (Var.of_name "arguments") None None for_body in + let aux name expr= + e_let_in (name,None) false false (e_accessor (e_accessor (e_variable binder) "0") (Var.to_name name)) expr + in + let restore = fun expr -> List.fold_right aux free_vars expr in + let restore = match fc.collection with + | Map _ -> (match fc.bind_to with + | Some v -> fun expr -> restore (e_let_in (Var.of_name fc.var.value, None) false false (e_accessor (e_accessor (e_variable binder) "1") "0") + (e_let_in (Var.of_name (snd v).value, None) false false (e_accessor (e_accessor (e_variable binder) "1") "1") expr)) + | None -> fun expr -> restore (e_let_in (Var.of_name fc.var.value, None) false false (e_accessor (e_accessor (e_variable binder) "1") "0") expr) + ) + | _ -> fun expr -> restore (e_let_in (Var.of_name fc.var.value, None) false false (e_accessor (e_variable binder) "1") expr) + in + let lambda = e_lambda binder None None (restore for_body) in let op_name = match fc.collection with | Map _ -> C_MAP_FOLD | Set _ -> C_SET_FOLD | List _ -> C_LIST_FOLD in let fold = e_constant op_name [lambda; collect ; init_record] in - (* STEP 8 *) - let assign_back (prev : expression option) (captured_varname : string) : expression option = - let access = (* TODO fresh *) - e_accessor (e_variable (Var.of_name "#COMPILER#folded_record")) - [Access_record captured_varname] in - let assign = e_assign captured_varname [] access in - match prev with - | None -> Some assign - | Some p -> Some (e_sequence p assign) in - let reassign_sequence = List.fold_left assign_back None captured_name_list in - (* STEP 9 *) - let final_sequence = match reassign_sequence with - (* None case means that no variables were captured *) - | None -> e_skip () - | Some seq -> e_let_in (Var.of_name "#COMPILER#folded_record", None) false fold seq in (* TODO fresh *) - return_statement @@ final_sequence + restore_mutable_variable fold free_vars env and simpl_declaration_list declarations : Ast_simplified.declaration Location.wrap list result = diff --git a/src/passes/3-self_ast_simplified/helpers.ml b/src/passes/3-self_ast_simplified/helpers.ml index 47b06e9b9..40520a0f4 100644 --- a/src/passes/3-self_ast_simplified/helpers.ml +++ b/src/passes/3-self_ast_simplified/helpers.ml @@ -1,13 +1,14 @@ open Ast_simplified open Trace +open Stage_common.Helpers type 'a folder = 'a -> expression -> 'a result let rec fold_expression : 'a folder -> 'a -> expression -> 'a result = fun f init e -> let self = fold_expression f in let%bind init' = f init e in - match e.expression with + match e.expression_content with | E_literal _ | E_variable _ | E_skip -> ok init' - | E_list lst | E_set lst | E_tuple lst | E_constant (_ , lst) -> ( + | E_list lst | E_set lst | E_constant {arguments=lst} -> ( let%bind res = bind_fold_list self init' lst in ok res ) @@ -15,20 +16,24 @@ let rec fold_expression : 'a folder -> 'a -> expression -> 'a result = fun f ini let%bind res = bind_fold_list (bind_fold_pair self) init' lst in ok res ) - | E_look_up ab | E_sequence ab | E_loop ab | E_application ab -> ( + | E_look_up ab -> + let%bind res = bind_fold_pair self init' ab in + ok res + | E_loop {condition;body} -> + let ab = (condition,body) in + let%bind res = bind_fold_pair self init' ab in + ok res + | E_application {expr1;expr2} -> ( + let ab = (expr1,expr2) in let%bind res = bind_fold_pair self init' ab in ok res ) | E_lambda { binder = _ ; input_type = _ ; output_type = _ ; result = e } - | E_ascription (e , _) | E_constructor (_ , e) -> ( + | E_ascription {anno_expr=e; _} | E_constructor {element=e} -> ( let%bind res = self init' e in ok res ) - | E_assign (_ , _path , e) | E_accessor (e , _path) -> ( - let%bind res = self init' e in - ok res - ) - | E_matching (e , cases) -> ( + | E_matching {matchee=e; cases} -> ( let%bind res = self init' e in let%bind res = fold_cases f res cases in ok res @@ -41,14 +46,18 @@ let rec fold_expression : 'a folder -> 'a -> expression -> 'a result = fun f ini let%bind res = bind_fold_lmap aux (ok init') m in ok res ) - | E_update {record;update=(_,expr)} -> ( + | E_record_update {record;update} -> ( let%bind res = self init' record in - let%bind res = fold_expression self res expr in + let%bind res = fold_expression self res update in ok res ) - | E_let_in { binder = _ ; rhs ; result } -> ( + | E_record_accessor {expr} -> ( + let%bind res = self init' expr in + ok res + ) + | E_let_in { let_binder = _ ; rhs ; let_result } -> ( let%bind res = self init' rhs in - let%bind res = self res result in + let%bind res = self res let_result in ok res ) @@ -85,8 +94,8 @@ type mapper = expression -> expression result let rec map_expression : mapper -> expression -> expression result = fun f e -> let self = map_expression f in let%bind e' = f e in - let return expression = ok { e' with expression } in - match e'.expression with + let return expression_content = ok { e' with expression_content } in + match e'.expression_content with | E_list lst -> ( let%bind lst' = bind_map_list self lst in return @@ E_list lst' @@ -103,68 +112,58 @@ let rec map_expression : mapper -> expression -> expression result = fun f e -> let%bind lst' = bind_map_list (bind_map_pair self) lst in return @@ E_big_map lst' ) - | E_sequence ab -> ( - let%bind ab' = bind_map_pair self ab in - return @@ E_sequence ab' - ) | E_look_up ab -> ( let%bind ab' = bind_map_pair self ab in return @@ E_look_up ab' ) - | E_loop ab -> ( - let%bind ab' = bind_map_pair self ab in - return @@ E_loop ab' + | E_loop {condition;body} -> ( + let ab = (condition,body) in + let%bind (a,b) = bind_map_pair self ab in + return @@ E_loop {condition = a; body = b} ) - | E_ascription (e , t) -> ( - let%bind e' = self e in - return @@ E_ascription (e' , t) + | E_ascription ascr -> ( + let%bind e' = self ascr.anno_expr in + return @@ E_ascription {ascr with anno_expr=e'} ) - | E_assign (name , path , e) -> ( - let%bind e' = self e in - return @@ E_assign (name , path , e') - ) - | E_matching (e , cases) -> ( + | E_matching {matchee=e;cases} -> ( let%bind e' = self e in let%bind cases' = map_cases f cases in - return @@ E_matching (e' , cases') + return @@ E_matching {matchee=e';cases=cases'} ) - | E_accessor (e , path) -> ( - let%bind e' = self e in - return @@ E_accessor (e' , path) + | E_record_accessor acc -> ( + let%bind e' = self acc.expr in + return @@ E_record_accessor {acc with expr = e'} ) | E_record m -> ( let%bind m' = bind_map_lmap self m in return @@ E_record m' ) - | E_update {record; update=(l,expr)} -> ( + | E_record_update {record; path; update} -> ( let%bind record = self record in - let%bind expr = self expr in - return @@ E_update {record;update=(l,expr)} + let%bind update = self update in + return @@ E_record_update {record;path;update} ) - | E_constructor (name , e) -> ( - let%bind e' = self e in - return @@ E_constructor (name , e') + | E_constructor c -> ( + let%bind e' = self c.element in + return @@ E_constructor {c with element = e'} + ) + | E_application {expr1;expr2} -> ( + let ab = (expr1,expr2) in + let%bind (a,b) = bind_map_pair self ab in + return @@ E_application {expr1=a;expr2=b} ) - | E_tuple lst -> ( - let%bind lst' = bind_map_list self lst in - return @@ E_tuple lst' - ) - | E_application ab -> ( - let%bind ab' = bind_map_pair self ab in - return @@ E_application ab' - ) - | E_let_in { binder ; rhs ; result; inline } -> ( + | E_let_in { let_binder ; mut; rhs ; let_result; inline } -> ( let%bind rhs = self rhs in - let%bind result = self result in - return @@ E_let_in { binder ; rhs ; result; inline } + let%bind let_result = self let_result in + return @@ E_let_in { let_binder ; mut; rhs ; let_result; inline } ) | E_lambda { binder ; input_type ; output_type ; result } -> ( let%bind result = self result in return @@ E_lambda { binder ; input_type ; output_type ; result } ) - | E_constant (name , lst) -> ( - let%bind lst' = bind_map_list self lst in - return @@ E_constant (name , lst') + | E_constant c -> ( + let%bind args = bind_map_list self c.arguments in + return @@ E_constant {c with arguments=args} ) | E_literal _ | E_variable _ | E_skip as e' -> return e' @@ -209,3 +208,113 @@ and map_program : mapper -> program -> program result = fun m p -> | Declaration_type _ -> ok x in bind_map_list (bind_map_location aux) p + +type 'a fold_mapper = 'a -> expression -> (bool * 'a * expression) result +let rec fold_map_expression : 'a fold_mapper -> 'a -> expression -> ('a * expression) result = fun f a e -> + let self = fold_map_expression f in + let%bind (continue, init',e') = f a e in + if (not continue) then ok(init',e') + else + let return expression_content = { e' with expression_content } in + match e'.expression_content with + | E_list lst -> ( + let%bind (res, lst') = bind_fold_map_list self init' lst in + ok (res, return @@ E_list lst') + ) + | E_set lst -> ( + let%bind (res, lst') = bind_fold_map_list self init' lst in + ok (res, return @@ E_set lst') + ) + | E_map lst -> ( + let%bind (res, lst') = bind_fold_map_list (bind_fold_map_pair self) init' lst in + ok (res, return @@ E_map lst') + ) + | E_big_map lst -> ( + let%bind (res, lst') = bind_fold_map_list (bind_fold_map_pair self) init' lst in + ok (res, return @@ E_big_map lst') + ) + | E_look_up ab -> ( + let%bind (res, ab') = bind_fold_map_pair self init' ab in + ok (res, return @@ E_look_up ab') + ) + | E_loop {condition;body} -> ( + let ab = (condition,body) in + let%bind (res,(a,b)) = bind_fold_map_pair self init' ab in + ok (res, return @@ E_loop {condition = a; body = b}) + ) + | E_ascription ascr -> ( + let%bind (res,e') = self init' ascr.anno_expr in + ok (res, return @@ E_ascription {ascr with anno_expr=e'}) + ) + | E_matching {matchee=e;cases} -> ( + let%bind (res, e') = self init' e in + let%bind (res,cases') = fold_map_cases f res cases in + ok (res, return @@ E_matching {matchee=e';cases=cases'}) + ) + | E_record_accessor acc -> ( + let%bind (res, e') = self init' acc.expr in + ok (res, return @@ E_record_accessor {acc with expr = e'}) + ) + | E_record m -> ( + let%bind (res, lst') = bind_fold_map_list (fun res (k,e) -> let%bind (res,e) = self res e in ok (res,(k,e))) init' (LMap.to_kv_list m) in + let m' = LMap.of_list lst' in + ok (res, return @@ E_record m') + ) + | E_record_update {record; path; update} -> ( + let%bind (res, record) = self init' record in + let%bind (res, update) = self res update in + ok (res, return @@ E_record_update {record;path;update}) + ) + | E_constructor c -> ( + let%bind (res,e') = self init' c.element in + ok (res, return @@ E_constructor {c with element = e'}) + ) + | E_application {expr1;expr2} -> ( + let ab = (expr1,expr2) in + let%bind (res,(a,b)) = bind_fold_map_pair self init' ab in + ok (res, return @@ E_application {expr1=a;expr2=b}) + ) + | E_let_in { let_binder ; mut; rhs ; let_result; inline } -> ( + let%bind (res,rhs) = self init' rhs in + let%bind (res,let_result) = self res let_result in + ok (res, return @@ E_let_in { let_binder ; mut; rhs ; let_result ; inline }) + ) + | E_lambda { binder ; input_type ; output_type ; result } -> ( + let%bind (res,result) = self init' result in + ok ( res, return @@ E_lambda { binder ; input_type ; output_type ; result }) + ) + | E_constant c -> ( + let%bind (res,args) = bind_fold_map_list self init' c.arguments in + ok (res, return @@ E_constant {c with arguments=args}) + ) + | E_literal _ | E_variable _ | E_skip as e' -> ok (init', return e') + +and fold_map_cases : 'a fold_mapper -> 'a -> matching_expr -> ('a * matching_expr) result = fun f init m -> + match m with + | Match_bool { match_true ; match_false } -> ( + let%bind (init, match_true) = fold_map_expression f init match_true in + let%bind (init, match_false) = fold_map_expression f init match_false in + ok @@ (init, Match_bool { match_true ; match_false }) + ) + | Match_list { match_nil ; match_cons = (hd , tl , cons, _) } -> ( + let%bind (init, match_nil) = fold_map_expression f init match_nil in + let%bind (init, cons) = fold_map_expression f init cons in + ok @@ (init, Match_list { match_nil ; match_cons = (hd , tl , cons, ()) }) + ) + | Match_option { match_none ; match_some = (name , some, _) } -> ( + let%bind (init, match_none) = fold_map_expression f init match_none in + let%bind (init, some) = fold_map_expression f init some in + ok @@ (init, Match_option { match_none ; match_some = (name , some, ()) }) + ) + | Match_tuple ((names , e), _) -> ( + let%bind (init, e') = fold_map_expression f init e in + ok @@ (init, Match_tuple ((names , e'), [])) + ) + | Match_variant (lst, _) -> ( + let aux init ((a , b) , e) = + let%bind (init,e') = fold_map_expression f init e in + ok (init, ((a , b) , e')) + in + let%bind (init,lst') = bind_fold_map_list aux init lst in + ok @@ (init, Match_variant (lst', ())) + ) diff --git a/src/passes/3-self_ast_simplified/literals.ml b/src/passes/3-self_ast_simplified/literals.ml index dbdaa22db..367e9787f 100644 --- a/src/passes/3-self_ast_simplified/literals.ml +++ b/src/passes/3-self_ast_simplified/literals.ml @@ -52,8 +52,8 @@ end open Errors let peephole_expression : expression -> expression result = fun e -> - let return expression = ok { e with expression } in - match e.expression with + let return expression_content = ok { e with expression_content } in + match e.expression_content with | E_literal (Literal_key_hash s) as l -> ( let open Tezos_crypto in let%bind (_pkh:Crypto.Signature.public_key_hash) = @@ -82,18 +82,18 @@ let peephole_expression : expression -> expression result = fun e -> Signature.Public_key.of_b58check s in return l ) - | E_constant (C_BIG_MAP_LITERAL as cst, lst) -> ( + | E_constant {cons_name=C_BIG_MAP_LITERAL as cst; arguments=lst} -> ( let%bind elt = trace_option (bad_single_arity cst e.location) @@ List.to_singleton lst in let%bind lst = trace_strong (bad_map_param_type cst e.location) @@ - get_e_list elt.expression + get_e_list elt.expression_content in - let aux = fun (e' : expression) -> + let aux = fun (e : expression) -> trace_strong (bad_map_param_type cst e.location) @@ - let%bind tpl = get_e_tuple e'.expression in + let%bind tpl = get_e_tuple e.expression_content in let%bind (a , b) = trace_option (simple_error "of pairs") @@ List.to_pair tpl @@ -103,18 +103,18 @@ let peephole_expression : expression -> expression result = fun e -> let%bind pairs = bind_map_list aux lst in return @@ E_big_map pairs ) - | E_constant (C_MAP_LITERAL as cst, lst) -> ( + | E_constant {cons_name=C_MAP_LITERAL as cst; arguments=lst} -> ( let%bind elt = trace_option (bad_single_arity cst e.location) @@ List.to_singleton lst in let%bind lst = trace_strong (bad_map_param_type cst e.location) @@ - get_e_list elt.expression + get_e_list elt.expression_content in - let aux = fun (e' : expression) -> + let aux = fun (e : expression) -> trace_strong (bad_map_param_type cst e.location) @@ - let%bind tpl = get_e_tuple e'.expression in + let%bind tpl = get_e_tuple e.expression_content in let%bind (a , b) = trace_option (simple_error "of pairs") @@ List.to_pair tpl @@ -124,32 +124,33 @@ let peephole_expression : expression -> expression result = fun e -> let%bind pairs = bind_map_list aux lst in return @@ E_map pairs ) - | E_constant (C_BIG_MAP_EMPTY as cst, lst) -> ( + | E_constant {cons_name=C_BIG_MAP_EMPTY as cst; arguments=lst} -> ( let%bind () = trace_strong (bad_empty_arity cst e.location) @@ Assert.assert_list_empty lst in return @@ E_big_map [] ) - | E_constant (C_MAP_EMPTY as cst, lst) -> ( + | E_constant {cons_name=C_MAP_EMPTY as cst; arguments=lst} -> ( let%bind () = trace_strong (bad_empty_arity cst e.location) @@ Assert.assert_list_empty lst in return @@ E_map [] ) - | E_constant (C_SET_LITERAL as cst, lst) -> ( + + | E_constant {cons_name=C_SET_LITERAL as cst; arguments=lst} -> ( let%bind elt = trace_option (bad_single_arity cst e.location) @@ List.to_singleton lst in let%bind lst = trace_strong (bad_set_param_type cst e.location) @@ - get_e_list elt.expression + get_e_list elt.expression_content in return @@ E_set lst ) - | E_constant (C_SET_EMPTY as cst, lst) -> ( + | E_constant {cons_name=C_SET_EMPTY as cst; arguments=lst} -> ( let%bind () = trace_strong (bad_empty_arity cst e.location) @@ Assert.assert_list_empty lst diff --git a/src/passes/3-self_ast_simplified/none_variant.ml b/src/passes/3-self_ast_simplified/none_variant.ml index 42aaedc11..416142f0f 100644 --- a/src/passes/3-self_ast_simplified/none_variant.ml +++ b/src/passes/3-self_ast_simplified/none_variant.ml @@ -2,8 +2,8 @@ open Ast_simplified open Trace let peephole_expression : expression -> expression result = fun e -> - let return expression = ok { e with expression } in - match e.expression with - | E_constructor (Constructor "Some" , e) -> return @@ E_constant (C_SOME , [ e ]) - | E_constructor (Constructor "None" , _) -> return @@ E_constant (C_NONE , [ ]) + let return expression_content = ok { e with expression_content } in + match e.expression_content with + | E_constructor {constructor=Constructor "Some";element=e} -> return @@ E_constant {cons_name=C_SOME;arguments=[ e ]} + | E_constructor {constructor=Constructor "None"; _} -> return @@ E_constant {cons_name=C_NONE ; arguments=[]} | e -> return e diff --git a/src/passes/3-self_ast_simplified/self_ast_simplified.ml b/src/passes/3-self_ast_simplified/self_ast_simplified.ml index f0ecd5183..8f8eee099 100644 --- a/src/passes/3-self_ast_simplified/self_ast_simplified.ml +++ b/src/passes/3-self_ast_simplified/self_ast_simplified.ml @@ -17,3 +17,5 @@ let all_expression = let map_expression = Helpers.map_expression let fold_expression = Helpers.fold_expression + +let fold_map_expression = Helpers.fold_map_expression diff --git a/src/passes/3-self_ast_simplified/tezos_type_annotation.ml b/src/passes/3-self_ast_simplified/tezos_type_annotation.ml index 81b13f748..cc6557ae2 100644 --- a/src/passes/3-self_ast_simplified/tezos_type_annotation.ml +++ b/src/passes/3-self_ast_simplified/tezos_type_annotation.ml @@ -13,10 +13,10 @@ end open Errors let peephole_expression : expression -> expression result = fun e -> - let return expression = ok { e with expression } in - match e.expression with - | E_ascription (e' , t) as e -> ( - match (e'.expression , t.type_expression') with + let return expression_content = ok { e with expression_content } in + match e.expression_content with + | E_ascription {anno_expr=e'; type_annotation=t} as e -> ( + match (e'.expression_content , t.type_content) with | (E_literal (Literal_string s) , T_constant (TC_key_hash)) -> return @@ E_literal (Literal_key_hash s) | (E_literal (Literal_string s) , T_constant (TC_signature)) -> return @@ E_literal (Literal_signature s) | (E_literal (Literal_string s) , T_constant (TC_key)) -> return @@ E_literal (Literal_key s) @@ -34,4 +34,4 @@ let peephole_expression : expression -> expression result = fun e -> ) | _ -> return e ) - | e -> return e \ No newline at end of file + | e -> return e diff --git a/src/passes/4-typer-new/PP.ml b/src/passes/4-typer-new/PP.ml index a8829aef3..c91f6905f 100644 --- a/src/passes/4-typer-new/PP.ml +++ b/src/passes/4-typer-new/PP.ml @@ -7,7 +7,6 @@ let type_constraint : _ -> type_constraint_simpl -> unit = fun ppf -> let ct = match c_tag with | Solver.Core.C_arrow -> "arrow" | Solver.Core.C_option -> "option" - | Solver.Core.C_tuple -> "tuple" | Solver.Core.C_record -> failwith "record" | Solver.Core.C_variant -> failwith "variant" | Solver.Core.C_map -> "map" diff --git a/src/passes/4-typer-new/solver.ml b/src/passes/4-typer-new/solver.ml index a81f04f3c..198cba936 100644 --- a/src/passes/4-typer-new/solver.ml +++ b/src/passes/4-typer-new/solver.ml @@ -9,13 +9,13 @@ module Wrap = struct module Errors = struct - let unknown_type_constructor (ctor : string) (te : T.type_value) () = + let unknown_type_constructor (ctor : string) (te : T.type_expression) () = let title = (thunk "unknown type constructor") in (* TODO: sanitize the "ctor" argument before displaying it. *) let message () = ctor in let data = [ ("ctor" , fun () -> ctor) ; - ("expression" , fun () -> Format.asprintf "%a" T.PP.type_value te) ; + ("expression" , fun () -> Format.asprintf "%a" T.PP.type_expression te) ; (* ("location" , fun () -> Format.asprintf "%a" Location.pp te.location) *) (* TODO *) ] in error ~data title message () @@ -32,16 +32,17 @@ module Wrap = struct (* let%bind state' = add_type state t in *) (* return expr state' in *) - let rec type_expression_to_type_value : T.type_value -> O.type_value = fun te -> - match te.type_value' with + let rec type_expression_to_type_value : T.type_expression -> O.type_value = fun te -> + match te.type_content with | T_sum kvmap -> let () = failwith "fixme: don't use to_list, it drops the variant keys, rows have a differnt kind than argument lists for now!" in P_constant (C_variant, T.CMap.to_list @@ T.CMap.map type_expression_to_type_value kvmap) | T_record kvmap -> let () = failwith "fixme: don't use to_list, it drops the record keys, rows have a differnt kind than argument lists for now!" in P_constant (C_record, T.LMap.to_list @@ T.LMap.map type_expression_to_type_value kvmap) - | T_arrow (arg , ret) -> - P_constant (C_arrow, List.map type_expression_to_type_value [ arg ; ret ]) + | T_arrow {type1;type2} -> + P_constant (C_arrow, List.map type_expression_to_type_value [ type1 ; type2 ]) + | T_variable (type_name) -> P_variable type_name | T_constant (type_name) -> let csttag = Core.(match type_name with @@ -58,7 +59,8 @@ module Wrap = struct | TC_key -> C_key | TC_signature -> C_signature | TC_operation -> C_operation - | TC_chain_id -> C_unit (* TODO : replace with chain_id*) + | TC_chain_id -> C_unit (* TODO : replace with chain_id *) + | TC_void -> C_unit (* TODO : replace with void *) ) in P_constant (csttag, []) @@ -68,25 +70,24 @@ module Wrap = struct | TC_set s -> (C_set, [s]) | TC_map ( k , v ) -> (C_map, [k;v]) | TC_big_map ( k , v) -> (C_big_map, [k;v]) + | TC_arrow ( arg , ret ) -> (C_arrow, [ arg ; ret ]) | TC_list l -> (C_list, [l]) | TC_contract c -> (C_contract, [c]) - | TC_arrow ( arg , ret ) -> (C_arrow, [ arg ; ret ]) - | TC_tuple lst -> (C_tuple, lst) ) in P_constant (csttag, List.map type_expression_to_type_value args) let rec type_expression_to_type_value_copypasted : I.type_expression -> O.type_value = fun te -> - match te.type_expression' with + match te.type_content with | T_sum kvmap -> let () = failwith "fixme: don't use to_list, it drops the variant keys, rows have a differnt kind than argument lists for now!" in P_constant (C_variant, I.CMap.to_list @@ I.CMap.map type_expression_to_type_value_copypasted kvmap) | T_record kvmap -> let () = failwith "fixme: don't use to_list, it drops the record keys, rows have a differnt kind than argument lists for now!" in P_constant (C_record, I.LMap.to_list @@ I.LMap.map type_expression_to_type_value_copypasted kvmap) - | T_arrow (arg , ret) -> - P_constant (C_arrow, List.map type_expression_to_type_value_copypasted [ arg ; ret ]) - | T_variable type_name -> P_variable type_name + | T_arrow {type1;type2} -> + P_constant (C_arrow, List.map type_expression_to_type_value_copypasted [ type1 ; type2 ]) + | T_variable type_name -> P_variable (type_name) (* eird stuff*) | T_constant (type_name) -> let csttag = Core.(match type_name with | TC_unit -> C_unit @@ -104,7 +105,6 @@ module Wrap = struct | TC_big_map ( k , v ) -> (C_big_map, [k;v]) | TC_contract c -> (C_contract, [c]) | TC_arrow ( arg , ret ) -> (C_arrow, [ arg ; ret ]) - | TC_tuple lst -> (C_tuple, lst) ) in P_constant (csttag, List.map type_expression_to_type_value_copypasted args) @@ -113,12 +113,12 @@ module Wrap = struct let type_name = Core.fresh_type_variable () in [] , type_name - let variable : I.expression_variable -> T.type_value -> (constraints * T.type_variable) = fun _name expr -> + let variable : I.expression_variable -> T.type_expression -> (constraints * T.type_variable) = fun _name expr -> let pattern = type_expression_to_type_value expr in let type_name = Core.fresh_type_variable () in [C_equation (P_variable (type_name) , pattern)] , type_name - let literal : T.type_value -> (constraints * T.type_variable) = fun t -> + let literal : T.type_expression -> (constraints * T.type_variable) = fun t -> let pattern = type_expression_to_type_value t in let type_name = Core.fresh_type_variable () in [C_equation (P_variable (type_name) , pattern)] , type_name @@ -135,9 +135,9 @@ module Wrap = struct [C_equation (P_variable (type_name) , pattern)] , type_name *) - let tuple : T.type_value list -> (constraints * T.type_variable) = fun tys -> + let tuple : T.type_expression list -> (constraints * T.type_variable) = fun tys -> let patterns = List.map type_expression_to_type_value tys in - let pattern = O.(P_constant (C_tuple , patterns)) in + let pattern = O.(P_constant (C_record , patterns)) in let type_name = Core.fresh_type_variable () in [C_equation (P_variable (type_name) , pattern)] , type_name @@ -165,16 +165,13 @@ module Wrap = struct end (* TODO: I think we should take an I.expression for the base+label *) - let access_label ~(base : T.type_value) ~(label : O.accessor) : (constraints * T.type_variable) = + let access_label ~(base : T.type_expression) ~(label : O.accessor) : (constraints * T.type_variable) = let base' = type_expression_to_type_value base in let expr_type = Core.fresh_type_variable () in [O.C_access_label (base' , label , expr_type)] , expr_type - let access_int ~base ~index = access_label ~base ~label:(L_int index) - let access_string ~base ~property = access_label ~base ~label:(L_string property) - let constructor - : T.type_value -> T.type_value -> T.type_value -> (constraints * T.type_variable) + : T.type_expression -> T.type_expression -> T.type_expression -> (constraints * T.type_variable) = fun t_arg c_arg sum -> let t_arg = type_expression_to_type_value t_arg in let c_arg = type_expression_to_type_value c_arg in @@ -185,12 +182,12 @@ module Wrap = struct C_equation (t_arg , c_arg) ] , whole_expr - let record : T.type_value I.label_map -> (constraints * T.type_variable) = fun fields -> + let record : T.type_expression T.label_map -> (constraints * T.type_variable) = fun fields -> let record_type = type_expression_to_type_value (T.t_record fields ()) in let whole_expr = Core.fresh_type_variable () in [C_equation (P_variable whole_expr , record_type)] , whole_expr - let collection : O.constant_tag -> T.type_value list -> (constraints * T.type_variable) = + let collection : O.constant_tag -> T.type_expression list -> (constraints * T.type_variable) = fun ctor element_tys -> let elttype = O.P_variable (Core.fresh_type_variable ()) in let aux elt = @@ -205,7 +202,7 @@ module Wrap = struct let list = collection O.C_list let set = collection O.C_set - let map : (T.type_value * T.type_value) list -> (constraints * T.type_variable) = + let map : (T.type_expression * T.type_expression) list -> (constraints * T.type_variable) = fun kv_tys -> let k_type = O.P_variable (Core.fresh_type_variable ()) in let v_type = O.P_variable (Core.fresh_type_variable ()) in @@ -222,7 +219,7 @@ module Wrap = struct C_equation (P_variable whole_expr , O.P_constant (C_map , [k_type ; v_type])) ] @ equations_k @ equations_v , whole_expr - let big_map : (T.type_value * T.type_value) list -> (constraints * T.type_variable) = + let big_map : (T.type_expression * T.type_expression) list -> (constraints * T.type_variable) = fun kv_tys -> let k_type = O.P_variable (Core.fresh_type_variable ()) in let v_type = O.P_variable (Core.fresh_type_variable ()) in @@ -241,7 +238,7 @@ module Wrap = struct C_equation (P_variable whole_expr , O.P_constant (C_big_map , [k_type ; v_type])) ] @ equations_k @ equations_v , whole_expr - let application : T.type_value -> T.type_value -> (constraints * T.type_variable) = + let application : T.type_expression -> T.type_expression -> (constraints * T.type_variable) = fun f arg -> let whole_expr = Core.fresh_type_variable () in let f' = type_expression_to_type_value f in @@ -250,7 +247,7 @@ module Wrap = struct C_equation (f' , P_constant (C_arrow , [arg' ; P_variable whole_expr])) ] , whole_expr - let look_up : T.type_value -> T.type_value -> (constraints * T.type_variable) = + let look_up : T.type_expression -> T.type_expression -> (constraints * T.type_variable) = fun ds ind -> let ds' = type_expression_to_type_value ds in let ind' = type_expression_to_type_value ind in @@ -261,7 +258,7 @@ module Wrap = struct C_equation (P_variable whole_expr , P_constant (C_option , [P_variable v])) ] , whole_expr - let sequence : T.type_value -> T.type_value -> (constraints * T.type_variable) = + let sequence : T.type_expression -> T.type_expression -> (constraints * T.type_variable) = fun a b -> let a' = type_expression_to_type_value a in let b' = type_expression_to_type_value b in @@ -271,7 +268,7 @@ module Wrap = struct C_equation (b' , P_variable whole_expr) ] , whole_expr - let loop : T.type_value -> T.type_value -> (constraints * T.type_variable) = + let loop : T.type_expression -> T.type_expression -> (constraints * T.type_variable) = fun expr body -> let expr' = type_expression_to_type_value expr in let body' = type_expression_to_type_value body in @@ -282,7 +279,7 @@ module Wrap = struct C_equation (P_variable whole_expr , P_constant (C_unit , [])) ] , whole_expr - let let_in : T.type_value -> T.type_value option -> T.type_value -> (constraints * T.type_variable) = + let let_in : T.type_expression -> T.type_expression option -> T.type_expression -> (constraints * T.type_variable) = fun rhs rhs_tv_opt result -> let rhs' = type_expression_to_type_value rhs in let result' = type_expression_to_type_value result in @@ -294,7 +291,7 @@ module Wrap = struct C_equation (result' , P_variable whole_expr) ] @ rhs_tv_opt', whole_expr - let assign : T.type_value -> T.type_value -> (constraints * T.type_variable) = + let assign : T.type_expression -> T.type_expression -> (constraints * T.type_variable) = fun v e -> let v' = type_expression_to_type_value v in let e' = type_expression_to_type_value e in @@ -304,7 +301,7 @@ module Wrap = struct C_equation (P_variable whole_expr , P_constant (C_unit , [])) ] , whole_expr - let annotation : T.type_value -> T.type_value -> (constraints * T.type_variable) = + let annotation : T.type_expression -> T.type_expression -> (constraints * T.type_variable) = fun e annot -> let e' = type_expression_to_type_value e in let annot' = type_expression_to_type_value annot in @@ -314,20 +311,20 @@ module Wrap = struct C_equation (e' , P_variable whole_expr) ] , whole_expr - let matching : T.type_value list -> (constraints * T.type_variable) = + let matching : T.type_expression list -> (constraints * T.type_variable) = fun es -> let whole_expr = Core.fresh_type_variable () in - let type_values = (List.map type_expression_to_type_value es) in - let cs = List.map (fun e -> O.C_equation (P_variable whole_expr , e)) type_values + let type_expressions = (List.map type_expression_to_type_value es) in + let cs = List.map (fun e -> O.C_equation (P_variable whole_expr , e)) type_expressions in cs, whole_expr let fresh_binder () = Core.fresh_type_variable () let lambda - : T.type_value -> - T.type_value option -> - T.type_value option -> + : T.type_expression -> + T.type_expression option -> + T.type_expression option -> (constraints * T.type_variable) = fun fresh arg body -> let whole_expr = Core.fresh_type_variable () in @@ -347,11 +344,11 @@ module Wrap = struct ] @ arg' @ body' , whole_expr (* This is pretty much a wrapper for an n-ary function. *) - let constant : O.type_value -> T.type_value list -> (constraints * T.type_variable) = + let constant : O.type_value -> T.type_expression list -> (constraints * T.type_variable) = fun f args -> let whole_expr = Core.fresh_type_variable () in let args' = List.map type_expression_to_type_value args in - let args_tuple = O.P_constant (C_tuple , args') in + let args_tuple = O.P_constant (C_record , args') in O.[ C_equation (f , P_constant (C_arrow , [args_tuple ; P_variable whole_expr])) ] , whole_expr @@ -441,8 +438,8 @@ and c_constructor_simpl = { tv_list : type_variable list; } (* copy-pasted from core.ml *) -and c_const = (type_variable * type_value) -and c_equation = (type_value * type_value) +and c_const = (type_variable * type_expression) +and c_equation = (type_expression * type_expression) and c_typeclass_simpl = { tc : typeclass ; args : type_variable list ; @@ -742,97 +739,93 @@ let compare_simple_c_constant = function | C_arrow -> (function (* N/A -> 1 *) | C_arrow -> 0 - | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) + | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_option -> (function | C_arrow -> 1 | C_option -> 0 - | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) - | C_tuple -> (function - | C_arrow | C_option -> 1 - | C_tuple -> 0 - | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) + | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_record -> (function - | C_arrow | C_option | C_tuple -> 1 + | C_arrow | C_option -> 1 | C_record -> 0 | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_variant -> (function - | C_arrow | C_option | C_tuple | C_record -> 1 + | C_arrow | C_option | C_record -> 1 | C_variant -> 0 | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_map -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant -> 1 + | C_arrow | C_option | C_record | C_variant -> 1 | C_map -> 0 | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_big_map -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map -> 1 + | C_arrow | C_option | C_record | C_variant | C_map -> 1 | C_big_map -> 0 | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_list -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map -> 1 | C_list -> 0 | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_set -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list -> 1 | C_set -> 0 | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_unit -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set -> 1 | C_unit -> 0 | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_bool -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit -> 1 | C_bool -> 0 | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_string -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool -> 1 | C_string -> 0 | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_nat -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string -> 1 | C_nat -> 0 | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_mutez -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat -> 1 | C_mutez -> 0 | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_timestamp -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez -> 1 | C_timestamp -> 0 | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_int -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp -> 1 | C_int -> 0 | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_address -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int -> 1 | C_address -> 0 | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_bytes -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address -> 1 | C_bytes -> 0 | C_key_hash | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_key_hash -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes -> 1 | C_key_hash -> 0 | C_key | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_key -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash -> 1 | C_key -> 0 | C_signature | C_operation | C_contract | C_chain_id -> -1) | C_signature -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key -> 1 | C_signature -> 0 | C_operation | C_contract | C_chain_id -> -1) | C_operation -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature -> 1 | C_operation -> 0 | C_contract | C_chain_id -> -1) | C_contract -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation -> 1 | C_contract -> 0 | C_chain_id -> -1) | C_chain_id -> (function - | C_arrow | C_option | C_tuple | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract -> 1 + | C_arrow | C_option | C_record | C_variant | C_map | C_big_map | C_list | C_set | C_unit | C_bool | C_string | C_nat | C_mutez | C_timestamp | C_int | C_address | C_bytes | C_key_hash | C_key | C_signature | C_operation | C_contract -> 1 | C_chain_id -> 0 (* N/A -> -1 *) ) @@ -844,7 +837,6 @@ let debug_pp_constant : _ -> constant_tag -> unit = fun ppf c_tag -> let ct = match c_tag with | Core.C_arrow -> "arrow" | Core.C_option -> "option" - | Core.C_tuple -> "tuple" | Core.C_record -> failwith "record" | Core.C_variant -> failwith "variant" | Core.C_map -> "map" @@ -910,16 +902,17 @@ let rec compare_list f = function | [] -> (function [] -> 0 | _::_ -> -1) (* This follows the behaviour of Pervasives.compare for lists of different length *) let compare_type_variable a b = Var.compare a b -let compare_label = function - | L_int a -> (function L_int b -> Int.compare a b | L_string _ -> -1) - | L_string a -> (function L_int _ -> 1 | L_string b -> String.compare a b) -let rec compare_typeclass a b = compare_list (compare_list compare_type_value) a b -and compare_type_value = function +let compare_label (a:accessor) (b:accessor) = + let Label a = a in + let Label b = b in + String.compare a b +let rec compare_typeclass a b = compare_list (compare_list compare_type_expression) a b +and compare_type_expression = function | P_forall { binder=a1; constraints=a2; body=a3 } -> (function | P_forall { binder=b1; constraints=b2; body=b3 } -> compare_type_variable a1 b1 compare_list compare_type_constraint a2 b2 - compare_type_value a3 b3 + compare_type_expression a3 b3 | P_variable _ -> -1 | P_constant _ -> -1 | P_apply _ -> -1) @@ -931,33 +924,33 @@ and compare_type_value = function | P_constant (a1, a2) -> (function | P_forall _ -> 1 | P_variable _ -> 1 - | P_constant (b1, b2) -> compare_simple_c_constant a1 b1 compare_list compare_type_value a2 b2 + | P_constant (b1, b2) -> compare_simple_c_constant a1 b1 compare_list compare_type_expression a2 b2 | P_apply _ -> -1) | P_apply (a1, a2) -> (function | P_forall _ -> 1 | P_variable _ -> 1 | P_constant _ -> 1 - | P_apply (b1, b2) -> compare_type_value a1 b1 compare_type_value a2 b2) + | P_apply (b1, b2) -> compare_type_expression a1 b1 compare_type_expression a2 b2) and compare_type_constraint = function | C_equation (a1, a2) -> (function - | C_equation (b1, b2) -> compare_type_value a1 b1 compare_type_value a2 b2 + | C_equation (b1, b2) -> compare_type_expression a1 b1 compare_type_expression a2 b2 | C_typeclass _ -> -1 | C_access_label _ -> -1) | C_typeclass (a1, a2) -> (function | C_equation _ -> 1 - | C_typeclass (b1, b2) -> compare_list compare_type_value a1 b1 compare_typeclass a2 b2 + | C_typeclass (b1, b2) -> compare_list compare_type_expression a1 b1 compare_typeclass a2 b2 | C_access_label _ -> -1) | C_access_label (a1, a2, a3) -> (function | C_equation _ -> 1 | C_typeclass _ -> 1 - | C_access_label (b1, b2, b3) -> compare_type_value a1 b1 compare_label a2 b2 compare_type_variable a3 b3) + | C_access_label (b1, b2, b3) -> compare_type_expression a1 b1 compare_label a2 b2 compare_type_variable a3 b3) let compare_type_constraint_list = compare_list compare_type_constraint let compare_p_forall { binder = a1; constraints = a2; body = a3 } { binder = b1; constraints = b2; body = b3 } = compare_type_variable a1 b1 compare_type_constraint_list a2 b2 - compare_type_value a3 b3 + compare_type_expression a3 b3 let compare_c_poly_simpl { tv = a1; forall = a2 } { tv = b1; forall = b2 } = compare_type_variable a1 b1 compare_p_forall a2 b2 @@ -1110,7 +1103,7 @@ let rec select_and_propagate_all : _ -> type_constraint selector_input list -> s * unification_vars : unionfind ; * * (\* assigns a value to the representant in the unionfind *\) - * assignments : type_value TypeVariableMap.t ; + * assignments : type_expression TypeVariableMap.t ; * * (\* constraints related to a type variable *\) * constraints : constraints TypeVariableMap.t ; @@ -1151,7 +1144,7 @@ let initial_state : state = (* { let discard_state (_ : state) = () (* let replace_var_in_state = fun (v : type_variable) (state : state) -> *) -(* let aux_tv : type_value -> _ = function *) +(* let aux_tv : type_expression -> _ = function *) (* | P_forall (w , cs , tval) -> failwith "TODO" *) (* | P_variable (w) -> *) (* if w = v then *) diff --git a/src/passes/4-typer-new/typer.ml b/src/passes/4-typer-new/typer.ml index 0f75c8bb6..7c0b045be 100644 --- a/src/passes/4-typer-new/typer.ml +++ b/src/passes/4-typer-new/typer.ml @@ -15,7 +15,7 @@ module Errors = struct let title = (thunk "unbound type variable") in let message () = "" in let data = [ - ("variable" , fun () -> Format.asprintf "%a" Stage_common.PP.type_variable tv) ; + ("variable" , fun () -> Format.asprintf "%a" I.PP.type_variable tv) ; (* TODO: types don't have srclocs for now. *) (* ("location" , fun () -> Format.asprintf "%a" Location.pp (n.location)) ; *) ("in" , fun () -> Format.asprintf "%a" Environment.PP.full_environment e) @@ -23,7 +23,7 @@ module Errors = struct error ~data title message () let unbound_variable (e:environment) (n:I.expression_variable) (loc:Location.t) () = - let name () = Format.asprintf "%a" Stage_common.PP.name n in + let name () = Format.asprintf "%a" I.PP.expression_variable n in let title = (thunk ("unbound variable "^(name ()))) in let message () = "" in let data = [ @@ -33,7 +33,7 @@ module Errors = struct ] in error ~data title message () - let match_empty_variant : type a . (a,unit) I.matching -> Location.t -> unit -> _ = + let match_empty_variant : I.matching_expr -> Location.t -> unit -> _ = fun matching loc () -> let title = (thunk "match with no cases") in let message () = "" in @@ -43,7 +43,7 @@ module Errors = struct ] in error ~data title message () - let match_missing_case : type a . (a, unit) I.matching -> Location.t -> unit -> _ = + let match_missing_case : I.matching_expr -> Location.t -> unit -> _ = fun matching loc () -> let title = (thunk "missing case in match") in let message () = "" in @@ -53,7 +53,7 @@ module Errors = struct ] in error ~data title message () - let match_redundant_case : type a . (a, unit) I.matching -> Location.t -> unit -> _ = + let match_redundant_case : I.matching_expr -> Location.t -> unit -> _ = fun matching loc () -> let title = (thunk "redundant case in match") in let message () = "" in @@ -63,11 +63,11 @@ module Errors = struct ] in error ~data title message () - let unbound_constructor (e:environment) (c:I.constructor) (loc:Location.t) () = + let unbound_constructor (e:environment) (c:I.constructor') (loc:Location.t) () = let title = (thunk "unbound constructor") in let message () = "" in let data = [ - ("constructor" , fun () -> Format.asprintf "%a" Stage_common.PP.constructor c) ; + ("constructor" , fun () -> Format.asprintf "%a" I.PP.constructor c) ; ("environment" , fun () -> Format.asprintf "%a" Environment.PP.full_environment e) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in @@ -103,27 +103,27 @@ module Errors = struct ] in error ~data title message () - let constant_declaration_error (name: I.expression_variable) (ae:I.expr) (expected: O.type_value option) () = + let constant_declaration_error (name: I.expression_variable) (ae:I.expr) (expected: O.type_expression option) () = let title = (thunk "typing constant declaration") in let message () = "" in let data = [ - ("constant" , fun () -> Format.asprintf "%a" Stage_common.PP.name name) ; (* Todo : remove Stage_common*) + ("constant" , fun () -> Format.asprintf "%a" I.PP.expression_variable name) ; (* Todo : remove Stage_common*) ("expression" , fun () -> Format.asprintf "%a" I.PP.expression ae) ; ("expected" , fun () -> match expected with None -> "(no annotation for the expected type)" - | Some expected -> Format.asprintf "%a" O.PP.type_value expected) ; + | Some expected -> Format.asprintf "%a" O.PP.type_expression expected) ; ("location" , fun () -> Format.asprintf "%a" Location.pp ae.location) ] in error ~data title message () - let match_error : type a . ?msg:string -> expected: (a, unit) I.matching -> actual: O.type_value -> Location.t -> unit -> _ = + let match_error : ?msg:string -> expected: I.matching_expr -> actual: O.type_expression -> Location.t -> unit -> _ = fun ?(msg = "") ~expected ~actual loc () -> let title = (thunk "typing match") in let message () = msg in let data = [ ("expected" , fun () -> Format.asprintf "%a" I.PP.matching_type expected); - ("actual" , fun () -> Format.asprintf "%a" O.PP.type_value actual) ; + ("actual" , fun () -> Format.asprintf "%a" O.PP.type_expression actual) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in error ~data title message () @@ -148,39 +148,17 @@ module Errors = struct * ] in * error ~data title message () *) - let type_error ?(msg="") ~(expected: O.type_value) ~(actual: O.type_value) ~(expression : I.expression) (loc:Location.t) () = + let type_error ?(msg="") ~(expected: O.type_expression) ~(actual: O.type_expression) ~(expression : I.expression) (loc:Location.t) () = let title = (thunk "type error") in let message () = msg in let data = [ - ("expected" , fun () -> Format.asprintf "%a" O.PP.type_value expected); - ("actual" , fun () -> Format.asprintf "%a" O.PP.type_value actual); + ("expected" , fun () -> Format.asprintf "%a" O.PP.type_expression expected); + ("actual" , fun () -> Format.asprintf "%a" O.PP.type_expression actual); ("expression" , fun () -> Format.asprintf "%a" I.PP.expression expression) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in error ~data title message () - let bad_tuple_index (index : int) (ae : I.expression) (t : O.type_value) (loc:Location.t) () = - let title = (thunk "invalid tuple index") in - let message () = "" in - let data = [ - ("index" , fun () -> Format.asprintf "%d" index) ; - ("tuple_value" , fun () -> Format.asprintf "%a" I.PP.expression ae) ; - ("tuple_type" , fun () -> Format.asprintf "%a" O.PP.type_value t) ; - ("location" , fun () -> Format.asprintf "%a" Location.pp loc) - ] in - error ~data title message () - - let bad_record_access (field : string) (ae : I.expression) (t : O.type_value) (loc:Location.t) () = - let title = (thunk "invalid record field") in - let message () = "" in - let data = [ - ("field" , fun () -> Format.asprintf "%s" field) ; - ("record_value" , fun () -> Format.asprintf "%a" I.PP.expression ae) ; - ("tuple_type" , fun () -> Format.asprintf "%a" O.PP.type_value t) ; - ("location" , fun () -> Format.asprintf "%a" Location.pp loc) - ] in - error ~data title message () - let not_supported_yet_untranspile (message : string) (ae : O.expression) () = let title = (thunk "not supported yet") in let message () = message in @@ -216,7 +194,7 @@ let rec type_program (p:I.program) : O.program result = let rec type_declaration env state : I.declaration -> (environment * Solver.state * O.declaration option) result = function | Declaration_type (type_name , type_expression) -> let%bind tv = evaluate_type env type_expression in - let env' = Environment.add_type type_name tv env in + let env' = Environment.add_type (type_name) tv env in ok (env', state , None) | Declaration_constant (name , tv_opt , inline, expression) -> ( (* @@ -227,10 +205,10 @@ let rec type_declaration env state : I.declaration -> (environment * Solver.stat trace (constant_declaration_error name expression tv'_opt) @@ type_expression env state expression in let env' = Environment.add_ez_ae name ae' env in - ok (env', state' , Some (O.Declaration_constant ((make_n_e name ae') , inline, (env , env')))) + ok (env', state' , Some (O.Declaration_constant (name, ae', inline, env') )) ) -and type_match : environment -> Solver.state -> O.type_value -> ('i, unit) I.matching -> I.expression -> Location.t -> ((O.value, O.type_value) O.matching * Solver.state) result = +and type_match : environment -> Solver.state -> O.type_expression -> I.matching_expr -> I.expression -> Location.t -> (O.matching_expr * Solver.state) result = fun e state t i ae loc -> match i with | Match_bool {match_true ; match_false} -> let%bind _ = @@ -285,7 +263,7 @@ and type_match : environment -> Solver.state -> O.type_value -> ('i, unit) I.mat ~expression:ae loc ) @@ - Ast_typed.assert_type_value_eq (variant , variant') >>? fun () -> + Ast_typed.assert_type_expression_eq (variant , variant') >>? fun () -> ok (Some variant) ) in ok acc in @@ -327,13 +305,13 @@ and type_match : environment -> Solver.state -> O.type_value -> ('i, unit) I.mat Recursively search the type_expression and return a result containing the type_value at the leaves *) -and evaluate_type (e:environment) (t:I.type_expression) : O.type_value result = +and evaluate_type (e:environment) (t:I.type_expression) : O.type_expression result = let return tv' = ok (make_t tv' (Some t)) in - match t.type_expression' with - | T_arrow (a, b) -> - let%bind a' = evaluate_type e a in - let%bind b' = evaluate_type e b in - return (T_arrow (a', b')) + match t.type_content with + | T_arrow {type1;type2} -> + let%bind type1 = evaluate_type e type1 in + let%bind type2 = evaluate_type e type2 in + return (T_arrow {type1;type2}) | T_sum m -> let aux k v prev = let%bind prev' = prev in @@ -353,7 +331,7 @@ and evaluate_type (e:environment) (t:I.type_expression) : O.type_value result = | T_variable name -> let%bind tv = trace_option (unbound_type_variable e name) - @@ Environment.get_type_opt name e in + @@ Environment.get_type_opt (name) e in ok tv | T_constant cst -> return (T_constant cst) @@ -383,13 +361,10 @@ and evaluate_type (e:environment) (t:I.type_expression) : O.type_value result = let%bind arg' = evaluate_type e arg in let%bind ret' = evaluate_type e ret in ok @@ O.TC_arrow ( arg' , ret' ) - | TC_tuple lst -> - let%bind lst' = bind_map_list (evaluate_type e) lst in - ok @@ O.TC_tuple lst' in return (T_operator (opt)) -and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.expression -> (O.annotated_expression * Solver.state) result = fun e state ?tv_opt ae -> +and type_expression : environment -> Solver.state -> ?tv_opt:O.type_expression -> I.expression -> (O.expression * Solver.state) result = fun e state ?tv_opt ae -> let () = ignore tv_opt in (* For compatibility with the old typer's API, this argument can be removed once the new typer is used. *) let open Solver in let module L = Logger.Stateful() in @@ -410,7 +385,7 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e ] in error ~data title content in trace main_error @@ - match ae.expression with + match ae.expression_content with (* TODO: this file should take care only of the order in which program fragments are translated by Wrap.xyz @@ -426,11 +401,12 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e * return expr'' state' constraints expr_type * ) *) | E_variable name -> ( + let name'= name in let%bind (tv' : Environment.element) = trace_option (unbound_variable e name ae.location) - @@ Environment.get_opt name e in + @@ Environment.get_opt name' e in let (constraints , expr_type) = Wrap.variable name tv'.type_value in - let expr' = e_variable name in + let expr' = e_variable name' in return expr' state constraints expr_type ) | E_literal (Literal_bool b) -> ( @@ -475,6 +451,9 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e | E_literal (Literal_unit) -> ( return_wrapped (e_unit ()) state @@ Wrap.literal (t_unit ()) ) + | E_literal (Literal_void) -> ( + failwith "TODO: missing implementation for literal void" + ) | E_skip -> ( (* E_skip just returns unit *) return_wrapped (e_unit ()) state @@ Wrap.literal (t_unit ()) @@ -485,44 +464,29 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e * | Some (T_constant ("address" , [])) -> return (E_literal (Literal_address s)) (t_address ()) * | _ -> return (E_literal (Literal_string s)) (t_string ()) * ) *) - (* Tuple *) - | E_tuple lst -> ( - let aux state hd = type_expression e state hd >>? swap in - let%bind (state', lst') = bind_fold_map_list aux state lst in - let tv_lst = List.map get_type_annotation lst' in - return_wrapped (e_tuple lst') state' @@ Wrap.tuple tv_lst - ) - | E_accessor (base , [Access_tuple index]) -> ( - let%bind (base' , state') = type_expression e state base in - let wrapped = Wrap.access_int ~base:base'.type_annotation ~index in - return_wrapped (E_tuple_accessor (base' , index)) state' wrapped - ) - | E_accessor (base , [Access_record property]) -> ( - let%bind (base' , state') = type_expression e state base in - let wrapped = Wrap.access_string ~base:base'.type_annotation ~property in - return_wrapped (E_record_accessor (base' , Label property)) state' wrapped - ) - | E_accessor (_base , []) | E_accessor (_base , _ :: _ :: _) -> ( - failwith - "The simplifier should produce E_accessor with only a single path element, not a list of path elements." + | E_record_accessor {expr;label} -> ( + let%bind (base' , state') = type_expression e state expr in + let wrapped = Wrap.access_label ~base:base'.type_expression ~label in + return_wrapped (E_record_accessor {expr=base';label}) state' wrapped ) (* Sum *) - | E_constructor (c, expr) -> + | E_constructor {constructor;element} -> let%bind (c_tv, sum_tv) = let error = let title () = "no such constructor" in let content () = Format.asprintf "%a in:\n%a\n" - Stage_common.PP.constructor c + Stage_common.PP.constructor constructor O.Environment.PP.full_environment e in error title content in trace_option error @@ - Environment.get_constructor c e in - let%bind (expr' , state') = type_expression e state expr in - let wrapped = Wrap.constructor expr'.type_annotation c_tv sum_tv in - return_wrapped (E_constructor (c , expr')) state' wrapped + Environment.get_constructor constructor e in + let%bind (expr' , state') = type_expression e state element in + let%bind _assert = O.assert_type_expression_eq (expr'.type_expression, c_tv) in + let wrapped = Wrap.constructor expr'.type_expression c_tv sum_tv in + return_wrapped (E_constructor {constructor; element=expr'}) state' wrapped (* Record *) | E_record m -> @@ -530,25 +494,25 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e let%bind (expr' , state') = type_expression e state expr in ok (I.LMap.add k expr' acc , state') in - let%bind (m' , state') = I.bind_fold_lmap aux (ok (I.LMap.empty , state)) m in - let wrapped = Wrap.record (I.LMap.map get_type_annotation m') in + let%bind (m' , state') = Stage_common.Helpers.bind_fold_lmap aux (ok (I.LMap.empty , state)) m in + let wrapped = Wrap.record (I.LMap.map get_type_expression m') in return_wrapped (E_record m') state' wrapped - | E_update {record; update=(k,expr)} -> + | E_record_update {record; path; update} -> let%bind (record, state) = type_expression e state record in - let%bind (expr,state) = type_expression e state expr in - let wrapped = get_type_annotation record in + let%bind (update,state) = type_expression e state update in + let wrapped = get_type_expression record in let%bind (wrapped,tv) = - match wrapped.type_value' with + match wrapped.type_content with | T_record record -> ( - let field_op = I.LMap.find_opt k record in + let field_op = I.LMap.find_opt path record in match field_op with | Some tv -> ok (record,tv) - | None -> failwith @@ Format.asprintf "field %a is not part of record" Stage_common.PP.label k + | None -> failwith @@ Format.asprintf "field %a is not part of record" Stage_common.PP.label path ) | _ -> failwith "Update an expression which is not a record" in - let%bind () = O.assert_type_value_eq (tv, get_type_annotation expr) in - return_wrapped (E_record_update (record, (k,expr))) state (Wrap.record wrapped) + let%bind () = O.assert_type_expression_eq (tv, get_type_expression update) in + return_wrapped (E_record_update {record; path; update}) state (Wrap.record wrapped) (* Data-structure *) (* @@ -629,20 +593,20 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e | E_list lst -> let%bind (state', lst') = bind_fold_map_list (fun state' elt -> type_expression e state' elt >>? swap) state lst in - let wrapped = Wrap.list (List.map (fun x -> O.(x.type_annotation)) lst') in + let wrapped = Wrap.list (List.map (fun x -> O.(x.type_expression)) lst') in return_wrapped (E_list lst') state' wrapped | E_set set -> let aux = fun state' elt -> type_expression e state' elt >>? swap in let%bind (state', set') = bind_fold_map_list aux state set in - let wrapped = Wrap.set (List.map (fun x -> O.(x.type_annotation)) set') in + let wrapped = Wrap.set (List.map (fun x -> O.(x.type_expression)) set') in return_wrapped (E_set set') state' wrapped | E_map map -> let aux' state' elt = type_expression e state' elt >>? swap in let aux = fun state' elt -> bind_fold_map_pair aux' state' elt in let%bind (state', map') = bind_fold_map_list aux state map in - let aux (x, y) = O.(x.type_annotation , y.type_annotation) in + let aux (x, y) = O.(x.type_expression , y.type_expression) in let wrapped = Wrap.map (List.map aux map') in return_wrapped (E_map map') state' wrapped @@ -681,7 +645,7 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e let aux = fun state' elt -> bind_fold_map_pair aux' state' elt in let%bind (state', big_map') = bind_fold_map_list aux state big_map in - let aux (x, y) = O.(x.type_annotation , y.type_annotation) in + let aux (x, y) = O.(x.type_expression , y.type_expression) in let wrapped = Wrap.big_map (List.map aux big_map') in return_wrapped (E_big_map big_map') state' wrapped @@ -727,11 +691,11 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e * let%bind (name', tv) = * type_constant name tv_lst tv_opt ae.location in * return (E_constant (name' , lst')) tv *) - | E_application (f, arg) -> - let%bind (f' , state') = type_expression e state f in - let%bind (arg , state'') = type_expression e state' arg in - let wrapped = Wrap.application f'.type_annotation arg.type_annotation in - return_wrapped (E_application (f' , arg)) state'' wrapped + | E_application {expr1;expr2} -> + let%bind (f' , state') = type_expression e state expr1 in + let%bind (arg , state'') = type_expression e state' expr2 in + let wrapped = Wrap.application f'.type_expression arg.type_expression in + return_wrapped (E_application {expr1=f';expr2=arg}) state'' wrapped (* | E_look_up dsi -> * let%bind (ds, ind) = bind_map_pair (type_expression e) dsi in @@ -742,7 +706,7 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e | E_look_up dsi -> let aux' state' elt = type_expression e state' elt >>? swap in let%bind (state'' , (ds , ind)) = bind_fold_map_pair aux' state dsi in - let wrapped = Wrap.look_up ds.type_annotation ind.type_annotation in + let wrapped = Wrap.look_up ds.type_expression ind.type_expression in return_wrapped (E_look_up (ds , ind)) state'' wrapped (* Advanced *) @@ -770,82 +734,52 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e * tv_opt in * return (O.E_matching (ex', m')) tv * ) *) - | E_sequence (a , b) -> - let%bind (a' , state') = type_expression e state a in - let%bind (b' , state'') = type_expression e state' b in - let wrapped = Wrap.sequence a'.type_annotation b'.type_annotation in - return_wrapped (O.E_sequence (a' , b')) state'' wrapped - | E_loop (expr , body) -> - let%bind (expr' , state') = type_expression e state expr in + | E_loop {condition; body} -> + let%bind (expr' , state') = type_expression e state condition in let%bind (body' , state'') = type_expression e state' body in - let wrapped = Wrap.loop expr'.type_annotation body'.type_annotation in - return_wrapped (O.E_loop (expr' , body')) state'' wrapped - | E_let_in {binder ; rhs ; result ; inline} -> - let%bind rhs_tv_opt = bind_map_option (evaluate_type e) (snd binder) in + let wrapped = Wrap.loop expr'.type_expression body'.type_expression in + return_wrapped (O.E_loop {condition=expr';body=body'}) state'' wrapped + | E_let_in {let_binder ; rhs ; let_result; inline} -> + let%bind rhs_tv_opt = bind_map_option (evaluate_type e) (snd let_binder) in (* TODO: the binder annotation should just be an annotation node *) let%bind (rhs , state') = type_expression e state rhs in - let e' = Environment.add_ez_declaration (fst binder) rhs e in - let%bind (result , state'') = type_expression e' state' result in + let let_binder = fst let_binder in + let e' = Environment.add_ez_declaration (let_binder) rhs e in + let%bind (let_result , state'') = type_expression e' state' let_result in let wrapped = - Wrap.let_in rhs.type_annotation rhs_tv_opt result.type_annotation in - return_wrapped (E_let_in {binder = fst binder; rhs; result; inline}) state'' wrapped - | E_assign (name , path , expr) -> - let%bind typed_name = - let%bind ele = Environment.get_trace name e in - ok @@ make_n_t name ele.type_value in - let%bind (assign_tv , path') = - let aux : ((_ * O.access_path) as 'a) -> I.access -> 'a result = fun (prec_tv , prec_path) cur_path -> - match cur_path with - | Access_tuple index -> ( - let%bind tpl = get_t_tuple prec_tv in - let%bind tv' = - trace_option (bad_tuple_index index ae prec_tv ae.location) @@ - List.nth_opt tpl index in - ok (tv' , prec_path @ [O.Access_tuple index]) - ) - | Access_record property -> ( - let%bind m = get_t_record prec_tv in - let%bind tv' = - trace_option (bad_record_access property ae prec_tv ae.location) @@ - I.LMap.find_opt (Label property) m in - ok (tv' , prec_path @ [O.Access_record property]) - ) - in - bind_fold_list aux (typed_name.type_value , []) path in - let%bind (expr' , state') = type_expression e state expr in - let wrapped = Wrap.assign assign_tv expr'.type_annotation in - return_wrapped (O.E_assign (typed_name , path' , expr')) state' wrapped - | E_ascription (expr , te) -> - let%bind tv = evaluate_type e te in - let%bind (expr' , state') = type_expression e state expr in - let wrapped = Wrap.annotation expr'.type_annotation tv + Wrap.let_in rhs.type_expression rhs_tv_opt let_result.type_expression in + return_wrapped (E_let_in {let_binder; rhs; let_result; inline}) state'' wrapped + | E_ascription {anno_expr;type_annotation} -> + let%bind tv = evaluate_type e type_annotation in + let%bind (expr' , state') = type_expression e state anno_expr in + let wrapped = Wrap.annotation expr'.type_expression tv (* TODO: we're probably discarding too much by using expr'.expression. Previously: {expr' with type_annotation = the_explicit_type_annotation} but then this case is not like the others and doesn't call return_wrapped, which might do some necessary work *) - in return_wrapped expr'.expression state' wrapped + in return_wrapped expr'.expression_content state' wrapped - | E_matching (ex, m) -> ( - let%bind (ex' , state') = type_expression e state ex in - let%bind (m' , state'') = type_match e state' ex'.type_annotation m ae ae.location in + | E_matching {matchee;cases} -> ( + let%bind (ex' , state') = type_expression e state matchee in + let%bind (m' , state'') = type_match e state' ex'.type_expression cases ae ae.location in let tvs = - let aux (cur:(O.value, O.type_value) O.matching) = + let aux (cur:(O.expression, O.type_expression) O.matching_content) = match cur with | Match_bool { match_true ; match_false } -> [ match_true ; match_false ] | Match_list { match_nil ; match_cons = (_ , _ , match_cons, _) } -> [ match_nil ; match_cons ] | Match_option { match_none ; match_some = (_ , match_some, _) } -> [ match_none ; match_some ] | Match_tuple ((_ , match_tuple), _) -> [ match_tuple ] | Match_variant (lst , _) -> List.map snd lst in - List.map get_type_annotation @@ aux m' in + List.map get_type_expression @@ aux m' in let%bind () = match tvs with - [] -> fail @@ match_empty_variant m ae.location + [] -> fail @@ match_empty_variant cases ae.location | _ -> ok () in (* constraints: all the items of tvs should be equal to the first one result = first item of tvs *) let wrapped = Wrap.matching tvs in - return_wrapped (O.E_matching (ex', m')) state'' wrapped + return_wrapped (O.E_matching {matchee=ex';cases=m'}) state'' wrapped ) (* match m with *) @@ -885,18 +819,19 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e let%bind input_type' = bind_map_option (evaluate_type e) input_type in let%bind output_type' = bind_map_option (evaluate_type e) output_type in - let fresh : O.type_value = t_variable (Wrap.fresh_binder ()) () in - let e' = Environment.add_ez_binder (fst binder) fresh e in + let fresh : O.type_expression = t_variable (Wrap.fresh_binder ()) () in + let binder = fst binder in + let e' = Environment.add_ez_binder (binder) fresh e in let%bind (result , state') = type_expression e' state result in let () = Printf.printf "this does not make use of the typed body, this code sounds buggy." in let wrapped = Wrap.lambda fresh input_type' output_type' in return_wrapped - (E_lambda {binder = fst binder; body=result}) (* TODO: is the type of the entire lambda enough to access the input_type=fresh; ? *) + (E_lambda {binder = binder; result}) (* TODO: is the type of the entire lambda enough to access the input_type=fresh; ? *) state' wrapped ) - | E_constant (name, lst) -> + | E_constant {cons_name=name; arguments=lst} -> let () = ignore (name , lst) in let%bind t = Operators.Typer.Operators_types.constant_type name in let aux acc expr = @@ -904,10 +839,10 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e let%bind (expr, state') = type_expression e state expr in ok (expr::lst , state') in let%bind (lst , state') = bind_fold_list aux ([], state) lst in - let lst_annot = List.map (fun (x : O.value) -> x.type_annotation) lst in + let lst_annot = List.map (fun (x : O.expression) -> x.type_expression) lst in let wrapped = Wrap.constant t lst_annot in return_wrapped - (E_constant (name, lst)) + (E_constant {cons_name=name;arguments=lst}) state' wrapped (* let%bind lst' = bind_list @@ List.map (type_expression e) lst in @@ -919,13 +854,13 @@ and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.e (* Advanced *) -and type_constant (name:I.constant) (lst:O.type_value list) (tv_opt:O.type_value option) : (O.constant * O.type_value) result = +and type_constant (name:I.constant') (lst:O.type_expression list) (tv_opt:O.type_expression option) : (O.constant' * O.type_expression) result = let%bind typer = Operators.Typer.constant_typers name in let%bind tv = typer lst tv_opt in ok(name, tv) -let untype_type_value (t:O.type_value) : (I.type_expression) result = - match t.simplified with +let untype_type_value (t:O.type_expression) : (I.type_expression) result = + match t.type_meta with | Some s -> ok s | _ -> fail @@ internal_assertion_failure "trying to untype generated type" (* let type_statement : environment -> I.declaration -> Solver.state -> (environment * O.declaration * Solver.state) result = fun env declaration state -> *) @@ -978,7 +913,7 @@ let type_and_subst_xyz (env_state_node : environment * Solver.state * 'a) (apply (Solver.TypeVariableMap.find_opt root assignments) in let Solver.{ tv ; c_tag ; tv_list } = assignment in let () = ignore tv (* I think there is an issue where the tv is stored twice (as a key and in the element itself) *) in - let%bind (expr : O.type_value') = Typesystem.Core.type_expression'_of_simple_c_constant (c_tag , (List.map (fun s -> O.{ type_value' = T_variable s ; simplified = None }) tv_list)) in + let%bind (expr : O.type_content) = Typesystem.Core.type_expression'_of_simple_c_constant (c_tag , (List.map (fun s -> O.{ type_content = T_variable s ; type_meta = None }) tv_list)) in ok @@ expr in let p = apply_substs ~substs program in @@ -992,14 +927,14 @@ let type_program (p : I.program) : (O.program * Solver.state) result = let empty_state = Solver.initial_state in type_and_subst_xyz (empty_env , empty_state , p) Typesystem.Misc.Substitution.Pattern.s_program type_program_returns_state -let type_expression_returns_state : (environment * Solver.state * I.expression) -> (environment * Solver.state * O.annotated_expression) Trace.result = +let type_expression_returns_state : (environment * Solver.state * I.expression) -> (environment * Solver.state * O.expression) Trace.result = fun (env, state, e) -> let%bind (e , state) = type_expression env state e in ok (env, state, e) -let type_expression_subst (env : environment) (state : Solver.state) ?(tv_opt : O.type_value option) (e : I.expression) : (O.annotated_expression * Solver.state) result = +let type_expression_subst (env : environment) (state : Solver.state) ?(tv_opt : O.type_expression option) (e : I.expression) : (O.expression * Solver.state) result = let () = ignore tv_opt in (* For compatibility with the old typer's API, this argument can be removed once the new typer is used. *) - type_and_subst_xyz (env , state , e) Typesystem.Misc.Substitution.Pattern.s_annotated_expression type_expression_returns_state + type_and_subst_xyz (env , state , e) Typesystem.Misc.Substitution.Pattern.s_expression type_expression_returns_state (* TODO: Similar to type_program but use a fold_map_list and List.fold_left and add element to the left or the list which gives a better complexity @@ -1025,22 +960,22 @@ let type_program' : I.program -> O.program result = fun p -> (* Tranform a Ast_typed type_expression into an ast_simplified type_expression *) -let rec untype_type_expression (t:O.type_value) : (I.type_expression) result = +let rec untype_type_expression (t:O.type_expression) : (I.type_expression) result = (* TODO: or should we use t.simplified if present? *) - let%bind t = match t.type_value' with + let%bind t = match t.type_content with | O.T_sum x -> - let%bind x' = I.bind_map_cmap untype_type_expression x in + let%bind x' = Stage_common.Helpers.bind_map_cmap untype_type_expression x in ok @@ I.T_sum x' | O.T_record x -> - let%bind x' = I.bind_map_lmap untype_type_expression x in + let%bind x' = Stage_common.Helpers.bind_map_lmap untype_type_expression x in ok @@ I.T_record x' | O.T_constant (tag) -> ok @@ I.T_constant (tag) - | O.T_variable (name) -> ok @@ I.T_variable name (* TODO: is this the right conversion? *) - | O.T_arrow (a , b) -> - let%bind a' = untype_type_expression a in - let%bind b' = untype_type_expression b in - ok @@ I.T_arrow (a' , b') + | O.T_variable (name) -> ok @@ I.T_variable (name) (* TODO: is this the right conversion? *) + | O.T_arrow {type1;type2} -> + let%bind type1 = untype_type_expression type1 in + let%bind type2 = untype_type_expression type2 in + ok @@ I.T_arrow {type1;type2} | O.T_operator (type_name) -> let%bind type_name = match type_name with | O.TC_option t -> @@ -1060,16 +995,13 @@ let rec untype_type_expression (t:O.type_value) : (I.type_expression) result = let%bind k = untype_type_expression k in let%bind v = untype_type_expression v in ok @@ I.TC_big_map (k,v) - | O.TC_contract c-> - let%bind c = untype_type_expression c in - ok @@ I.TC_contract c | O.TC_arrow ( arg , ret ) -> let%bind arg' = untype_type_expression arg in let%bind ret' = untype_type_expression ret in ok @@ I.TC_arrow ( arg' , ret' ) - | O.TC_tuple lst -> - let%bind lst' = bind_map_list untype_type_expression lst in - ok @@ I.TC_tuple lst' + | O.TC_contract c-> + let%bind c = untype_type_expression c in + ok @@ I.TC_contract c in ok @@ I.T_operator (type_name) in @@ -1087,6 +1019,7 @@ let untype_literal (l:O.literal) : I.literal result = let open I in match l with | Literal_unit -> ok Literal_unit + | Literal_void -> ok Literal_void | Literal_bool b -> ok (Literal_bool b) | Literal_nat n -> ok (Literal_nat n) | Literal_timestamp n -> ok (Literal_timestamp n) @@ -1104,51 +1037,46 @@ let untype_literal (l:O.literal) : I.literal result = (* Tranform a Ast_typed expression into an ast_simplified matching *) -let rec untype_expression (e:O.annotated_expression) : (I.expression) result = +let rec untype_expression (e:O.expression) : (I.expression) result = let open I in let return e = ok e in - match e.expression with + match e.expression_content with | E_literal l -> let%bind l = untype_literal l in return (e_literal l) - | E_constant (const, lst) -> - let%bind lst' = bind_map_list untype_expression lst in - return (e_constant const lst') + | E_constant {cons_name;arguments} -> + let%bind lst' = bind_map_list untype_expression arguments in + return (e_constant cons_name lst') | E_variable (n) -> - return (e_variable n) - | E_application (f, arg) -> - let%bind f' = untype_expression f in - let%bind arg' = untype_expression arg in - return (e_application f' arg') - | E_lambda {binder; body} -> ( - let%bind io = get_t_function e.type_annotation in + return (e_variable (n)) + | E_application {expr1;expr2} -> + let%bind f' = untype_expression expr1 in + let%bind arg' = untype_expression expr2 in + return (e_application f' arg') + | E_lambda {binder; result} -> ( + let%bind io = get_t_function e.type_expression in let%bind (input_type , output_type) = bind_map_pair untype_type_value io in - let%bind result = untype_expression body in - return (e_lambda binder (Some input_type) (Some output_type) result) + let%bind result = untype_expression result in + return (e_lambda (binder) (Some input_type) (Some output_type) result) ) - | E_tuple lst -> - let%bind lst' = bind_list - @@ List.map untype_expression lst in - return (e_tuple lst') - | E_tuple_accessor (tpl, ind) -> - let%bind tpl' = untype_expression tpl in - return (e_accessor tpl' [Access_tuple ind]) - | E_constructor (Constructor c, p) -> - let%bind p' = untype_expression p in - return (e_constructor c p') + | E_constructor {constructor; element} -> + let%bind p' = untype_expression element in + let Constructor n = constructor in + return (e_constructor n p') | E_record r -> let aux ( Label k ,v) = (k, v) in let r = Map.String.of_list @@ List.map aux (LMap.to_kv_list r) in let%bind r' = bind_smap @@ Map.String.map untype_expression r in return (e_record r') - | E_record_accessor (r, Label s) -> - let%bind r' = untype_expression r in - return (e_accessor r' [Access_record s]) - | E_record_update (r, (l,e)) -> - let%bind r' = untype_expression r in - let%bind e = untype_expression e in - let Label l = l in + | E_record_accessor {expr; label} -> + let%bind r' = untype_expression expr in + let Label s = label in + return (e_accessor r' s) + | E_record_update {record; path; update} -> + let%bind r' = untype_expression record in + let%bind e = untype_expression update in + let Label l = path in return (e_update r' l e) | E_map m -> let%bind m' = bind_map_list (bind_map_pair untype_expression) m in @@ -1165,26 +1093,24 @@ let rec untype_expression (e:O.annotated_expression) : (I.expression) result = | E_look_up dsi -> let%bind (a , b) = bind_map_pair untype_expression dsi in return (e_look_up a b) - | E_matching (ae, m) -> - let%bind ae' = untype_expression ae in - let%bind m' = untype_matching untype_expression m in + | E_matching {matchee;cases} -> + let%bind ae' = untype_expression matchee in + let%bind m' = untype_matching untype_expression cases in return (e_matching ae' m') (* | E_failwith ae -> * let%bind ae' = untype_expression ae in * return (e_failwith ae') *) - | E_sequence _ - | E_loop _ - | E_assign _ -> fail @@ not_supported_yet_untranspile "not possible to untranspile statements yet" e.expression - | E_let_in {binder; rhs; result; inline} -> - let%bind tv = untype_type_value rhs.type_annotation in + | E_loop _ -> fail @@ not_supported_yet_untranspile "not possible to untranspile statements yet" e + | E_let_in {let_binder; rhs;let_result; inline} -> + let%bind tv = untype_type_value rhs.type_expression in let%bind rhs = untype_expression rhs in - let%bind result = untype_expression result in - return (e_let_in (binder , (Some tv)) inline rhs result) + let%bind result = untype_expression let_result in + return (e_let_in (let_binder , (Some tv)) false inline rhs result) (* Tranform a Ast_typed matching into an ast_simplified matching *) -and untype_matching : type o i . (o -> i result) -> (o,O.type_value) O.matching -> ((i,unit) I.matching) result = fun f m -> +and untype_matching : (O.expression -> I.expression result) -> O.matching_expr -> I.matching_expr result = fun f m -> let open I in match m with | Match_bool {match_true ; match_false} -> diff --git a/src/passes/4-typer-new/typer.mli b/src/passes/4-typer-new/typer.mli index 379b31b1e..29b7cad08 100644 --- a/src/passes/4-typer-new/typer.mli +++ b/src/passes/4-typer-new/typer.mli @@ -42,16 +42,16 @@ val type_program : I.program -> (O.program * Solver.state) result val type_program' : I.program -> (O.program) result (* TODO: merge with type_program *) val type_declaration : environment -> Solver.state -> I.declaration -> (environment * Solver.state * O.declaration option) result (* val type_match : (environment -> 'i -> 'o result) -> environment -> O.type_value -> 'i I.matching -> I.expression -> Location.t -> 'o O.matching result *) -val evaluate_type : environment -> I.type_expression -> O.type_value result -val type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.expression -> (O.annotated_expression * Solver.state) result -val type_expression_subst : environment -> Solver.state -> ?tv_opt:O.type_value -> I.expression -> (O.annotated_expression * Solver.state) result -val type_constant : I.constant -> O.type_value list -> O.type_value option -> (O.constant * O.type_value) result +val evaluate_type : environment -> I.type_expression -> O.type_expression result +val type_expression : environment -> Solver.state -> ?tv_opt:O.type_expression -> I.expression -> (O.expression * Solver.state) result +val type_expression_subst : environment -> Solver.state -> ?tv_opt:O.type_expression -> I.expression -> (O.expression * Solver.state) result +val type_constant : I.constant' -> O.type_expression list -> O.type_expression option -> (O.constant' * O.type_expression) result (* val untype_type_value : O.type_value -> (I.type_expression) result val untype_literal : O.literal -> I.literal result *) -val untype_type_expression : O.type_value -> I.type_expression result -val untype_expression : O.annotated_expression -> I.expression result +val untype_type_expression : O.type_expression -> I.type_expression result +val untype_expression : O.expression -> I.expression result (* val untype_matching : ('o -> 'i result) -> 'o O.matching -> ('i I.matching) result *) diff --git a/src/passes/4-typer-old/typer.ml b/src/passes/4-typer-old/typer.ml index 8c43ade15..87f4b2477 100644 --- a/src/passes/4-typer-old/typer.ml +++ b/src/passes/4-typer-old/typer.ml @@ -21,7 +21,7 @@ module Errors = struct let title = (thunk "unbound type variable") in let message () = "" in let data = [ - ("variable" , fun () -> Format.asprintf "%a" Stage_common.PP.type_variable tv) ; + ("variable" , fun () -> Format.asprintf "%a" I.PP.type_variable tv) ; (* TODO: types don't have srclocs for now. *) (* ("location" , fun () -> Format.asprintf "%a" Location.pp (n.location)) ; *) ("in" , fun () -> Format.asprintf "%a" Environment.PP.full_environment e) ; @@ -30,7 +30,7 @@ module Errors = struct error ~data title message () let unbound_variable (e:environment) (n:I.expression_variable) (loc:Location.t) () = - let name () = Format.asprintf "%a" Stage_common.PP.name n in + let name () = Format.asprintf "%a" I.PP.expression_variable n in let title = (thunk ("unbound variable "^(name ()))) in let message () = "" in let data = [ @@ -40,17 +40,17 @@ module Errors = struct ] in error ~data title message () - let match_empty_variant : type a . (a, unit) I.matching -> Location.t -> unit -> _ = + let match_empty_variant : I.matching_expr -> Location.t -> unit -> _ = fun matching loc () -> - let title = (thunk "match with no cases") in - let message () = "" in - let data = [ - ("variant" , fun () -> Format.asprintf "%a" I.PP.matching_type matching) ; - ("location" , fun () -> Format.asprintf "%a" Location.pp loc) - ] in - error ~data title message () + let title = (thunk "match with no cases") in + let message () = "" in + let data = [ + ("variant" , fun () -> Format.asprintf "%a" I.PP.matching_type matching) ; + ("location" , fun () -> Format.asprintf "%a" Location.pp loc) + ] in + error ~data title message () - let match_missing_case : type a . (a, unit) I.matching -> Location.t -> unit -> _ = + let match_missing_case : I.matching_expr -> Location.t -> unit -> _ = fun matching loc () -> let title = (thunk "missing case in match") in let message () = "" in @@ -60,7 +60,7 @@ module Errors = struct ] in error ~data title message () - let match_redundant_case : type a . (a, unit) I.matching -> Location.t -> unit -> _ = + let match_redundant_case : I.matching_expr -> Location.t -> unit -> _ = fun matching loc () -> let title = (thunk "redundant case in match") in let message () = "" in @@ -70,11 +70,11 @@ module Errors = struct ] in error ~data title message () - let unbound_constructor (e:environment) (c:I.constructor) (loc:Location.t) () = + let unbound_constructor (e:environment) (c:I.constructor') (loc:Location.t) () = let title = (thunk "unbound constructor") in let message () = "" in let data = [ - ("constructor" , fun () -> Format.asprintf "%a" Stage_common.PP.constructor c); + ("constructor" , fun () -> Format.asprintf "%a" I.PP.constructor c); ("environment" , fun () -> Format.asprintf "%a" Environment.PP.full_environment e) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in @@ -91,6 +91,7 @@ module Errors = struct ] in error ~data title message () + let match_tuple_wrong_arity (expected:'a list) (actual:'b list) (loc:Location.t) () = let title () = "matching tuple of different size" in let message () = "" in @@ -110,27 +111,27 @@ module Errors = struct ] in error ~data title message () - let constant_declaration_error (name:I.expression_variable) (ae:I.expr) (expected: O.type_value option) () = + let constant_declaration_error (name:I.expression_variable) (ae:I.expr) (expected: O.type_expression option) () = let title = (thunk "typing constant declaration") in let message () = "" in let data = [ - ("constant" , fun () -> Format.asprintf "%a" Stage_common.PP.name name) ; + ("constant" , fun () -> Format.asprintf "%a" I.PP.expression_variable name) ; ("expression" , fun () -> Format.asprintf "%a" I.PP.expression ae) ; ("expected" , fun () -> match expected with None -> "(no annotation for the expected type)" - | Some expected -> Format.asprintf "%a" O.PP.type_value expected) ; + | Some expected -> Format.asprintf "%a" O.PP.type_expression expected) ; ("location" , fun () -> Format.asprintf "%a" Location.pp ae.location) ] in error ~data title message () - let match_error : type a . ?msg:string -> expected: (a, unit) I.matching -> actual: O.type_value -> Location.t -> unit -> _ = + let match_error : ?msg:string -> expected: I.matching_expr -> actual: O.type_expression -> Location.t -> unit -> _ = fun ?(msg = "") ~expected ~actual loc () -> let title = (thunk "typing match") in let message () = msg in let data = [ ("expected" , fun () -> Format.asprintf "%a" I.PP.matching_type expected); - ("actual" , fun () -> Format.asprintf "%a" O.PP.type_value actual) ; + ("actual" , fun () -> Format.asprintf "%a" O.PP.type_expression actual) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in error ~data title message () @@ -144,46 +145,35 @@ module Errors = struct ] in error ~data title message () - let type_error_approximate ?(msg="") ~(expected: string) ~(actual: O.type_value) ~(expression : I.expression) (loc:Location.t) () = + let type_error_approximate ?(msg="") ~(expected: string) ~(actual: O.type_expression) ~(expression : I.expression) (loc:Location.t) () = let title = (thunk "type error") in let message () = msg in let data = [ ("expected" , fun () -> Format.asprintf "%s" expected); - ("actual" , fun () -> Format.asprintf "%a" O.PP.type_value actual); + ("actual" , fun () -> Format.asprintf "%a" O.PP.type_expression actual); ("expression" , fun () -> Format.asprintf "%a" I.PP.expression expression) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in error ~data title message () - let type_error ?(msg="") ~(expected: O.type_value) ~(actual: O.type_value) ~(expression : I.expression) (loc:Location.t) () = + let type_error ?(msg="") ~(expected: O.type_expression) ~(actual: O.type_expression) ~(expression : I.expression) (loc:Location.t) () = let title = (thunk "type error") in let message () = msg in let data = [ - ("expected" , fun () -> Format.asprintf "%a" O.PP.type_value expected); - ("actual" , fun () -> Format.asprintf "%a" O.PP.type_value actual); + ("expected" , fun () -> Format.asprintf "%a" O.PP.type_expression expected); + ("actual" , fun () -> Format.asprintf "%a" O.PP.type_expression actual); ("expression" , fun () -> Format.asprintf "%a" I.PP.expression expression) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in error ~data title message () - let bad_tuple_index (index : int) (ae : I.expression) (t : O.type_value) (loc:Location.t) () = - let title = (thunk "invalid tuple index") in - let message () = "" in - let data = [ - ("index" , fun () -> Format.asprintf "%d" index) ; - ("tuple_value" , fun () -> Format.asprintf "%a" I.PP.expression ae) ; - ("tuple_type" , fun () -> Format.asprintf "%a" O.PP.type_value t) ; - ("location" , fun () -> Format.asprintf "%a" Location.pp loc) - ] in - error ~data title message () - - let bad_record_access (field : I.label) (ae : I.expression) (t : O.type_value) (loc:Location.t) () = + let bad_record_access (field : I.label) (ae : I.expression) (t : O.type_expression) (loc:Location.t) () = let title = (thunk "invalid record field") in let message () = "" in let data = [ - ("field" , fun () -> Format.asprintf "%a" Stage_common.PP.label field) ; + ("field" , fun () -> Format.asprintf "%a" I.PP.label field) ; ("record_value" , fun () -> Format.asprintf "%a" I.PP.expression ae) ; - ("tuple_type" , fun () -> Format.asprintf "%a" O.PP.type_value t) ; + ("tuple_type" , fun () -> Format.asprintf "%a" O.PP.type_expression t) ; ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in error ~data title message () @@ -216,7 +206,7 @@ let rec type_program (p:I.program) : (O.program * Solver.state) result = and type_declaration env (_placeholder_for_state_of_new_typer : Solver.state) : I.declaration -> (environment * Solver.state * O.declaration option) result = function | Declaration_type (type_name , type_expression) -> let%bind tv = evaluate_type env type_expression in - let env' = Environment.add_type type_name tv env in + let env' = Environment.add_type (type_name) tv env in ok (env', (Solver.placeholder_for_state_of_new_typer ()) , None) | Declaration_constant (name , tv_opt , inline, expression) -> ( let%bind tv'_opt = bind_map_option (evaluate_type env) tv_opt in @@ -224,10 +214,10 @@ and type_declaration env (_placeholder_for_state_of_new_typer : Solver.state) : trace (constant_declaration_error name expression tv'_opt) @@ type_expression' ?tv_opt:tv'_opt env expression in let env' = Environment.add_ez_ae name ae' env in - ok (env', (Solver.placeholder_for_state_of_new_typer ()) , Some (O.Declaration_constant ((make_n_e name ae') , inline, (env , env')))) + ok (env', (Solver.placeholder_for_state_of_new_typer ()) , Some (O.Declaration_constant (name,ae', inline, env'))) ) -and type_match : type i o . (environment -> i -> o result) -> environment -> O.type_value -> (i, unit) I.matching -> I.expression -> Location.t -> (o, O.type_value) O.matching result = +and type_match : (environment -> I.expression -> O.expression result) -> environment -> O.type_expression -> I.matching_expr -> I.expression -> Location.t -> O.matching_expr result = fun f e t i ae loc -> match i with | Match_bool {match_true ; match_false} -> let%bind _ = @@ -282,7 +272,7 @@ and type_match : type i o . (environment -> i -> o result) -> environment -> O.t ~expression:ae loc ) @@ - Ast_typed.assert_type_value_eq (variant , variant') >>? fun () -> + Ast_typed.assert_type_expression_eq (variant , variant') >>? fun () -> ok (Some variant) ) in ok acc in @@ -320,13 +310,13 @@ and type_match : type i o . (environment -> i -> o result) -> environment -> O.t bind_map_list aux lst in ok (O.Match_variant (lst' , variant)) -and evaluate_type (e:environment) (t:I.type_expression) : O.type_value result = +and evaluate_type (e:environment) (t:I.type_expression) : O.type_expression result = let return tv' = ok (make_t tv' (Some t)) in - match t.type_expression' with - | T_arrow (a, b) -> - let%bind a' = evaluate_type e a in - let%bind b' = evaluate_type e b in - return (T_arrow (a', b')) + match t.type_content with + | T_arrow {type1;type2} -> + let%bind type1 = evaluate_type e type1 in + let%bind type2 = evaluate_type e type2 in + return (T_arrow {type1;type2}) | T_sum m -> let aux k v prev = let%bind prev' = prev in @@ -346,7 +336,7 @@ and evaluate_type (e:environment) (t:I.type_expression) : O.type_value result = | T_variable name -> let%bind tv = trace_option (unbound_type_variable e name) - @@ Environment.get_type_opt name e in + @@ Environment.get_type_opt (name) e in ok tv | T_constant cst -> return (T_constant cst) @@ -369,30 +359,27 @@ and evaluate_type (e:environment) (t:I.type_expression) : O.type_value result = let%bind k = evaluate_type e k in let%bind v = evaluate_type e v in ok @@ O.TC_big_map (k,v) - | TC_contract c -> - let%bind c = evaluate_type e c in - ok @@ I.TC_contract c | TC_arrow ( arg , ret ) -> let%bind arg' = evaluate_type e arg in let%bind ret' = evaluate_type e ret in - ok @@ I.TC_arrow ( arg' , ret' ) - | TC_tuple lst -> - let%bind lst' = bind_map_list (evaluate_type e) lst in - ok @@ I.TC_tuple lst' + ok @@ O.TC_arrow ( arg' , ret' ) + | TC_contract c -> + let%bind c = evaluate_type e c in + ok @@ O.TC_contract c in return (T_operator (opt)) -and type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.expression -> (O.annotated_expression * Solver.state) result +and type_expression : environment -> Solver.state -> ?tv_opt:O.type_expression -> I.expression -> (O.expression * Solver.state) result = fun e _placeholder_for_state_of_new_typer ?tv_opt ae -> let%bind res = type_expression' e ?tv_opt ae in ok (res, (Solver.placeholder_for_state_of_new_typer ())) -and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O.annotated_expression result = fun e ?tv_opt ae -> +and type_expression' : environment -> ?tv_opt:O.type_expression -> I.expression -> O.expression result = fun e ?tv_opt ae -> let module L = Logger.Stateful() in let return expr tv = let%bind () = match tv_opt with | None -> ok () - | Some tv' -> O.assert_type_value_eq (tv' , tv) in + | Some tv' -> O.assert_type_expression_eq (tv' , tv) in let location = ae.location in ok @@ make_a_e ~location expr tv e in let main_error = @@ -405,7 +392,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. ] in error ~data title content in trace main_error @@ - match ae.expression with + match ae.expression_content with (* Basic *) | E_variable name -> let%bind tv' = @@ -416,6 +403,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. return (E_literal (Literal_bool b)) (t_bool ()) | E_literal Literal_unit | E_skip -> return (E_literal (Literal_unit)) (t_unit ()) + | E_literal Literal_void -> return (E_literal (Literal_void)) (t_unit ()) (* TODO : IS this really a t_unit ?*) | E_literal (Literal_string s) -> return (E_literal (Literal_string s)) (t_string ()) | E_literal (Literal_key s) -> @@ -440,82 +428,66 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. return (e_address s) (t_address ()) | E_literal (Literal_operation op) -> return (e_operation op) (t_operation ()) - (* Tuple *) - | E_tuple lst -> - let%bind lst' = bind_list @@ List.map (type_expression' e) lst in - let tv_lst = List.map get_type_annotation lst' in - return (E_tuple lst') (t_tuple tv_lst ()) - | E_accessor (ae', path) -> - let%bind e' = type_expression' e ae' in - let aux (prev:O.annotated_expression) (a:I.access) : O.annotated_expression result = - match a with - | Access_tuple index -> ( - let%bind tpl_tv = get_t_tuple prev.type_annotation in + | E_record_accessor {expr;label} -> + let%bind e' = type_expression' e expr in + let aux (prev:O.expression) (a:I.label) : O.expression result = + let property = a in + let%bind r_tv = get_t_record prev.type_expression in let%bind tv = - generic_try (bad_tuple_index index ae' prev.type_annotation ae.location) - @@ (fun () -> List.nth tpl_tv index) in - let location = ae.location in - ok @@ make_a_e ~location (E_tuple_accessor(prev , index)) tv e - ) - | Access_record property -> ( - let property = I.Label property in - let%bind r_tv = get_t_record prev.type_annotation in - let%bind tv = - generic_try (bad_record_access property ae' prev.type_annotation ae.location) + generic_try (bad_record_access property ae prev.type_expression ae.location) @@ (fun () -> I.LMap.find property r_tv) in let location = ae.location in - ok @@ make_a_e ~location (E_record_accessor (prev , property)) tv e - ) + ok @@ make_a_e ~location (E_record_accessor {expr=prev; label=property}) tv e in let%bind ae = - trace (simple_info "accessing") @@ - bind_fold_list aux e' path in + trace (simple_info "accessing") @@ aux e' label in (* check type annotation of the final accessed element *) let%bind () = match tv_opt with | None -> ok () - | Some tv' -> O.assert_type_value_eq (tv' , ae.type_annotation) in + | Some tv' -> O.assert_type_expression_eq (tv' , ae.type_expression) in ok(ae) (* Sum *) - | E_constructor (c, expr) -> + | E_constructor {constructor; element} -> let%bind (c_tv, sum_tv) = let error = let title () = "no such constructor" in let content () = Format.asprintf "%a in:\n%a\n" - Stage_common.PP.constructor c + Stage_common.PP.constructor constructor O.Environment.PP.full_environment e in error title content in trace_option error @@ - Environment.get_constructor c e in - let%bind expr' = type_expression' e expr in - let%bind _assert = O.assert_type_value_eq (expr'.type_annotation, c_tv) in - return (E_constructor (c , expr')) sum_tv + Environment.get_constructor constructor e in + let%bind expr' = type_expression' e element in + let%bind _assert = O.assert_type_expression_eq (expr'.type_expression, c_tv) in + return (E_constructor {constructor; element=expr'}) sum_tv (* Record *) | E_record m -> let aux prev k expr = let%bind expr' = type_expression' e expr in ok (I.LMap.add k expr' prev) in - let%bind m' = I.bind_fold_lmap aux (ok I.LMap.empty) m in - return (E_record m') (t_record (I.LMap.map get_type_annotation m') ()) - | E_update {record; update =(l,expr)} -> + let%bind m' = Stage_common.Helpers.bind_fold_lmap aux (ok I.LMap.empty) m in + return (E_record m') (t_record (I.LMap.map get_type_expression m') ()) + | E_record_update {record; path; update} -> + let%bind record = type_expression' e record in - let%bind expr' = type_expression' e expr in - let wrapped = get_type_annotation record in + let%bind update = type_expression' e update in + let wrapped = get_type_expression record in let%bind tv = - match wrapped.type_value' with + match wrapped.type_content with | T_record record -> ( - let field_op = I.LMap.find_opt l record in + let field_op = I.LMap.find_opt path record in match field_op with | Some tv -> ok (tv) - | None -> failwith @@ Format.asprintf "field %a is not part of record %a" Stage_common.PP.label l O.PP.type_value wrapped + | None -> failwith @@ Format.asprintf "field %a is not part of record %a" Stage_common.PP.label path O.PP.type_expression wrapped ) | _ -> failwith "Update an expression which is not a record" in - let%bind () = O.assert_type_value_eq (tv, get_type_annotation expr') in - return (E_record_update (record, (l,expr'))) wrapped + let%bind () = O.assert_type_expression_eq (tv, get_type_expression update) in + return (E_record_update {record; path; update}) wrapped (* Data-structure *) | E_list lst -> let%bind lst' = bind_map_list (type_expression' e) lst in @@ -524,7 +496,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. match opt with | None -> ok (Some c) | Some c' -> - let%bind _eq = Ast_typed.assert_type_value_eq (c, c') in + let%bind _eq = Ast_typed.assert_type_expression_eq (c, c') in ok (Some c') in let%bind init = match tv_opt with | None -> ok None @@ -533,7 +505,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. ok (Some ty') in let%bind ty = let%bind opt = bind_fold_list aux init - @@ List.map get_type_annotation lst' in + @@ List.map get_type_expression lst' in trace_option (needs_annotation ae "empty list") opt in ok (t_list ty ()) in @@ -545,7 +517,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. match opt with | None -> ok (Some c) | Some c' -> - let%bind _eq = Ast_typed.assert_type_value_eq (c, c') in + let%bind _eq = Ast_typed.assert_type_expression_eq (c, c') in ok (Some c') in let%bind init = match tv_opt with | None -> ok None @@ -554,7 +526,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. ok (Some ty') in let%bind ty = let%bind opt = bind_fold_list aux init - @@ List.map get_type_annotation lst' in + @@ List.map get_type_expression lst' in trace_option (needs_annotation ae "empty set") opt in ok (t_set ty ()) in @@ -566,12 +538,12 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. match opt with | None -> ok (Some c) | Some c' -> - let%bind _eq = Ast_typed.assert_type_value_eq (c, c') in + let%bind _eq = Ast_typed.assert_type_expression_eq (c, c') in ok (Some c') in let%bind key_type = let%bind sub = bind_fold_list aux None - @@ List.map get_type_annotation + @@ List.map get_type_expression @@ List.map fst lst' in let%bind annot = bind_map_option get_t_map_key tv_opt in trace (simple_info "empty map expression without a type annotation") @@ @@ -580,7 +552,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. let%bind value_type = let%bind sub = bind_fold_list aux None - @@ List.map get_type_annotation + @@ List.map get_type_expression @@ List.map snd lst' in let%bind annot = bind_map_option get_t_map_value tv_opt in trace (simple_info "empty map expression without a type annotation") @@ @@ -596,12 +568,12 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. match opt with | None -> ok (Some c) | Some c' -> - let%bind _eq = Ast_typed.assert_type_value_eq (c, c') in + let%bind _eq = Ast_typed.assert_type_expression_eq (c, c') in ok (Some c') in let%bind key_type = let%bind sub = bind_fold_list aux None - @@ List.map get_type_annotation + @@ List.map get_type_expression @@ List.map fst lst' in let%bind annot = bind_map_option get_t_big_map_key tv_opt in trace (simple_info "empty map expression without a type annotation") @@ @@ -610,7 +582,7 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. let%bind value_type = let%bind sub = bind_fold_list aux None - @@ List.map get_type_annotation + @@ List.map get_type_expression @@ List.map snd lst' in let%bind annot = bind_map_option get_t_big_map_value tv_opt in trace (simple_info "empty map expression without a type annotation") @@ @@ -632,11 +604,11 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. match input_type with | Some ty -> ok ty | None -> ( - match result.expression with + match result.expression_content with | I.E_let_in li -> ( - match li.rhs.expression with + match li.rhs.expression_content with | I.E_variable name when name = (fst binder) -> ( - match snd li.binder with + match snd li.let_binder with | Some ty -> ok ty | None -> default_action li.rhs () ) @@ -649,119 +621,133 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. let%bind output_type = bind_map_option (evaluate_type e) output_type in - let e' = Environment.add_ez_binder (fst binder) input_type e in + let binder = fst binder in + let e' = Environment.add_ez_binder binder input_type e in let%bind body = type_expression' ?tv_opt:output_type e' result in - let output_type = body.type_annotation in - return (E_lambda {binder = fst binder ; body}) (t_function input_type output_type ()) + let output_type = body.type_expression in + return (E_lambda {binder; result=body}) (t_function input_type output_type ()) ) - | E_constant ( ( C_LIST_FOLD | C_MAP_FOLD | C_SET_FOLD) as opname , - [ - ( { expression = (I.E_lambda { binder = (lname, None) ; + | E_constant {cons_name=( C_LIST_FOLD | C_MAP_FOLD | C_SET_FOLD) as opname ; + arguments=[ + ( { expression_content = (I.E_lambda { binder = (lname, None) ; input_type = None ; output_type = None ; result }) ; location = _ }) as _lambda ; collect ; init_record ; - ] ) -> + ]} -> (* this special case is here force annotation of the untyped lambda generated by pascaligo's for_collect loop *) let%bind (v_col , v_initr ) = bind_map_pair (type_expression' e) (collect , init_record ) in - let tv_col = get_type_annotation v_col in (* this is the type of the collection *) - let tv_out = get_type_annotation v_initr in (* this is the output type of the lambda*) - let%bind input_type = match tv_col.type_value' with - | O.T_operator ( TC_list t | TC_set t) -> ok @@ t_tuple (tv_out::[t]) () - | O.T_operator ( TC_map (k,v)| TC_big_map (k,v)) -> ok @@ t_tuple (tv_out::[(t_tuple [k;v] ())]) () + let tv_col = get_type_expression v_col in (* this is the type of the collection *) + let tv_out = get_type_expression v_initr in (* this is the output type of the lambda*) + let%bind input_type = match tv_col.type_content with + | O.T_operator ( TC_list t | TC_set t) -> ok @@ make_t_ez_record (("0",tv_out)::[("1",t)]) + | O.T_operator ( TC_map (k,v)| TC_big_map (k,v)) -> ok @@ make_t_ez_record (("0",tv_out)::[("1",make_t_ez_record [("0",k);("1",v)])]) | _ -> let wtype = Format.asprintf - "Loops over collections expect lists, sets or maps, got type %a" O.PP.type_value tv_col in + "Loops over collections expect lists, sets or maps, got type %a" O.PP.type_expression tv_col in fail @@ simple_error wtype in + let lname = lname in let e' = Environment.add_ez_binder lname input_type e in let%bind body = type_expression' ?tv_opt:(Some tv_out) e' result in - let output_type = body.type_annotation in - let lambda' = make_a_e (E_lambda {binder = lname ; body}) (t_function input_type output_type ()) e in + let output_type = body.type_expression in + let lambda' = make_a_e (E_lambda {binder = lname ; result=body}) (t_function input_type output_type ()) e' in let lst' = [lambda'; v_col; v_initr] in - let tv_lst = List.map get_type_annotation lst' in + let tv_lst = List.map get_type_expression lst' in let%bind (opname', tv) = type_constant opname tv_lst tv_opt in - return (E_constant (opname' , lst')) tv - | E_constant (name, lst) -> - let%bind lst' = bind_list @@ List.map (type_expression' e) lst in - let tv_lst = List.map get_type_annotation lst' in + return (E_constant {cons_name=opname';arguments=lst'}) tv + | E_constant {cons_name=C_FOLD_WHILE as opname; + arguments = [ + ( { expression_content = (I.E_lambda { binder = (lname, None) ; + input_type = None ; + output_type = None ; + result }) ; + location = _ }) as _lambda ; + init_record ; + ]} -> + Format.printf "typing foldwhile \n %!"; + let%bind v_initr = type_expression' e init_record in + let tv_out = get_type_expression v_initr in + let input_type = tv_out in + let e' = Environment.add_ez_binder lname input_type e in + Format.printf "typing foldwhile %a\n %a\n %!" Ast_typed.PP.type_expression tv_out I.PP.expression result; + let%bind body = type_expression' e' result in + Format.printf "typing foldwhile %a\n %!" O.PP.expression body; + let output_type = body.type_expression in + let lambda' = make_a_e (E_lambda {binder = lname ; result=body}) (t_function input_type output_type ()) e' in + let lst' = [lambda';v_initr] in + let tv_lst = List.map get_type_expression lst' in + Format.printf "Typing constant : %a \n%!" (Ast_typed.PP.list_sep_d Ast_typed.PP.type_expression) tv_lst; + let%bind (opname',tv) = type_constant opname tv_lst tv_opt in + Format.printf "Typed constant : %a \n%!" O.PP.type_expression tv; + return (E_constant {cons_name=opname';arguments=lst'}) tv + | E_constant {cons_name;arguments} -> + let%bind lst' = bind_list @@ List.map (type_expression' e) arguments in + let tv_lst = List.map get_type_expression lst' in let%bind (name', tv) = - type_constant name tv_lst tv_opt in - return (E_constant (name' , lst')) tv - | E_application (f, arg) -> - let%bind f' = type_expression' e f in - let%bind arg = type_expression' e arg in - let%bind tv = match f'.type_annotation.type_value' with - | T_arrow (param, result) -> - let%bind _ = O.assert_type_value_eq (param, arg.type_annotation) in - ok result + type_constant cons_name tv_lst tv_opt in + return (E_constant {cons_name=name';arguments=lst'}) tv + | E_application {expr1;expr2} -> + let%bind expr1' = type_expression' e expr1 in + let%bind expr2 = type_expression' e expr2 in + let%bind tv = match expr1'.type_expression.type_content with + | T_arrow {type1;type2} -> + let%bind _ = O.assert_type_expression_eq (type1, expr2.type_expression) in + ok type2 | _ -> fail @@ type_error_approximate ~expected:"should be a function type" - ~expression:f - ~actual:f'.type_annotation - f'.location + ~expression:expr1 + ~actual:expr1'.type_expression + expr1'.location in - return (E_application (f' , arg)) tv + return (E_application {expr1=expr1';expr2}) tv | E_look_up dsi -> let%bind (ds, ind) = bind_map_pair (type_expression' e) dsi in - let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) ds.type_annotation in - let%bind _ = O.assert_type_value_eq (ind.type_annotation, src) in + let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) ds.type_expression in + let%bind _ = O.assert_type_expression_eq (ind.type_expression, src) in return (E_look_up (ds , ind)) (t_option dst ()) (* Advanced *) - | E_matching (ex, m) -> ( - let%bind ex' = type_expression' e ex in - let%bind m' = type_match (type_expression' ?tv_opt:None) e ex'.type_annotation m ae ae.location in + | E_matching {matchee;cases} -> ( + let%bind ex' = type_expression' e matchee in + let%bind m' = type_match (type_expression' ?tv_opt:None) e ex'.type_expression cases ae ae.location in let tvs = - let aux (cur:(O.value, O.type_value) O.matching) = + let aux (cur:O.matching_expr) = match cur with | Match_bool { match_true ; match_false } -> [ match_true ; match_false ] | Match_list { match_nil ; match_cons = (_ , _ , match_cons, _) } -> [ match_nil ; match_cons ] | Match_option { match_none ; match_some = (_ , match_some, _) } -> [ match_none ; match_some ] | Match_tuple ((_ , match_tuple), _) -> [ match_tuple ] | Match_variant (lst , _) -> List.map snd lst in - List.map get_type_annotation @@ aux m' in + List.map get_type_expression @@ aux m' in let aux prec cur = let%bind () = match prec with | None -> ok () - | Some cur' -> Ast_typed.assert_type_value_eq (cur , cur') in + | Some cur' -> Ast_typed.assert_type_expression_eq (cur , cur') in ok (Some cur) in let%bind tv_opt = bind_fold_list aux None tvs in let%bind tv = - trace_option (match_empty_variant m ae.location) @@ + trace_option (match_empty_variant cases ae.location) @@ tv_opt in - return (O.E_matching (ex', m')) tv + return (O.E_matching {matchee=ex'; cases=m'}) tv ) - | E_sequence (a , b) -> - let%bind a' = type_expression' e a in - let%bind b' = type_expression' e b in - let a'_type_annot = get_type_annotation a' in - let%bind () = - trace_strong (type_error - ~msg:"first part of the sequence should be of unit type" - ~expected:(O.t_unit ()) - ~actual:a'_type_annot - ~expression:a - a'.location) @@ - Ast_typed.assert_type_value_eq (t_unit () , a'_type_annot) in - return (O.E_sequence (a' , b')) (get_type_annotation b') - | E_loop (expr , body) -> - let%bind expr' = type_expression' e expr in + | E_loop {condition; body} -> + let%bind expr' = type_expression' e condition in let%bind body' = type_expression' e body in - let t_expr' = get_type_annotation expr' in + let t_expr' = get_type_expression expr' in let%bind () = trace_strong (type_error ~msg:"while condition isn't of type bool" ~expected:(O.t_bool ()) ~actual:t_expr' - ~expression:expr + ~expression:condition expr'.location) @@ - Ast_typed.assert_type_value_eq (t_bool () , t_expr') in - let t_body' = get_type_annotation body' in + Ast_typed.assert_type_expression_eq (t_bool () , t_expr') in + let t_body' = get_type_expression body' in let%bind () = trace_strong (type_error ~msg:"while body isn't of unit type" @@ -769,71 +755,38 @@ and type_expression' : environment -> ?tv_opt:O.type_value -> I.expression -> O. ~actual:t_body' ~expression:body body'.location) @@ - Ast_typed.assert_type_value_eq (t_unit () , t_body') in - return (O.E_loop (expr' , body')) (t_unit ()) - | E_assign (name , path , expr) -> - let%bind typed_name = - let%bind ele = Environment.get_trace name e in - ok @@ make_n_t name ele.type_value in - let%bind (assign_tv , path') = - let aux : ((_ * O.access_path) as 'a) -> I.access -> 'a result = fun (prec_tv , prec_path) cur_path -> - match cur_path with - | Access_tuple index -> ( - let%bind tpl = get_t_tuple prec_tv in - let%bind tv' = - trace_option (bad_tuple_index index ae prec_tv ae.location) @@ - List.nth_opt tpl index in - ok (tv' , prec_path @ [O.Access_tuple index]) - ) - | Access_record property -> ( - let%bind m = get_t_record prec_tv in - let%bind tv' = - trace_option (bad_record_access (Label property) ae prec_tv ae.location) @@ - I.LMap.find_opt (Label property) m in - ok (tv' , prec_path @ [O.Access_record property]) - ) - in - bind_fold_list aux (typed_name.type_value , []) path in - let%bind expr' = type_expression' e ~tv_opt:assign_tv expr in - let t_expr' = get_type_annotation expr' in - let%bind () = - trace_strong (type_error - ~msg:"type of the expression to assign doesn't match left-hand-side" - ~expected:assign_tv - ~actual:t_expr' - ~expression:expr - expr'.location) @@ - Ast_typed.assert_type_value_eq (assign_tv , t_expr') in - return (O.E_assign (typed_name , path' , expr')) (t_unit ()) - | E_let_in {binder ; rhs ; result; inline} -> - let%bind rhs_tv_opt = bind_map_option (evaluate_type e) (snd binder) in + Ast_typed.assert_type_expression_eq (t_unit () , t_body') in + return (O.E_loop {condition=expr'; body=body'}) (t_unit ()) + | E_let_in {let_binder ; rhs ; let_result; inline} -> + let%bind rhs_tv_opt = bind_map_option (evaluate_type e) (snd let_binder) in let%bind rhs = type_expression' ?tv_opt:rhs_tv_opt e rhs in - let e' = Environment.add_ez_declaration (fst binder) rhs e in - let%bind result = type_expression' e' result in - return (E_let_in {binder = fst binder; rhs; result; inline}) result.type_annotation - | E_ascription (expr , te) -> - let%bind tv = evaluate_type e te in - let%bind expr' = type_expression' ~tv_opt:tv e expr in + let let_binder = fst let_binder in + let e' = Environment.add_ez_declaration (let_binder) rhs e in + let%bind let_result = type_expression' e' let_result in + return (E_let_in {let_binder; rhs; let_result; inline}) let_result.type_expression + | E_ascription {anno_expr; type_annotation} -> + let%bind tv = evaluate_type e type_annotation in + let%bind expr' = type_expression' ~tv_opt:tv e anno_expr in let%bind type_annotation = O.merge_annotation (Some tv) - (Some expr'.type_annotation) + (Some expr'.type_expression) (internal_assertion_failure "merge_annotations (Some ...) (Some ...) failed") in (* check type annotation of the expression as a whole (e.g. let x : t = (v : t') ) *) let%bind () = match tv_opt with | None -> ok () - | Some tv' -> O.assert_type_value_eq (tv' , type_annotation) in - ok @@ {expr' with type_annotation} + | Some tv' -> O.assert_type_expression_eq (tv' , type_annotation) in + ok {expr' with type_expression=type_annotation} -and type_constant (name:I.constant) (lst:O.type_value list) (tv_opt:O.type_value option) : (O.constant * O.type_value) result = +and type_constant (name:I.constant') (lst:O.type_expression list) (tv_opt:O.type_expression option) : (O.constant' * O.type_expression) result = let%bind typer = Operators.Typer.constant_typers name in let%bind tv = typer lst tv_opt in ok(name, tv) -let untype_type_value (t:O.type_value) : (I.type_expression) result = - match t.simplified with +let untype_type_expression (t:O.type_expression) : (I.type_expression) result = + match t.type_meta with | Some s -> ok s | _ -> fail @@ internal_assertion_failure "trying to untype generated type" @@ -841,6 +794,7 @@ let untype_literal (l:O.literal) : I.literal result = let open I in match l with | Literal_unit -> ok Literal_unit + | Literal_void -> ok Literal_void | Literal_bool b -> ok (Literal_bool b) | Literal_nat n -> ok (Literal_nat n) | Literal_timestamp n -> ok (Literal_timestamp n) @@ -849,43 +803,38 @@ let untype_literal (l:O.literal) : I.literal result = | Literal_string s -> ok (Literal_string s) | Literal_signature s -> ok (Literal_signature s) | Literal_key s -> ok (Literal_key s) + | Literal_key_hash s -> ok (Literal_key_hash s) | Literal_chain_id s -> ok (Literal_chain_id s) | Literal_bytes b -> ok (Literal_bytes b) | Literal_address s -> ok (Literal_address s) | Literal_operation s -> ok (Literal_operation s) -let rec untype_expression (e:O.annotated_expression) : (I.expression) result = +let rec untype_expression (e:O.expression) : (I.expression) result = let open I in let return e = ok e in - match e.expression with + match e.expression_content with | E_literal l -> let%bind l = untype_literal l in return (e_literal l) - | E_constant (const, lst) -> - let%bind lst' = bind_map_list untype_expression lst in - return (e_constant const lst') + | E_constant {cons_name;arguments} -> + let%bind lst' = bind_map_list untype_expression arguments in + return (e_constant cons_name lst') | E_variable n -> - return (e_variable n) - | E_application (f, arg) -> - let%bind f' = untype_expression f in - let%bind arg' = untype_expression arg in + return (e_variable (n)) + | E_application {expr1;expr2} -> + let%bind f' = untype_expression expr1 in + let%bind arg' = untype_expression expr2 in return (e_application f' arg') - | E_lambda {binder ; body} -> ( - let%bind io = get_t_function e.type_annotation in - let%bind (input_type , output_type) = bind_map_pair untype_type_value io in - let%bind result = untype_expression body in - return (e_lambda binder (Some input_type) (Some output_type) result) + | E_lambda {binder ; result} -> ( + let%bind io = get_t_function e.type_expression in + let%bind (input_type , output_type) = bind_map_pair untype_type_expression io in + let%bind result = untype_expression result in + return (e_lambda (binder) (Some input_type) (Some output_type) result) ) - | E_tuple lst -> - let%bind lst' = bind_list - @@ List.map untype_expression lst in - return (e_tuple lst') - | E_tuple_accessor (tpl, ind) -> - let%bind tpl' = untype_expression tpl in - return (e_accessor tpl' [Access_tuple ind]) - | E_constructor ( Constructor n, p) -> - let%bind p' = untype_expression p in + | E_constructor {constructor; element} -> + let%bind p' = untype_expression element in + let Constructor n = constructor in return (e_constructor n p') | E_record r -> let aux ( Label k ,v) = (k, v) in @@ -893,10 +842,11 @@ let rec untype_expression (e:O.annotated_expression) : (I.expression) result = let%bind r' = bind_smap @@ Map.String.map untype_expression r in return (e_record r') - | E_record_accessor (r, Label s) -> - let%bind r' = untype_expression r in - return (e_accessor r' [Access_record s]) - | E_record_update (r, (l,e)) -> + | E_record_accessor {expr; label} -> + let%bind r' = untype_expression expr in + let Label s = label in + return (e_accessor r' s) + | E_record_update {record=r; path=l; update=e} -> let%bind r' = untype_expression r in let%bind e = untype_expression e in let Label l = l in @@ -916,20 +866,18 @@ let rec untype_expression (e:O.annotated_expression) : (I.expression) result = | E_look_up dsi -> let%bind (a , b) = bind_map_pair untype_expression dsi in return (e_look_up a b) - | E_matching (ae, m) -> - let%bind ae' = untype_expression ae in - let%bind m' = untype_matching untype_expression m in + | E_matching {matchee;cases} -> + let%bind ae' = untype_expression matchee in + let%bind m' = untype_matching untype_expression cases in return (e_matching ae' m') - | E_sequence _ - | E_loop _ - | E_assign _ -> fail @@ not_supported_yet_untranspile "not possible to untranspile statements yet" e.expression - | E_let_in {binder; rhs; result; inline} -> - let%bind tv = untype_type_value rhs.type_annotation in + | E_loop _-> fail @@ not_supported_yet_untranspile "not possible to untranspile statements yet" e + | E_let_in {let_binder;rhs;let_result; inline} -> + let%bind tv = untype_type_expression rhs.type_expression in let%bind rhs = untype_expression rhs in - let%bind result = untype_expression result in - return (e_let_in (binder , (Some tv)) inline rhs result) + let%bind result = untype_expression let_result in + return (I.e_let_in (let_binder , (Some tv)) false inline rhs result) -and untype_matching : type o i . (o -> i result) -> (o,O.type_value) O.matching -> ((i,unit) I.matching) result = fun f m -> +and untype_matching : (O.expression -> I.expression result) -> O.matching_expr -> I.matching_expr result = fun f m -> let open I in match m with | Match_bool {match_true ; match_false} -> diff --git a/src/passes/4-typer-old/typer.mli b/src/passes/4-typer-old/typer.mli index 1446b457f..9b1e986da 100644 --- a/src/passes/4-typer-old/typer.mli +++ b/src/passes/4-typer-old/typer.mli @@ -41,14 +41,14 @@ end val type_program : I.program -> (O.program * Solver.state) result val type_declaration : environment -> Solver.state -> I.declaration -> (environment * Solver.state * O.declaration option) result (* val type_match : (environment -> 'i -> 'o result) -> environment -> O.type_value -> 'i I.matching -> I.expression -> Location.t -> 'o O.matching result *) -val evaluate_type : environment -> I.type_expression -> O.type_value result -val type_expression : environment -> Solver.state -> ?tv_opt:O.type_value -> I.expression -> (O.annotated_expression * Solver.state) result -val type_constant : I.constant -> O.type_value list -> O.type_value option -> (O.constant * O.type_value) result +val evaluate_type : environment -> I.type_expression -> O.type_expression result +val type_expression : environment -> Solver.state -> ?tv_opt:O.type_expression -> I.expression -> (O.expression * Solver.state) result +val type_constant : I.constant' -> O.type_expression list -> O.type_expression option -> (O.constant' * O.type_expression) result (* val untype_type_value : O.type_value -> (I.type_expression) result val untype_literal : O.literal -> I.literal result *) -val untype_expression : O.annotated_expression -> I.expression result +val untype_expression : O.expression -> I.expression result (* val untype_matching : ('o -> 'i result) -> 'o O.matching -> ('i I.matching) result *) diff --git a/src/passes/4-typer/typer.mli b/src/passes/4-typer/typer.mli index b7c410383..bb8ac3094 100644 --- a/src/passes/4-typer/typer.mli +++ b/src/passes/4-typer/typer.mli @@ -12,5 +12,5 @@ module Solver = Typer_new.Solver type environment = Environment.t val type_program : I.program -> (O.program * Solver.state) result -val type_expression_subst : environment -> Solver.state -> ?tv_opt:O.type_value -> I.expression -> (O.annotated_expression * Solver.state) result -val untype_expression : O.annotated_expression -> I.expression result +val type_expression_subst : environment -> Solver.state -> ?tv_opt:O.type_expression -> I.expression -> (O.expression * Solver.state) result +val untype_expression : O.expression -> I.expression result diff --git a/src/passes/6-transpiler/helpers.ml b/src/passes/6-transpiler/helpers.ml index e96ba1a12..57019eeb5 100644 --- a/src/passes/6-transpiler/helpers.ml +++ b/src/passes/6-transpiler/helpers.ml @@ -21,9 +21,9 @@ let map_of_kv_list lst = let open Map.String in List.fold_left (fun prev (k, v) -> add k v prev) empty lst -let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value * AST.type_value) result = +let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value * AST.type_expression) result = let open Append_tree in - let rec aux tv : (string * value * AST.type_value) result= + let rec aux tv : (string * value * AST.type_expression) result= match tv with | Leaf (Constructor k, t), v -> ok (k, v, t) | Node {a}, D_left v -> aux (a, v) @@ -33,9 +33,9 @@ let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value let%bind (s, v, t) = aux (tree, v) in ok (s, v, t) -let extract_tuple (v : value) (tree : AST.type_value Append_tree.t') : ((value * AST.type_value) list) result = +let extract_tuple (v : value) (tree : AST.type_expression Append_tree.t') : ((value * AST.type_expression) list) result = let open Append_tree in - let rec aux tv : ((value * AST.type_value) list) result = + let rec aux tv : ((value * AST.type_expression) list) result = match tv with | Leaf t, v -> ok @@ [v, t] | Node {a;b}, D_pair (va, vb) -> @@ -48,7 +48,7 @@ let extract_tuple (v : value) (tree : AST.type_value Append_tree.t') : ((value * let extract_record (v : value) (tree : _ Append_tree.t') : (_ list) result = let open Append_tree in - let rec aux tv : ((AST.label * (value * AST.type_value)) list) result = + let rec aux tv : ((AST.label * (value * AST.type_expression)) list) result = match tv with | Leaf (s, t), v -> ok @@ [s, (v, t)] | Node {a;b}, D_pair (va, vb) -> diff --git a/src/passes/6-transpiler/transpiler.ml b/src/passes/6-transpiler/transpiler.ml index 162231e7e..632fe0ee9 100644 --- a/src/passes/6-transpiler/transpiler.ml +++ b/src/passes/6-transpiler/transpiler.ml @@ -102,32 +102,27 @@ them. please report this to the developers." in ] in error ~data title content - let not_found content = - let title () = "Not_found" in - let content () = content in - let data = [ - ] in - error ~data title content end open Errors -let rec transpile_type (t:AST.type_value) : type_value result = - match t.type_value' with +let rec transpile_type (t:AST.type_expression) : type_value result = + match t.type_content with | T_variable (name) -> fail @@ no_type_variable @@ name - | T_constant (TC_bool) -> ok (T_base Base_bool) - | T_constant (TC_int) -> ok (T_base Base_int) - | T_constant (TC_nat) -> ok (T_base Base_nat) - | T_constant (TC_mutez) -> ok (T_base Base_mutez) - | T_constant (TC_string) -> ok (T_base Base_string) - | T_constant (TC_bytes) -> ok (T_base Base_bytes) - | T_constant (TC_address) -> ok (T_base Base_address) - | T_constant (TC_timestamp) -> ok (T_base Base_timestamp) - | T_constant (TC_unit) -> ok (T_base Base_unit) - | T_constant (TC_operation) -> ok (T_base Base_operation) - | T_constant (TC_signature) -> ok (T_base Base_signature) - | T_constant (TC_key) -> ok (T_base Base_key) - | T_constant (TC_key_hash) -> ok (T_base Base_key_hash) - | T_constant (TC_chain_id) -> ok (T_base Base_chain_id) + | T_constant (TC_bool) -> ok (T_base TC_bool) + | T_constant (TC_int) -> ok (T_base TC_int) + | T_constant (TC_nat) -> ok (T_base TC_nat) + | T_constant (TC_mutez) -> ok (T_base TC_mutez) + | T_constant (TC_string) -> ok (T_base TC_string) + | T_constant (TC_bytes) -> ok (T_base TC_bytes) + | T_constant (TC_address) -> ok (T_base TC_address) + | T_constant (TC_timestamp) -> ok (T_base TC_timestamp) + | T_constant (TC_unit) -> ok (T_base TC_unit) + | T_constant (TC_operation) -> ok (T_base TC_operation) + | T_constant (TC_signature) -> ok (T_base TC_signature) + | T_constant (TC_key) -> ok (T_base TC_key) + | T_constant (TC_key_hash) -> ok (T_base TC_key_hash) + | T_constant (TC_chain_id) -> ok (T_base TC_chain_id) + | T_constant (TC_void) -> ok (T_base TC_void) | T_operator (TC_contract x) -> let%bind x' = transpile_type x in ok (T_contract x') @@ -160,7 +155,7 @@ let rec transpile_type (t:AST.type_value) : type_value result = ok (None, T_or (a, b)) in let%bind m' = Append_tree.fold_ne - (fun (Constructor ann, a) -> + (fun (Stage_common.Types.Constructor ann, a) -> let%bind a = transpile_type a in ok (Some (String.uncapitalize_ascii ann), a)) aux node in @@ -173,49 +168,22 @@ let rec transpile_type (t:AST.type_value) : type_value result = ok (None, T_pair (a, b)) in let%bind m' = Append_tree.fold_ne - (fun (Label ann, a) -> + (fun (Stage_common.Types.Label ann, a) -> let%bind a = transpile_type a in ok (Some ann, a)) aux node in ok @@ snd m' - | T_operator (TC_tuple lst) -> - let node = Append_tree.of_list lst in - let aux a b : type_value result = - let%bind a = a in - let%bind b = b in - ok (T_pair ((None, a), (None, b))) - in - Append_tree.fold_ne transpile_type aux node - | T_arrow (param, result) -> ( - let%bind param' = transpile_type param in - let%bind result' = transpile_type result in - ok (T_function (param', result')) + | T_arrow {type1;type2} -> ( + let%bind param' = transpile_type type1 in + let%bind result' = transpile_type type2 in + ok (T_function (param',result')) ) -let tuple_access_to_lr : type_value -> type_value list -> int -> (type_value * [`Left | `Right]) list result = fun ty tys ind -> - let node_tv = Append_tree.of_list @@ List.mapi (fun i a -> (i, a)) tys in - let%bind path = - let aux (i , _) = i = ind in - trace_option (corner_case ~loc:__LOC__ "tuple access leaf") @@ - Append_tree.exists_path aux node_tv in - let lr_path = List.map (fun b -> if b then `Right else `Left) path in - let%bind (_ , lst) = - let aux = fun (ty' , acc) cur -> - let%bind (a , b) = - trace_strong (corner_case ~loc:__LOC__ "tuple access pair") @@ - Mini_c.get_t_pair ty' in - match cur with - | `Left -> ok (a , acc @ [(a , `Left)]) - | `Right -> ok (b , acc @ [(b , `Right)]) - in - bind_fold_list aux (ty , []) lr_path in - ok lst - -let record_access_to_lr : type_value -> type_value AST.label_map -> label -> (type_value * [`Left | `Right]) list result = fun ty tym ind -> +let record_access_to_lr : type_value -> type_value AST.label_map -> AST.label -> (type_value * [`Left | `Right]) list result = fun ty tym ind -> let tys = kv_list_of_lmap tym in let node_tv = Append_tree.of_list tys in let%bind path = - let aux (Label i , _) = let Label ind = ind in i = ind in + let aux (i , _) = i = ind in trace_option (corner_case ~loc:__LOC__ "record access leaf") @@ Append_tree.exists_path aux node_tv in let lr_path = List.map (fun b -> if b then `Right else `Left) path in @@ -245,16 +213,17 @@ let rec transpile_literal : AST.literal -> value = fun l -> match l with | Literal_chain_id s -> D_string s | Literal_operation op -> D_operation op | Literal_unit -> D_unit + | Literal_void -> D_none and transpile_environment_element_type : AST.environment_element -> type_value result = fun ele -> transpile_type ele.type_value -and tree_of_sum : AST.type_value -> (constructor * AST.type_value) Append_tree.t result = fun t -> +and tree_of_sum : AST.type_expression -> (AST.constructor' * AST.type_expression) Append_tree.t result = fun t -> let%bind map_tv = get_t_sum t in ok @@ Append_tree.of_list @@ kv_list_of_cmap map_tv -and transpile_annotated_expression (ae:AST.annotated_expression) : expression result = - let%bind tv = transpile_type ae.type_annotation in +and transpile_annotated_expression (ae:AST.expression) : expression result = + let%bind tv = transpile_type ae.type_expression in let return ?(tv = tv) expr = ok @@ Combinators.Expression.make_tpl (expr, tv) in let f = transpile_annotated_expression in let info = @@ -262,11 +231,11 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re let content () = Format.asprintf "%a" Location.pp ae.location in info title content in trace info @@ - match ae.expression with - | E_let_in {binder; rhs; result; inline} -> + match ae.expression_content with + | E_let_in {let_binder; rhs; let_result; inline} -> let%bind rhs' = transpile_annotated_expression rhs in - let%bind result' = transpile_annotated_expression result in - return (E_let_in ((binder, rhs'.type_value), inline, rhs', result')) + let%bind result' = transpile_annotated_expression let_result in + return (E_let_in ((let_binder, rhs'.type_value), inline, rhs', result')) | E_literal l -> return @@ E_literal (transpile_literal l) | E_variable name -> ( let%bind ele = @@ -275,21 +244,21 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re let%bind tv = transpile_environment_element_type ele in return ~tv @@ E_variable (name) ) - | E_application (a, b) -> - let%bind a = transpile_annotated_expression a in - let%bind b = transpile_annotated_expression b in + | E_application {expr1;expr2} -> + let%bind a = transpile_annotated_expression expr1 in + let%bind b = transpile_annotated_expression expr2 in return @@ E_application (a, b) - | E_constructor (m, param) -> ( - let%bind param' = transpile_annotated_expression param in + | E_constructor {constructor;element} -> ( + let%bind param' = transpile_annotated_expression element in let (param'_expr , param'_tv) = Combinators.Expression.(get_content param' , get_type param') in let%bind node_tv = trace_strong (corner_case ~loc:__LOC__ "getting lr tree") @@ - tree_of_sum ae.type_annotation in + tree_of_sum ae.type_expression in let leaf (k, tv) : (expression' option * type_value) result = - if k = m then ( + if k = constructor then ( let%bind _ = trace_strong (corner_case ~loc:__LOC__ "wrong type for constructor parameter") - @@ AST.assert_type_value_eq (tv, param.type_annotation) in + @@ AST.assert_type_expression_eq (tv, element.type_expression) in ok (Some (param'_expr), param'_tv) ) else ( let%bind tv = transpile_type tv in @@ -301,8 +270,8 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re match (a, b) with | (None, a), (None, b) -> ok (None, T_or ((None, a), (None, b))) | (Some _, _), (Some _, _) -> fail @@ corner_case ~loc:__LOC__ "multiple identical constructors in the same variant" - | (Some v, a), (None, b) -> ok (Some (E_constant (C_LEFT, [Combinators.Expression.make_tpl (v, a)])), T_or ((None, a), (None, b))) - | (None, a), (Some v, b) -> ok (Some (E_constant (C_RIGHT, [Combinators.Expression.make_tpl (v, b)])), T_or ((None, a), (None, b))) + | (Some v, a), (None, b) -> ok (Some (E_constant {cons_name=C_LEFT ;arguments= [Combinators.Expression.make_tpl (v, a)]}), T_or ((None, a), (None, b))) + | (None, a), (Some v, b) -> ok (Some (E_constant {cons_name=C_RIGHT;arguments= [Combinators.Expression.make_tpl (v, b)]}), T_or ((None, a), (None, b))) in let%bind (ae_opt, tv) = Append_tree.fold_ne leaf node node_tv in let%bind ae = @@ -310,36 +279,6 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re ae_opt in return ~tv ae ) - | E_tuple lst -> ( - let node = Append_tree.of_list lst in - let aux (a:expression result) (b:expression result) : expression result = - let%bind a = a in - let%bind b = b in - let a_ty = Combinators.Expression.get_type a in - let b_ty = Combinators.Expression.get_type b in - let tv = T_pair ((None, a_ty) , (None, b_ty)) in - return ~tv @@ E_constant (C_PAIR, [a; b]) - in - Append_tree.fold_ne (transpile_annotated_expression) aux node - ) - | E_tuple_accessor (tpl, ind) -> ( - let%bind ty' = transpile_type tpl.type_annotation in - let%bind ty_lst = - trace_strong (corner_case ~loc:__LOC__ "transpiler: E_tuple_accessor: not a tuple") @@ - get_t_tuple tpl.type_annotation in - let%bind ty'_lst = bind_map_list transpile_type ty_lst in - let%bind path = - trace_strong (corner_case ~loc:__LOC__ "tuple access") @@ - tuple_access_to_lr ty' ty'_lst ind in - let aux = fun pred (ty, lr) -> - let c = match lr with - | `Left -> C_CAR - | `Right -> C_CDR in - Combinators.Expression.make_tpl (E_constant (c, [pred]) , ty) in - let%bind tpl' = transpile_annotated_expression tpl in - let expr = List.fold_left aux tpl' path in - ok expr - ) | E_record m -> ( let node = Append_tree.of_list @@ list_of_lmap m in let aux a b : expression result = @@ -348,51 +287,51 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re let a_ty = Combinators.Expression.get_type a in let b_ty = Combinators.Expression.get_type b in let tv = T_pair ((None, a_ty) , (None, b_ty)) in - return ~tv @@ E_constant (C_PAIR, [a; b]) + return ~tv @@ E_constant {cons_name=C_PAIR;arguments=[a; b]} in trace_strong (corner_case ~loc:__LOC__ "record build") @@ Append_tree.fold_ne (transpile_annotated_expression) aux node ) - | E_record_accessor (record, property) -> - let%bind ty' = transpile_type (get_type_annotation record) in + | E_record_accessor {expr; label} -> + let%bind ty' = transpile_type (get_type_expression expr) in let%bind ty_lmap = trace_strong (corner_case ~loc:__LOC__ "not a record") @@ - get_t_record (get_type_annotation record) in - let%bind ty'_lmap = AST.bind_map_lmap transpile_type ty_lmap in + get_t_record (get_type_expression expr) in + let%bind ty'_lmap = Stage_common.Helpers.bind_map_lmap transpile_type ty_lmap in let%bind path = trace_strong (corner_case ~loc:__LOC__ "record access") @@ - record_access_to_lr ty' ty'_lmap property in + record_access_to_lr ty' ty'_lmap label in let aux = fun pred (ty, lr) -> let c = match lr with | `Left -> C_CAR | `Right -> C_CDR in - Combinators.Expression.make_tpl (E_constant (c, [pred]) , ty) in - let%bind record' = transpile_annotated_expression record in + Combinators.Expression.make_tpl (E_constant {cons_name=c;arguments=[pred]} , ty) in + let%bind record' = transpile_annotated_expression expr in let expr = List.fold_left aux record' path in ok expr - | E_record_update (record, (l,expr)) -> - let%bind ty' = transpile_type (get_type_annotation record) in + | E_record_update {record; path; update} -> + let%bind ty' = transpile_type (get_type_expression record) in let%bind ty_lmap = trace_strong (corner_case ~loc:__LOC__ "not a record") @@ - get_t_record (get_type_annotation record) in - let%bind ty'_lmap = AST.bind_map_lmap transpile_type ty_lmap in + get_t_record (get_type_expression record) in + let%bind ty'_lmap = Stage_common.Helpers.bind_map_lmap transpile_type ty_lmap in let%bind path = trace_strong (corner_case ~loc:__LOC__ "record access") @@ - record_access_to_lr ty' ty'_lmap l in - let path' = List.map snd path in - let%bind expr' = transpile_annotated_expression expr in + record_access_to_lr ty' ty'_lmap path in + let path = List.map snd path in + let%bind update = transpile_annotated_expression update in let%bind record = transpile_annotated_expression record in - return @@ E_update (record, (path',expr')) - | E_constant (name , lst) -> ( + return @@ E_record_update (record, path, update) + | E_constant {cons_name=name; arguments=lst} -> ( let iterator_generator iterator_name = - let lambda_to_iterator_body (f : AST.annotated_expression) (l : AST.lambda) = - let%bind body' = transpile_annotated_expression l.body in - let%bind (input , _) = AST.get_t_function f.type_annotation in + let lambda_to_iterator_body (f : AST.expression) (l : AST.lambda) = + let%bind body' = transpile_annotated_expression l.result in + let%bind (input , _) = AST.get_t_function f.type_expression in let%bind input' = transpile_type input in ok ((l.binder , input') , body') in - let expression_to_iterator_body (f : AST.annotated_expression) = - match f.expression with + let expression_to_iterator_body (f : AST.expression) = + match f.expression_content with | E_lambda l -> lambda_to_iterator_body f l | E_variable v -> ( let%bind elt = @@ -400,7 +339,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re AST.Environment.get_opt v f.environment in match elt.definition with | ED_declaration (f , _) -> ( - match f.expression with + match f.expression_content with | E_lambda l -> lambda_to_iterator_body f l | _ -> fail @@ unsupported_iterator f.location ) @@ -408,7 +347,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re ) | _ -> fail @@ unsupported_iterator f.location in - fun (lst : AST.annotated_expression list) -> match (lst , iterator_name) with + fun (lst : AST.expression list) -> match (lst , iterator_name) with | [f ; i] , C_ITER | [f ; i] , C_MAP -> ( let%bind f' = expression_to_iterator_body f in let%bind i' = transpile_annotated_expression i in @@ -434,11 +373,11 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re | (C_MAP_FOLD , lst) -> fold lst | _ -> ( let%bind lst' = bind_map_list (transpile_annotated_expression) lst in - return @@ E_constant (name , lst') + return @@ E_constant {cons_name=name;arguments=lst'} ) ) | E_lambda l -> - let%bind io = AST.get_t_function ae.type_annotation in + let%bind io = AST.get_t_function ae.type_expression in transpile_lambda l io | E_list lst -> ( let%bind t = @@ -446,7 +385,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re get_t_list tv in let%bind lst' = bind_map_list (transpile_annotated_expression) lst in let aux : expression -> expression -> expression result = fun prev cur -> - return @@ E_constant (C_CONS, [cur ; prev]) in + return @@ E_constant {cons_name=C_CONS;arguments=[cur ; prev]} in let%bind (init : expression) = return @@ E_make_empty_list t in bind_fold_right_list aux init lst' ) @@ -456,7 +395,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re get_t_set tv in let%bind lst' = bind_map_list (transpile_annotated_expression) lst in let aux : expression -> expression -> expression result = fun prev cur -> - return @@ E_constant (C_SET_ADD, [cur ; prev]) in + return @@ E_constant {cons_name=C_SET_ADD;arguments=[cur ; prev]} in let%bind (init : expression) = return @@ E_make_empty_set t in bind_fold_list aux init lst' ) @@ -464,12 +403,12 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re let%bind (src, dst) = trace_strong (corner_case ~loc:__LOC__ "not a map") @@ Mini_c.Combinators.get_t_map tv in - let aux : expression result -> (AST.ae * AST.ae) -> expression result = fun prev (k, v) -> + let aux : expression result -> (AST.expression * AST.expression) -> expression result = fun prev (k, v) -> let%bind prev' = prev in let%bind (k', v') = let v' = e_a_some v ae.environment in bind_map_pair (transpile_annotated_expression) (k , v') in - return @@ E_constant (C_UPDATE, [k' ; v' ; prev']) + return @@ E_constant {cons_name=C_UPDATE;arguments=[k' ; v' ; prev']} in let init = return @@ E_make_empty_map (src, dst) in List.fold_left aux init m @@ -478,63 +417,26 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re let%bind (src, dst) = trace_strong (corner_case ~loc:__LOC__ "not a map") @@ Mini_c.Combinators.get_t_big_map tv in - let aux : expression result -> (AST.ae * AST.ae) -> expression result = fun prev (k, v) -> + let aux : expression result -> (AST.expression * AST.expression) -> expression result = fun prev (k, v) -> let%bind prev' = prev in let%bind (k', v') = let v' = e_a_some v ae.environment in bind_map_pair (transpile_annotated_expression) (k , v') in - return @@ E_constant (C_UPDATE, [k' ; v' ; prev']) + return @@ E_constant {cons_name=C_UPDATE;arguments=[k' ; v' ; prev']} in let init = return @@ E_make_empty_big_map (src, dst) in List.fold_left aux init m ) | E_look_up dsi -> ( let%bind (ds', i') = bind_map_pair f dsi in - return @@ E_constant (C_MAP_FIND_OPT, [i' ; ds']) + return @@ E_constant {cons_name=C_MAP_FIND_OPT;arguments=[i' ; ds']} ) - | E_sequence (a , b) -> ( - let%bind a' = transpile_annotated_expression a in - let%bind b' = transpile_annotated_expression b in - return @@ E_sequence (a' , b') - ) - | E_loop (expr , body) -> ( - let%bind expr' = transpile_annotated_expression expr in + | E_loop {condition; body} -> ( + let%bind expr' = transpile_annotated_expression condition in let%bind body' = transpile_annotated_expression body in return @@ E_while (expr' , body') ) - | E_assign (typed_name , path , expr) -> ( - let ty = typed_name.type_value in - let aux : ((AST.type_value * [`Left | `Right] list) as 'a) -> AST.access -> 'a result = - fun (prev, acc) cur -> - let%bind ty' = transpile_type prev in - match cur with - | Access_tuple ind -> ( - let%bind ty_lst = - trace_strong (corner_case ~loc:__LOC__ "transpiler: E_assign: Access_tuple: not a tuple") @@ - AST.Combinators.get_t_tuple prev in - let%bind ty'_lst = bind_map_list transpile_type ty_lst in - let%bind path = tuple_access_to_lr ty' ty'_lst ind in - let path' = List.map snd path in - ok (List.nth ty_lst ind, acc @ path') - ) - | Access_record prop -> ( - let%bind ty_map = - trace_strong (corner_case ~loc:__LOC__ "not a record") @@ - AST.Combinators.get_t_record prev in - let%bind ty'_map = bind_map_lmap transpile_type ty_map in - let%bind path = record_access_to_lr ty' ty'_map (Label prop) in - let path' = List.map snd path in - let%bind prop_in_ty_map = trace_option - (Errors.not_found "acessing prop in ty_map [TODO: better error message]") - (AST.LMap.find_opt (Label prop) ty_map) in - ok (prop_in_ty_map, acc @ path') - ) - in - let%bind (_, path) = bind_fold_list aux (ty, []) path in - let%bind expr' = transpile_annotated_expression expr in - return (E_assignment (typed_name.type_name, path, expr')) - ) - | E_matching (expr, m) -> ( + | E_matching {matchee=expr; cases=m} -> ( let%bind expr' = transpile_annotated_expression expr in match m with | Match_bool {match_true ; match_false} -> @@ -607,23 +509,25 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re in trace_strong (corner_case ~loc:__LOC__ "building constructor") @@ aux expr' tree'' - ) + ) | AST.Match_tuple _ -> fail @@ unsupported_pattern_matching "tuple" ae.location - ) + ) and transpile_lambda l (input_type , output_type) = - let { binder ; body } : AST.lambda = l in - let%bind result' = transpile_annotated_expression body in + let { binder ; result } : AST.lambda = l in + let%bind result' = transpile_annotated_expression result in let%bind input = transpile_type input_type in let%bind output = transpile_type output_type in let tv = Combinators.t_function input output in + let binder = binder in let closure = E_closure { binder; body = result'} in ok @@ Combinators.Expression.make_tpl (closure , tv) let transpile_declaration env (d:AST.declaration) : toplevel_statement result = match d with - | Declaration_constant ({name;annotated_expression} , inline , _) -> - let%bind expression = transpile_annotated_expression annotated_expression in + | Declaration_constant (name,expression, inline, _) -> + let name = name in + let%bind expression = transpile_annotated_expression expression in let tv = Combinators.Expression.get_type expression in let env' = Environment.add (name, tv) env in ok @@ ((name, inline, expression), environment_wrap env env') @@ -658,9 +562,9 @@ let check_storage f ty loc : (anon_function * _) result = if aux (snd storage) false then ok (f, ty) else fail @@ bad_big_map loc | _ -> ok (f, ty) -let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value * AST.type_value) result = +let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value * AST.type_expression) result = let open Append_tree in - let rec aux tv : (string * value * AST.type_value) result= + let rec aux tv : (string * value * AST.type_expression) result= match tv with | Leaf (k, t), v -> ok (k, v, t) | Node {a}, D_left v -> aux (a, v) @@ -670,9 +574,9 @@ let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value let%bind (s, v, t) = aux (tree, v) in ok (s, v, t) -let extract_tuple (v : value) (tree : AST.type_value Append_tree.t') : ((value * AST.type_value) list) result = +let extract_tuple (v : value) (tree : AST.type_expression Append_tree.t') : ((value * AST.type_expression) list) result = let open Append_tree in - let rec aux tv : ((value * AST.type_value) list) result = + let rec aux tv : ((value * AST.type_expression) list) result = match tv with | Leaf t, v -> ok @@ [v, t] | Node {a;b}, D_pair (va, vb) -> @@ -685,7 +589,7 @@ let extract_tuple (v : value) (tree : AST.type_value Append_tree.t') : ((value * let extract_record (v : value) (tree : _ Append_tree.t') : (_ list) result = let open Append_tree in - let rec aux tv : ((string * (value * AST.type_value)) list) result = + let rec aux tv : ((string * (value * AST.type_expression)) list) result = match tv with | Leaf (s, t), v -> ok @@ [s, (v, t)] | Node {a;b}, D_pair (va, vb) -> diff --git a/src/passes/6-transpiler/transpiler.mli b/src/passes/6-transpiler/transpiler.mli index 5defe6eba..dbdb41b58 100644 --- a/src/passes/6-transpiler/transpiler.mli +++ b/src/passes/6-transpiler/transpiler.mli @@ -35,7 +35,7 @@ val translate_literal : AST.literal -> value val transpile_environment_element_type : AST.environment_element -> type_value result val tree_of_sum : AST.type_value -> (type_name * AST.type_value) Append_tree.t result *) -val transpile_annotated_expression : AST.annotated_expression -> expression result +val transpile_annotated_expression : AST.expression -> expression result (* val transpile_lambda : AST.lambda -> expression result val transpile_declaration : environment -> AST.declaration -> toplevel_statement result @@ -49,7 +49,7 @@ val translate_main : AST.lambda -> Location.t ->( anon_function * ( type_value * (* From an expression [expr], build the expression [fun () -> expr] *) val translate_entry : AST.program -> string -> ( anon_function * ( type_value * type_value )) result *) -val extract_constructor : value -> ( string * AST.type_value ) Append_tree.t' -> (string * value * AST.type_value) result -val extract_tuple : value -> AST.type_value Append_tree.t' -> (value * AST.type_value) list result -val extract_record : value -> ( string * AST.type_value ) Append_tree.t' -> ( string * ( value * AST.type_value )) list result -val untranspile : value -> AST.type_value -> AST.annotated_expression result +val extract_constructor : value -> ( string * AST.type_expression ) Append_tree.t' -> (string * value * AST.type_expression) result +val extract_tuple : value -> AST.type_expression Append_tree.t' -> (value * AST.type_expression) list result +val extract_record : value -> ( string * AST.type_expression ) Append_tree.t' -> ( string * ( value * AST.type_expression)) list result +val untranspile : value -> AST.type_expression -> AST.expression result diff --git a/src/passes/6-transpiler/untranspiler.ml b/src/passes/6-transpiler/untranspiler.ml index cc572fa94..49f9cde37 100644 --- a/src/passes/6-transpiler/untranspiler.ml +++ b/src/passes/6-transpiler/untranspiler.ml @@ -40,10 +40,10 @@ end open Errors -let rec untranspile (v : value) (t : AST.type_value) : AST.annotated_expression result = +let rec untranspile (v : value) (t : AST.type_expression) : AST.expression result = let open! AST in let return e = ok (make_a_e_empty e t) in - match t.type_value' with + match t.type_content with | T_constant type_constant -> ( match type_constant with | TC_unit -> ( @@ -95,6 +95,7 @@ let rec untranspile (v : value) (t : AST.type_value) : AST.annotated_expression return (E_literal (Literal_bytes n)) ) | TC_address -> ( + let%bind n = trace_strong (wrong_mini_c_value "address" v) @@ get_string v in @@ -124,6 +125,12 @@ let rec untranspile (v : value) (t : AST.type_value) : AST.annotated_expression get_string v in return (E_literal (Literal_chain_id n)) ) + | TC_void -> ( + let%bind () = + trace_strong (wrong_mini_c_value "void" v) @@ + get_unit v in + return (E_literal (Literal_void)) + ) | TC_signature -> ( let%bind n = trace_strong (wrong_mini_c_value "signature" v) @@ @@ -176,6 +183,12 @@ let rec untranspile (v : value) (t : AST.type_value) : AST.annotated_expression bind_map_list aux lst in return (E_list lst') ) + | TC_arrow _ -> ( + let%bind n = + trace_strong (wrong_mini_c_value "lambda as string" v) @@ + get_string v in + return (E_literal (Literal_string n)) + ) | TC_set ty -> ( let%bind lst = trace_strong (wrong_mini_c_value "set" v) @@ @@ -187,22 +200,6 @@ let rec untranspile (v : value) (t : AST.type_value) : AST.annotated_expression ) | TC_contract _ -> fail @@ bad_untranspile "contract" v - | TC_arrow _ -> ( - let%bind n = - trace_strong (wrong_mini_c_value "lambda as string" v) @@ - get_string v in - return (E_literal (Literal_string n)) - ) - | TC_tuple lst -> - let%bind node = match Append_tree.of_list lst with - | Empty -> fail @@ corner_case ~loc:__LOC__ "empty tuple" - | Full t -> ok t in - let%bind tpl = - trace_strong (corner_case ~loc:__LOC__ "tuple extract") @@ - extract_tuple v node in - let%bind tpl' = bind_list - @@ List.map (fun (x, y) -> untranspile x y) tpl in - return (E_tuple tpl') ) | T_sum m -> let lst = kv_list_of_cmap m in @@ -214,7 +211,7 @@ let rec untranspile (v : value) (t : AST.type_value) : AST.annotated_expression trace_strong (corner_case ~loc:__LOC__ "sum extract constructor") @@ extract_constructor v node in let%bind sub = untranspile v tv in - return (E_constructor (Constructor name, sub)) + return (E_constructor {constructor=Constructor name;element=sub}) | T_record m -> let lst = kv_list_of_lmap m in let%bind node = match Append_tree.of_list lst with diff --git a/src/passes/7-self_mini_c/helpers.ml b/src/passes/7-self_mini_c/helpers.ml index 6e3a454b1..1c1116f4b 100644 --- a/src/passes/7-self_mini_c/helpers.ml +++ b/src/passes/7-self_mini_c/helpers.ml @@ -32,8 +32,8 @@ let rec fold_expression : 'a folder -> 'a -> expression -> 'a result = fun f ini ok init' ) | E_literal _ -> ok init' - | E_constant (_, lst) -> ( - let%bind res = bind_fold_list self init' lst in + | E_constant (c) -> ( + let%bind res = bind_fold_list self init' c.arguments in ok res ) | E_closure af -> ( @@ -84,7 +84,7 @@ let rec fold_expression : 'a folder -> 'a -> expression -> 'a result = fun f ini let%bind res = self init' exp in ok res ) - | E_update (r, (_,e)) -> ( + | E_record_update (r, _, e) -> ( let%bind res = self init' r in let%bind res = self res e in ok res @@ -102,9 +102,9 @@ let rec map_expression : mapper -> expression -> expression result = fun f e -> | E_make_empty_big_map _ | E_make_empty_list _ | E_make_empty_set _ as em -> return em - | E_constant (name, lst) -> ( - let%bind lst' = bind_map_list self lst in - return @@ E_constant (name,lst') + | E_constant (c) -> ( + let%bind lst = bind_map_list self c.arguments in + return @@ E_constant {cons_name = c.cons_name; arguments = lst} ) | E_closure af -> ( let%bind body = self af.body in @@ -154,10 +154,10 @@ let rec map_expression : mapper -> expression -> expression result = fun f e -> let%bind exp' = self exp in return @@ E_assignment (s, lrl, exp') ) - | E_update (r, (l,e)) -> ( + | E_record_update (r, l, e) -> ( let%bind r = self r in let%bind e = self e in - return @@ E_update(r,(l,e)) + return @@ E_record_update(r, l, e) ) let map_sub_level_expression : mapper -> expression -> expression result = fun f e -> diff --git a/src/passes/7-self_mini_c/michelson_restrictions.ml b/src/passes/7-self_mini_c/michelson_restrictions.ml index 7f9e14169..80fe2cf73 100644 --- a/src/passes/7-self_mini_c/michelson_restrictions.ml +++ b/src/passes/7-self_mini_c/michelson_restrictions.ml @@ -19,7 +19,7 @@ let self_in_lambdas : expression -> expression result = | E_closure {binder=_ ; body} -> let%bind _self_in_lambdas = Helpers.map_expression (fun e -> match e.content with - | E_constant (C_SELF_ADDRESS, _) as c -> fail (bad_self_address c) + | E_constant {cons_name=C_SELF_ADDRESS; _} as c -> fail (bad_self_address c) | _ -> ok e) body in ok e diff --git a/src/passes/7-self_mini_c/self_mini_c.ml b/src/passes/7-self_mini_c/self_mini_c.ml index 4230effeb..9a334951a 100644 --- a/src/passes/7-self_mini_c/self_mini_c.ml +++ b/src/passes/7-self_mini_c/self_mini_c.ml @@ -15,7 +15,7 @@ let map_expression : (* true if the name names a pure constant -- i.e. if uses will be pure assuming arguments are pure *) -let is_pure_constant : constant -> bool = +let is_pure_constant : constant' -> bool = function | C_UNIT | C_CAR | C_CDR | C_PAIR @@ -64,10 +64,10 @@ let rec is_pure : expression -> bool = fun e -> | E_sequence (e1, e2) -> List.for_all is_pure [ e1 ; e2 ] - | E_constant (c, args) - -> is_pure_constant c && List.for_all is_pure args - | E_update (r, (_,e)) - -> is_pure r && is_pure e + | E_constant (c) + -> is_pure_constant c.cons_name && List.for_all is_pure c.arguments + | E_record_update (e, _,up) + -> is_pure e && is_pure up (* I'm not sure about these. Maybe can be tested better? *) | E_application _ @@ -79,6 +79,7 @@ let rec is_pure : expression -> bool = fun e -> is near... *) | E_while _ -> false + (* definitely not pure *) | E_assignment _ -> false @@ -111,14 +112,14 @@ let rec is_assigned : ignore_lambdas:bool -> expression_variable -> expression - match e.content with | E_assignment (x, _, e) -> it x || self e - | E_update (r, (_,e)) -> + | E_record_update (r, _, e) -> self r || self e | E_closure { binder; body } -> if ignore_lambdas then false else self_binder binder body - | E_constant (_, args) -> - selfs args + | E_constant (c) -> + selfs c.arguments | E_application (f, arg) -> selfs [ f ; arg ] | E_iterator (_, ((x, _), e1), e2) -> @@ -236,7 +237,7 @@ let beta : bool ref -> expression -> expression = else e (* also do CAR (PAIR x y) ↦ x, or CDR (PAIR x y) ↦ y, only if x and y are pure *) - | E_constant (C_CAR| C_CDR as const, [ { content = E_constant (C_PAIR, [ e1 ; e2 ]) ; type_value = _ } ]) -> + | E_constant {cons_name = C_CAR| C_CDR as const; arguments = [ { content = E_constant {cons_name = C_PAIR; arguments = [ e1 ; e2 ]} ; type_value = _ } ]} -> if is_pure e1 && is_pure e2 then (changed := true ; match const with diff --git a/src/passes/7-self_mini_c/subst.ml b/src/passes/7-self_mini_c/subst.ml index 9582c4a6f..0dd1b4f64 100644 --- a/src/passes/7-self_mini_c/subst.ml +++ b/src/passes/7-self_mini_c/subst.ml @@ -31,9 +31,9 @@ let rec replace : expression -> var_name -> var_name -> expression = let binder = replace_var binder in return @@ E_closure { binder ; body } | E_skip -> e - | E_constant (c, args) -> - let args = List.map replace args in - return @@ E_constant (c, args) + | E_constant (c) -> + let args = List.map replace c.arguments in + return @@ E_constant {cons_name = c.cons_name; arguments = args} | E_application (f, x) -> let (f, x) = Tuple.map2 replace (f, x) in return @@ E_application (f, x) @@ -94,10 +94,10 @@ let rec replace : expression -> var_name -> var_name -> expression = let v = replace_var v in let e = replace e in return @@ E_assignment (v, path, e) - | E_update (r, (p,e)) -> + | E_record_update (r, p, e) -> let r = replace r in let e = replace e in - return @@ E_update (r, (p,e)) + return @@ E_record_update (r, p, e) | E_while (cond, body) -> let cond = replace cond in let body = replace body in @@ -126,7 +126,7 @@ let rec subst_expression : body:expression -> x:var_name -> expr:expression -> e (* hack to avoid reimplementing subst_binder for 2-ary binder in E_if_cons: intuitively, we substitute in \hd tl. expr' as if it were \hd. \tl. expr *) let subst_binder2 y z expr' = - let dummy = T_base Base_unit in + let dummy = T_base TC_unit in let hack = { content = E_closure { binder = z ; body = expr' } ; type_value = dummy } in match subst_binder y hack with @@ -184,9 +184,9 @@ let rec subst_expression : body:expression -> x:var_name -> expr:expression -> e | E_make_empty_big_map _ | E_make_empty_list _ | E_make_empty_set _ as em -> return em - | E_constant (name, lst) -> ( - let lst' = List.map self lst in - return @@ E_constant (name,lst') + | E_constant (c) -> ( + let lst = List.map self c.arguments in + return @@ E_constant {cons_name = c.cons_name; arguments = lst } ) | E_application farg -> ( let farg' = Tuple.map2 self farg in @@ -209,14 +209,14 @@ let rec subst_expression : body:expression -> x:var_name -> expr:expression -> e if Var.equal s x then raise Bad_argument ; return @@ E_assignment (s, lrl, exp') ) - | E_update (r, (p,e)) -> ( + | E_record_update (r, p, e) -> ( let r' = self r in let e' = self e in - return @@ E_update(r', (p,e')) + return @@ E_record_update(r', p, e') ) let%expect_test _ = - let dummy_type = T_base Base_unit in + let dummy_type = T_base TC_unit in let wrap e = { content = e ; type_value = dummy_type } in let show_subst ~body ~x ~expr = diff --git a/src/passes/8-compiler/compiler_environment.ml b/src/passes/8-compiler/compiler_environment.ml index 96795d74e..06cc467de 100644 --- a/src/passes/8-compiler/compiler_environment.ml +++ b/src/passes/8-compiler/compiler_environment.ml @@ -10,7 +10,7 @@ let get : environment -> expression_variable -> michelson result = fun e s -> let error = let title () = "Environment.get" in let content () = Format.asprintf "%a in %a" - Stage_common.PP.name s + Var.pp s PP.environment e in error title content in generic_try error @@ diff --git a/src/passes/8-compiler/compiler_program.ml b/src/passes/8-compiler/compiler_program.ml index e4e91f921..a93b58299 100644 --- a/src/passes/8-compiler/compiler_program.ml +++ b/src/passes/8-compiler/compiler_program.ml @@ -27,7 +27,7 @@ end open Errors (* This does not makes sense to me *) -let get_operator : constant -> type_value -> expression list -> predicate result = fun s ty lst -> +let get_operator : constant' -> type_value -> expression list -> predicate result = fun s ty lst -> match Operators.Compiler.get_operators s with | Ok (x,_) -> ok x | Error _ -> ( @@ -114,7 +114,7 @@ let get_operator : constant -> type_value -> expression list -> predicate result i_drop ; (* drop the entrypoint... *) prim ~annot:[entry] ~children:[r_ty] I_CONTRACT ; ] - | x -> simple_fail (Format.asprintf "predicate \"%a\" doesn't exist" Stage_common.PP.constant x) + | x -> simple_fail (Format.asprintf "predicate \"%a\" doesn't exist" PP.constant x) ) let rec translate_value (v:value) ty : michelson result = match v with @@ -220,7 +220,7 @@ and translate_expression (expr:expression) (env:environment) : michelson result b' ; ] ) - | E_constant(str, lst) -> + | E_constant{cons_name=str;arguments= lst} -> let module L = Logger.Stateful() in let%bind pre_code = let aux code expr = @@ -249,7 +249,7 @@ and translate_expression (expr:expression) (env:environment) : michelson result pre_code ; f ; ] - | _ -> simple_fail (Format.asprintf "bad arity for %a" Stage_common.PP.constant str) + | _ -> simple_fail (Format.asprintf "bad arity for %a" PP.constant str) in let error = let title () = "error compiling constant" in @@ -347,7 +347,7 @@ and translate_expression (expr:expression) (env:environment) : michelson result ]) in return code ) - | E_iterator (name , (v , body) , expr) -> ( + | E_iterator (name,(v , body) , expr) -> ( let%bind expr' = translate_expression expr env in let%bind body' = translate_expression body (Environment.add v env) in match name with @@ -367,7 +367,7 @@ and translate_expression (expr:expression) (env:environment) : michelson result return code ) | s -> ( - let iter = Format.asprintf "iter %a" Stage_common.PP.constant s in + let iter = Format.asprintf "iter %a" PP.constant s in let error = error (thunk "bad iterator") (thunk iter) in fail error ) @@ -422,7 +422,7 @@ and translate_expression (expr:expression) (env:environment) : michelson result i_push_unit ; ] ) - | E_update (record, (path, expr)) -> ( + | E_record_update (record, path, expr) -> ( let%bind record' = translate_expression record env in let record_var = Var.fresh () in diff --git a/src/passes/8-compiler/compiler_program.mli b/src/passes/8-compiler/compiler_program.mli index 5573c3d9b..cd90fa199 100644 --- a/src/passes/8-compiler/compiler_program.mli +++ b/src/passes/8-compiler/compiler_program.mli @@ -14,7 +14,7 @@ type compiled_expression = { expr : michelson ; } -val get_operator : constant -> type_value -> expression list -> predicate result +val get_operator : constant' -> type_value -> expression list -> predicate result val translate_expression : expression -> environment -> michelson result val translate_function_body : anon_function -> environment_element list -> type_value -> michelson result val translate_value : value -> type_value -> michelson result diff --git a/src/passes/8-compiler/compiler_type.ml b/src/passes/8-compiler/compiler_type.ml index 5094bca67..3ff7691ae 100644 --- a/src/passes/8-compiler/compiler_type.ml +++ b/src/passes/8-compiler/compiler_type.ml @@ -15,7 +15,7 @@ module Ty = struct let tez_k = Mutez_key None let int_k = Int_key None let string_k = String_key None - let key_hash_k = Key_hash_key None + let _key_hash_k = Key_hash_key None let address_k = Address_key None let timestamp_k = Timestamp_key None let bytes_k = Bytes_key None @@ -57,24 +57,24 @@ module Ty = struct let not_comparable name () = error (thunk "not a comparable type") (fun () -> name) () let not_compilable_type name () = error (thunk "not a compilable type") (fun () -> name) () - let comparable_type_base : type_base -> ex_comparable_ty result = fun tb -> + let comparable_type_base : type_constant -> ex_comparable_ty result = fun tb -> let return x = ok @@ Ex_comparable_ty x in match tb with - | Base_unit -> fail (not_comparable "unit") - | Base_void -> fail (not_comparable "void") - | Base_bool -> fail (not_comparable "bool") - | Base_nat -> return nat_k - | Base_mutez -> return tez_k - | Base_int -> return int_k - | Base_string -> return string_k - | Base_address -> return address_k - | Base_timestamp -> return timestamp_k - | Base_bytes -> return bytes_k - | Base_operation -> fail (not_comparable "operation") - | Base_signature -> fail (not_comparable "signature") - | Base_key -> fail (not_comparable "key") - | Base_key_hash -> return key_hash_k - | Base_chain_id -> fail (not_comparable "chain_id") + | TC_unit -> fail (not_comparable "unit") + | TC_void -> fail (not_comparable "void") + | TC_bool -> fail (not_comparable "bool") + | TC_nat -> return nat_k + | TC_mutez -> return tez_k + | TC_int -> return int_k + | TC_string -> return string_k + | TC_address -> return address_k + | TC_timestamp -> return timestamp_k + | TC_bytes -> return bytes_k + | TC_operation -> fail (not_comparable "operation") + | TC_signature -> fail (not_comparable "signature") + | TC_key -> fail (not_comparable "key") + | TC_key_hash -> fail (not_comparable "key_hash") + | TC_chain_id -> fail (not_comparable "chain_id") let comparable_type : type_value -> ex_comparable_ty result = fun tv -> match tv with @@ -89,24 +89,24 @@ module Ty = struct | T_option _ -> fail (not_comparable "option") | T_contract _ -> fail (not_comparable "contract") - let base_type : type_base -> ex_ty result = fun b -> + let base_type : type_constant -> ex_ty result = fun b -> let return x = ok @@ Ex_ty x in match b with - | Base_unit -> return unit - | Base_void -> fail (not_compilable_type "void") - | Base_bool -> return bool - | Base_int -> return int - | Base_nat -> return nat - | Base_mutez -> return tez - | Base_string -> return string - | Base_address -> return address - | Base_timestamp -> return timestamp - | Base_bytes -> return bytes - | Base_operation -> return operation - | Base_signature -> return signature - | Base_key -> return key - | Base_key_hash -> return key_hash - | Base_chain_id -> return chain_id + | TC_unit -> return unit + | TC_void -> fail (not_compilable_type "void") + | TC_bool -> return bool + | TC_int -> return int + | TC_nat -> return nat + | TC_mutez -> return tez + | TC_string -> return string + | TC_address -> return address + | TC_timestamp -> return timestamp + | TC_bytes -> return bytes + | TC_operation -> return operation + | TC_signature -> return signature + | TC_key -> return key + | TC_key_hash -> return key_hash + | TC_chain_id -> return chain_id let rec type_ : type_value -> ex_ty result = function @@ -175,23 +175,23 @@ module Ty = struct end -let base_type : type_base -> O.michelson result = +let base_type : type_constant -> O.michelson result = function - | Base_unit -> ok @@ O.prim T_unit - | Base_void -> fail (Ty.not_compilable_type "void") - | Base_bool -> ok @@ O.prim T_bool - | Base_int -> ok @@ O.prim T_int - | Base_nat -> ok @@ O.prim T_nat - | Base_mutez -> ok @@ O.prim T_mutez - | Base_string -> ok @@ O.prim T_string - | Base_address -> ok @@ O.prim T_address - | Base_timestamp -> ok @@ O.prim T_timestamp - | Base_bytes -> ok @@ O.prim T_bytes - | Base_operation -> ok @@ O.prim T_operation - | Base_signature -> ok @@ O.prim T_signature - | Base_key -> ok @@ O.prim T_key - | Base_key_hash -> ok @@ O.prim T_key_hash - | Base_chain_id -> ok @@ O.prim T_chain_id + | TC_unit -> ok @@ O.prim T_unit + | TC_void -> fail (Ty.not_compilable_type "void") + | TC_bool -> ok @@ O.prim T_bool + | TC_int -> ok @@ O.prim T_int + | TC_nat -> ok @@ O.prim T_nat + | TC_mutez -> ok @@ O.prim T_mutez + | TC_string -> ok @@ O.prim T_string + | TC_address -> ok @@ O.prim T_address + | TC_timestamp -> ok @@ O.prim T_timestamp + | TC_bytes -> ok @@ O.prim T_bytes + | TC_operation -> ok @@ O.prim T_operation + | TC_signature -> ok @@ O.prim T_signature + | TC_key -> ok @@ O.prim T_key + | TC_key_hash -> ok @@ O.prim T_key_hash + | TC_chain_id -> ok @@ O.prim T_chain_id let rec type_ : type_value -> O.michelson result = function diff --git a/src/passes/operators/helpers.ml b/src/passes/operators/helpers.ml index 68bdb8f06..c8e993452 100644 --- a/src/passes/operators/helpers.ml +++ b/src/passes/operators/helpers.ml @@ -14,17 +14,17 @@ module Typer = struct let title () = "these types are not comparable" in let message () = "" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.type_value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.type_value b ) + ("a" , fun () -> Format.asprintf "%a" PP.type_expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.type_expression b ) ] in error ~data title message () end open Errors - type type_result = type_value - type typer = type_value list -> type_value option -> type_result result + type type_result = type_expression + type typer = type_expression list -> type_expression option -> type_result result - let typer_0 : string -> (type_value option -> type_value result) -> typer = fun s f lst tv_opt -> + let typer_0 : string -> (type_expression option -> type_expression result) -> typer = fun s f lst tv_opt -> match lst with | [] -> ( let%bind tv' = f tv_opt in @@ -32,7 +32,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 0 lst - let typer_1 : string -> (type_value -> type_value result) -> typer = fun s f lst _ -> + let typer_1 : string -> (type_expression -> type_expression result) -> typer = fun s f lst _ -> match lst with | [ a ] -> ( let%bind tv' = f a in @@ -40,7 +40,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 1 lst - let typer_1_opt : string -> (type_value -> type_value option -> type_value result) -> typer = fun s f lst tv_opt -> + let typer_1_opt : string -> (type_expression -> type_expression option -> type_expression result) -> typer = fun s f lst tv_opt -> match lst with | [ a ] -> ( let%bind tv' = f a tv_opt in @@ -48,7 +48,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 1 lst - let typer_2 : string -> (type_value -> type_value -> type_value result) -> typer = fun s f lst _ -> + let typer_2 : string -> (type_expression -> type_expression -> type_expression result) -> typer = fun s f lst _ -> match lst with | [ a ; b ] -> ( let%bind tv' = f a b in @@ -56,7 +56,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 2 lst - let typer_2_opt : string -> (type_value -> type_value -> type_value option -> type_value result) -> typer = fun s f lst tv_opt -> + let typer_2_opt : string -> (type_expression -> type_expression -> type_expression option -> type_expression result) -> typer = fun s f lst tv_opt -> match lst with | [ a ; b ] -> ( let%bind tv' = f a b tv_opt in @@ -64,7 +64,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 2 lst - let typer_3 : string -> (type_value -> type_value -> type_value -> type_value result) -> typer = fun s f lst _ -> + let typer_3 : string -> (type_expression -> type_expression -> type_expression -> type_expression result) -> typer = fun s f lst _ -> match lst with | [ a ; b ; c ] -> ( let%bind tv' = f a b c in @@ -72,7 +72,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 3 lst - let typer_4 : string -> (type_value -> type_value -> type_value -> type_value -> type_value result) -> typer = fun s f lst _ -> + let typer_4 : string -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer = fun s f lst _ -> match lst with | [ a ; b ; c ; d ] -> ( let%bind tv' = f a b c d in @@ -80,7 +80,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 4 lst - let typer_5 : string -> (type_value -> type_value -> type_value -> type_value -> type_value -> type_value result) -> typer = fun s f lst _ -> + let typer_5 : string -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer = fun s f lst _ -> match lst with | [ a ; b ; c ; d ; e ] -> ( let%bind tv' = f a b c d e in @@ -88,7 +88,7 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 5 lst - let typer_6 : string -> (type_value -> type_value -> type_value -> type_value -> type_value -> type_value -> type_value result) -> typer = fun s f lst _ -> + let typer_6 : string -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer = fun s f lst _ -> match lst with | [ a ; b ; c ; d ; e ; f_ ] -> ( let%bind tv' = f a b c d e f_ in @@ -96,12 +96,12 @@ module Typer = struct ) | _ -> fail @@ wrong_param_number s 6 lst - let constant name cst = typer_0 name (fun _ -> ok cst) + let constant' name cst = typer_0 name (fun _ -> ok cst) open Combinators - let eq_1 a cst = type_value_eq (a , cst) - let eq_2 (a , b) cst = type_value_eq (a , cst) && type_value_eq (b , cst) + let eq_1 a cst = type_expression_eq (a , cst) + let eq_2 (a , b) cst = type_expression_eq (a , cst) && type_expression_eq (b , cst) let assert_eq_1 ?msg a b = Assert.assert_true ?msg (eq_1 a b) @@ -125,11 +125,11 @@ module Typer = struct let%bind () = trace_strong (simple_error "A isn't of type bool") @@ Assert.assert_true @@ - type_value_eq (t_bool () , a) in + type_expression_eq (t_bool () , a) in let%bind () = trace_strong (simple_error "B isn't of type bool") @@ Assert.assert_true @@ - type_value_eq (t_bool () , b) in + type_expression_eq (t_bool () , b) in ok @@ t_bool () end diff --git a/src/passes/operators/helpers.mli b/src/passes/operators/helpers.mli index 4940d0038..005ad8d6c 100644 --- a/src/passes/operators/helpers.mli +++ b/src/passes/operators/helpers.mli @@ -4,51 +4,51 @@ module Typer : sig module Errors : sig val wrong_param_number : string -> int -> 'a list -> unit -> error - val error_uncomparable_types : type_value -> type_value -> unit -> error + val error_uncomparable_types : type_expression -> type_expression -> unit -> error end - type type_result = type_value - type typer = type_value list -> type_value option -> type_result result + type type_result = type_expression + type typer = type_expression list -> type_expression option -> type_result result (* - val typer'_0 : name -> (type_value option -> type_value result) -> typer' + val typer'_0 : name -> (type_expression option -> type_expression result) -> typer' *) - val typer_0 : string -> ( type_value option -> type_value result ) -> typer + val typer_0 : string -> ( type_expression option -> type_expression result ) -> typer (* - val typer'_1 : name -> (type_value -> type_value result) -> typer' + val typer'_1 : name -> (type_expression -> type_expression result) -> typer' *) - val typer_1 : string -> (type_value -> type_value result) -> typer + val typer_1 : string -> (type_expression -> type_expression result) -> typer (* - val typer'_1_opt : name -> (type_value -> type_value option -> type_value result) -> typer' + val typer'_1_opt : name -> (type_expression -> type_expression option -> type_expression result) -> typer' *) - val typer_1_opt : string -> (type_value -> type_value option -> type_value result) -> typer + val typer_1_opt : string -> (type_expression -> type_expression option -> type_expression result) -> typer (* - val typer'_2 : name -> (type_value -> type_value -> type_value result) -> typer' + val typer'_2 : name -> (type_expression -> type_expression -> type_expression result) -> typer' *) - val typer_2 : string -> (type_value -> type_value -> type_value result) -> typer - val typer_2_opt : string -> (type_value -> type_value -> type_value option -> type_value result) -> typer + val typer_2 : string -> (type_expression -> type_expression -> type_expression result) -> typer + val typer_2_opt : string -> (type_expression -> type_expression -> type_expression option -> type_expression result) -> typer (* - val typer'_3 : name -> (type_value -> type_value -> type_value -> type_value result) -> typer' + val typer'_3 : name -> (type_expression -> type_expression -> type_expression -> type_expression result) -> typer' *) - val typer_3 : string -> (type_value -> type_value -> type_value -> type_value result) -> typer + val typer_3 : string -> (type_expression -> type_expression -> type_expression -> type_expression result) -> typer (* - val typer'_4 : name -> (type_value -> type_value -> type_value -> type_value -> type_value result) -> typer' + val typer'_4 : name -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer' *) - val typer_4 : string -> (type_value -> type_value -> type_value -> type_value -> type_value result) -> typer + val typer_4 : string -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer (* - val typer'_5 : name -> (type_value -> type_value -> type_value -> type_value -> type_value -> type_value result) -> typer' + val typer'_5 : name -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer' *) - val typer_5 : string -> (type_value -> type_value -> type_value -> type_value -> type_value -> type_value result) -> typer + val typer_5 : string -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer (* - val typer'_6 : name -> (type_value -> type_value -> type_value -> type_value -> type_value -> type_value -> type_value result) -> typer' + val typer'_6 : name -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer' *) - val typer_6 : string -> (type_value -> type_value -> type_value -> type_value -> type_value -> type_value -> type_value result) -> typer + val typer_6 : string -> (type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression -> type_expression result) -> typer - val constant : string -> type_value -> typer + val constant' : string -> type_expression -> typer - val eq_1 : type_value -> type_value -> bool - val eq_2 : ( type_value * type_value ) -> type_value -> bool - val assert_eq_1 : ?msg:string -> type_value -> type_value -> unit result + val eq_1 : type_expression -> type_expression -> bool + val eq_2 : ( type_expression * type_expression ) -> type_expression -> bool + val assert_eq_1 : ?msg:string -> type_expression -> type_expression -> unit result val comparator : string -> typer val boolean_operator_2 : string -> typer diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index be1196ad1..7c3bd7318 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -272,8 +272,8 @@ module Typer = struct let type_error msg expected_type actual_type () = let message () = Format.asprintf "Expected an expression of type %a but got an expression of type %a" - Ast_typed.PP.type_value expected_type - Ast_typed.PP.type_value actual_type in + Ast_typed.PP.type_expression expected_type + Ast_typed.PP.type_expression actual_type in error (thunk msg) message open PP_helpers @@ -285,8 +285,8 @@ module Typer = struct let typeclass_error msg f expected_types actual_types () = let message () = Format.asprintf "Expected arguments with one of the following combinations of types: %a but got this combination instead: %a" - (list_sep (print_f_args f Ast_typed.PP.type_value) (const " or ")) expected_types - (print_f_args f Ast_typed.PP.type_value) actual_types in + (list_sep (print_f_args f Ast_typed.PP.type_expression) (const " or ")) expected_types + (print_f_args f Ast_typed.PP.type_expression) actual_types in error (thunk msg) message end (* @@ -328,6 +328,7 @@ module Typer = struct let tc_addargs a b c = tc [a;b;c] [ (*TODO…*) ] let t_none = forall "a" @@ fun a -> option a + let t_sub = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_subarg a b c] => tuple2 a b --> c (* TYPECLASS *) let t_some = forall "a" @@ fun a -> a --> option a let t_map_remove = forall2 "src" "dst" @@ fun src dst -> tuple2 src (map src dst) --> map src dst @@ -375,7 +376,7 @@ module Typer = struct let t_set_remove = forall "a" @@ fun a -> tuple2 a (set a) --> set a let t_not = tuple1 bool --> bool - let constant_type : constant -> Typesystem.Core.type_value result = function + let constant_type : constant' -> Typesystem.Core.type_value result = function | C_INT -> ok @@ t_int ; | C_UNIT -> ok @@ t_unit ; | C_NOW -> ok @@ t_now ; @@ -489,42 +490,42 @@ module Typer = struct let list_cons : typer = typer_2 "CONS" @@ fun hd tl -> let%bind tl' = get_t_list tl in - let%bind () = assert_type_value_eq (hd , tl') in + let%bind () = assert_type_expression_eq (hd , tl') in ok tl let map_remove : typer = typer_2 "MAP_REMOVE" @@ fun k m -> let%bind (src , _) = bind_map_or (get_t_map , get_t_big_map) m in - let%bind () = assert_type_value_eq (src , k) in + let%bind () = assert_type_expression_eq (src , k) in ok m let map_add : typer = typer_3 "MAP_ADD" @@ fun k v m -> let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in - let%bind () = assert_type_value_eq (src, k) in - let%bind () = assert_type_value_eq (dst, v) in + let%bind () = assert_type_expression_eq (src, k) in + let%bind () = assert_type_expression_eq (dst, v) in ok m let map_update : typer = typer_3 "MAP_UPDATE" @@ fun k v m -> let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in - let%bind () = assert_type_value_eq (src, k) in + let%bind () = assert_type_expression_eq (src, k) in let%bind v' = get_t_option v in - let%bind () = assert_type_value_eq (dst, v') in + let%bind () = assert_type_expression_eq (dst, v') in ok m let map_mem : typer = typer_2 "MAP_MEM" @@ fun k m -> let%bind (src, _dst) = bind_map_or (get_t_map , get_t_big_map) m in - let%bind () = assert_type_value_eq (src, k) in + let%bind () = assert_type_expression_eq (src, k) in ok @@ t_bool () let map_find : typer = typer_2 "MAP_FIND" @@ fun k m -> let%bind (src, dst) = trace_strong (simple_error "MAP_FIND: not map or bigmap") @@ bind_map_or (get_t_map , get_t_big_map) m in - let%bind () = assert_type_value_eq (src, k) in + let%bind () = assert_type_expression_eq (src, k) in ok @@ dst let map_find_opt : typer = typer_2 "MAP_FIND_OPT" @@ fun k m -> let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in - let%bind () = assert_type_value_eq (src, k) in + let%bind () = assert_type_expression_eq (src, k) in ok @@ t_option dst () let map_iter : typer = typer_2 "MAP_ITER" @@ fun f m -> @@ -601,17 +602,17 @@ module Typer = struct let%bind () = assert_t_bytes b in ok @@ t_bool () - let sender = constant "SENDER" @@ t_address () + let sender = constant' "SENDER" @@ t_address () - let source = constant "SOURCE" @@ t_address () + let source = constant' "SOURCE" @@ t_address () - let unit = constant "UNIT" @@ t_unit () + let unit = constant' "UNIT" @@ t_unit () - let amount = constant "AMOUNT" @@ t_mutez () + let amount = constant' "AMOUNT" @@ t_mutez () - let balance = constant "BALANCE" @@ t_mutez () + let balance = constant' "BALANCE" @@ t_mutez () - let chain_id = constant "CHAIN_ID" @@ t_chain_id () + let chain_id = constant' "CHAIN_ID" @@ t_chain_id () let address = typer_1 "ADDRESS" @@ fun contract -> let%bind () = assert_t_contract contract in @@ -624,12 +625,12 @@ module Typer = struct let%bind () = assert_t_key_hash key_hash in ok @@ t_contract (t_unit () ) () - let now = constant "NOW" @@ t_timestamp () + let now = constant' "NOW" @@ t_timestamp () let transaction = typer_3 "CALL" @@ fun param amount contract -> let%bind () = assert_t_mutez amount in let%bind contract_param = get_t_contract contract in - let%bind () = assert_type_value_eq (param , contract_param) in + let%bind () = assert_type_expression_eq (param , contract_param) in ok @@ t_operation () let originate = typer_6 "ORIGINATE" @@ fun manager delegate_opt spendable delegatable init_balance code -> @@ -646,8 +647,8 @@ module Typer = struct ok @@ (t_pair (t_operation ()) (t_address ()) ()) let get_contract = typer_1_opt "CONTRACT" @@ fun addr_tv tv_opt -> - if not (type_value_eq (addr_tv, t_address ())) - then fail @@ simple_error (Format.asprintf "get_contract expects an address, got %a" PP.type_value addr_tv) + if not (type_expression_eq (addr_tv, t_address ())) + then fail @@ simple_error (Format.asprintf "get_contract expects an address, got %a" PP.type_expression addr_tv) else let%bind tv = trace_option (simple_error "get_contract needs a type annotation") tv_opt in @@ -657,8 +658,8 @@ module Typer = struct ok @@ t_contract tv' () let get_contract_opt = typer_1_opt "CONTRACT OPT" @@ fun addr_tv tv_opt -> - if not (type_value_eq (addr_tv, t_address ())) - then fail @@ simple_error (Format.asprintf "get_contract_opt expects an address, got %a" PP.type_value addr_tv) + if not (type_expression_eq (addr_tv, t_address ())) + then fail @@ simple_error (Format.asprintf "get_contract_opt expects an address, got %a" PP.type_expression addr_tv) else let%bind tv = trace_option (simple_error "get_contract_opt needs a type annotation") tv_opt in @@ -671,11 +672,11 @@ module Typer = struct ok @@ t_option (t_contract tv' ()) () let get_entrypoint = typer_2_opt "CONTRACT_ENTRYPOINT" @@ fun entry_tv addr_tv tv_opt -> - if not (type_value_eq (entry_tv, t_string ())) - then fail @@ simple_error (Format.asprintf "get_entrypoint expects a string entrypoint label for first argument, got %a" PP.type_value entry_tv) + if not (type_expression_eq (entry_tv, t_string ())) + then fail @@ simple_error (Format.asprintf "get_entrypoint expects a string entrypoint label for first argument, got %a" PP.type_expression entry_tv) else - if not (type_value_eq (addr_tv, t_address ())) - then fail @@ simple_error (Format.asprintf "get_entrypoint expects an address for second argument, got %a" PP.type_value addr_tv) + if not (type_expression_eq (addr_tv, t_address ())) + then fail @@ simple_error (Format.asprintf "get_entrypoint expects an address for second argument, got %a" PP.type_expression addr_tv) else let%bind tv = trace_option (simple_error "get_entrypoint needs a type annotation") tv_opt in @@ -685,11 +686,11 @@ module Typer = struct ok @@ t_contract tv' () let get_entrypoint_opt = typer_2_opt "CONTRACT_ENTRYPOINT_OPT" @@ fun entry_tv addr_tv tv_opt -> - if not (type_value_eq (entry_tv, t_string ())) - then fail @@ simple_error (Format.asprintf "get_entrypoint_opt expects a string entrypoint label for first argument, got %a" PP.type_value entry_tv) + if not (type_expression_eq (entry_tv, t_string ())) + then fail @@ simple_error (Format.asprintf "get_entrypoint_opt expects a string entrypoint label for first argument, got %a" PP.type_expression entry_tv) else - if not (type_value_eq (addr_tv, t_address ())) - then fail @@ simple_error (Format.asprintf "get_entrypoint_opt expects an address for second argument, got %a" PP.type_value addr_tv) + if not (type_expression_eq (addr_tv, t_address ())) + then fail @@ simple_error (Format.asprintf "get_entrypoint_opt expects an address for second argument, got %a" PP.type_expression addr_tv) else let%bind tv = trace_option (simple_error "get_entrypoint_opt needs a type annotation") tv_opt in @@ -840,8 +841,8 @@ module Typer = struct let%bind (prec , cur) = get_t_pair arg in let%bind key = get_t_list lst in let msg = Format.asprintf "%a vs %a" - Ast_typed.PP.type_value key - Ast_typed.PP.type_value arg + PP.type_expression key + PP.type_expression arg in trace (simple_error ("bad list fold:" ^ msg)) @@ let%bind () = assert_eq_1 ~msg:"key cur" key cur in @@ -854,8 +855,8 @@ module Typer = struct let%bind (prec , cur) = get_t_pair arg in let%bind key = get_t_set lst in let msg = Format.asprintf "%a vs %a" - Ast_typed.PP.type_value key - Ast_typed.PP.type_value arg + PP.type_expression key + PP.type_expression arg in trace (simple_error ("bad set fold:" ^ msg)) @@ let%bind () = assert_eq_1 ~msg:"key cur" key cur in @@ -868,10 +869,10 @@ module Typer = struct let%bind (prec , cur) = get_t_pair arg in let%bind (key , value) = get_t_map map in let msg = Format.asprintf "%a vs %a" - Ast_typed.PP.type_value key - Ast_typed.PP.type_value arg + PP.type_expression key + PP.type_expression arg in - trace (simple_error ("bad list fold:" ^ msg)) @@ + trace (simple_error ("bad map fold:" ^ msg)) @@ let%bind () = assert_eq_1 ~msg:"key cur" (t_pair key value ()) cur in let%bind () = assert_eq_1 ~msg:"prec res" prec res in let%bind () = assert_eq_1 ~msg:"res init" res init in @@ -974,7 +975,7 @@ module Typer = struct let%bind elt = get_t_list tl in let%bind () = assert_eq_1 hd elt in ok tl - + let constant_typers c : typer result = match c with | C_INT -> ok @@ int ; | C_UNIT -> ok @@ unit ; @@ -1062,7 +1063,7 @@ module Typer = struct | C_SELF_ADDRESS -> ok @@ self_address; | C_IMPLICIT_ACCOUNT -> ok @@ implicit_account; | C_SET_DELEGATE -> ok @@ set_delegate ; - | _ -> simple_fail @@ Format.asprintf "Typer not implemented for consant %a" Stage_common.PP.constant c + | _ -> simple_fail @@ Format.asprintf "Typer not implemented for consant %a" PP.constant c @@ -1151,7 +1152,8 @@ module Compiler = struct | C_BYTES_PACK -> ok @@ simple_unary @@ prim I_PACK | C_CONCAT -> ok @@ simple_binary @@ prim I_CONCAT | C_CHAIN_ID -> ok @@ simple_constant @@ prim I_CHAIN_ID - | _ -> simple_fail @@ Format.asprintf "operator not implemented for %a" Stage_common.PP.constant c + | _ -> simple_fail @@ Format.asprintf "operator not implemented for %a" PP.constant c + (* diff --git a/src/passes/operators/operators.mli b/src/passes/operators/operators.mli index 3da294664..2adb00b5b 100644 --- a/src/passes/operators/operators.mli +++ b/src/passes/operators/operators.mli @@ -4,16 +4,15 @@ module Simplify : sig open Trace module Pascaligo : sig - val constants : string -> constant result + val constants : string -> constant' result val type_constants : string -> type_constant result - val type_operators : string -> type_expression type_operator result + val type_operators : string -> type_operator result end - module Cameligo : sig - val constants : string -> constant result + val constants : string -> constant' result val type_constants : string -> type_constant result - val type_operators : string -> type_expression type_operator result + val type_operators : string -> type_operator result end end @@ -94,7 +93,7 @@ module Typer : sig val t_set_add : Typesystem.Core.type_value val t_set_remove : Typesystem.Core.type_value val t_not : Typesystem.Core.type_value - val constant_type : constant -> Typesystem.Core.type_value Trace.result + val constant_type : constant' -> Typesystem.Core.type_value Trace.result end (* @@ -171,7 +170,7 @@ module Typer : sig val concat : typer *) val cons : typer - val constant_typers : constant -> typer result + val constant_typers : constant' -> typer result end @@ -191,7 +190,7 @@ module Compiler : sig | Tetrary of michelson | Pentary of michelson | Hexary of michelson - val get_operators : constant -> predicate result + val get_operators : constant' -> predicate result val simple_constant : t -> predicate val simple_unary : t -> predicate val simple_binary : t -> predicate diff --git a/src/stages/ast_simplified/PP.ml b/src/stages/ast_simplified/PP.ml index 92138a014..6a9b5b7d8 100644 --- a/src/stages/ast_simplified/PP.ml +++ b/src/stages/ast_simplified/PP.ml @@ -1,110 +1,93 @@ [@@@coverage exclude_file] open Types -open PP_helpers open Format +open PP_helpers + include Stage_common.PP +include Ast_PP_type(Ast_simplified_parameter) -let list_sep_d x ppf lst = match lst with - | [] -> () - | _ -> fprintf ppf " @[%a@] " (list_sep x (tag " ; ")) lst -let tuple_sep_d x ppf lst = match lst with - | [] -> () - | _ -> fprintf ppf " @[%a@] " (list_sep x (tag " , ")) lst +let expression_variable ppf (ev : expression_variable) : unit = + fprintf ppf "%a" Var.pp ev -let rec te' ppf (te : type_expression type_expression') : unit = - type_expression' type_expression ppf te -and type_expression ppf (te: type_expression) : unit = - te' ppf te.type_expression' +let rec expression ppf (e : expression) = + match e.expression_content with + | E_literal l -> + literal ppf l + | E_variable n -> + fprintf ppf "%a" expression_variable n + | E_application app -> + fprintf ppf "(%a)@(%a)" expression app.expr1 expression app.expr2 + | E_constructor c -> + fprintf ppf "%a(%a)" constructor c.constructor expression c.element + | E_constant c -> + fprintf ppf "%a(%a)" constant c.cons_name (list_sep_d expression) + c.arguments + | E_record m -> + fprintf ppf "record[%a]" (lmap_sep expression (const " , ")) m + | E_record_accessor ra -> + fprintf ppf "%a.%a" expression ra.expr label ra.label + | E_record_update {record; path; update} -> + fprintf ppf "{ %a with { %a = %a } }" expression record label path expression update + | E_map m -> + fprintf ppf "map[%a]" (list_sep_d assoc_expression) m + | E_big_map m -> + fprintf ppf "big_map[%a]" (list_sep_d assoc_expression) m + | E_list lst -> + fprintf ppf "list[%a]" (list_sep_d expression) lst + | E_set lst -> + fprintf ppf "set[%a]" (list_sep_d expression) lst + | E_look_up (ds, ind) -> + fprintf ppf "(%a)[%a]" expression ds expression ind + | E_lambda {binder; input_type; output_type; result} -> + fprintf ppf "lambda (%a:%a) : %a return %a" option_type_name binder + (PP_helpers.option type_expression) + input_type + (PP_helpers.option type_expression) + output_type expression result + | E_matching {matchee; cases; _} -> + fprintf ppf "match %a with %a" expression matchee (matching expression) + cases + | E_loop l -> + fprintf ppf "while %a do %a" expression l.condition expression l.body + | E_let_in { let_binder ; mut; rhs ; let_result; inline } -> + fprintf ppf "let %a%a = %a%a in %a" option_mut mut option_type_name let_binder expression rhs option_inline inline expression let_result + | E_skip -> + fprintf ppf "skip" + | E_ascription {anno_expr; type_annotation} -> + fprintf ppf "%a : %a" expression anno_expr type_expression + type_annotation -let rec expression ppf (e:expression) = match e.expression with - | E_literal l -> fprintf ppf "%a" literal l - | E_variable n -> fprintf ppf "%a" name n - | E_application (f, arg) -> fprintf ppf "(%a)@(%a)" expression f expression arg - | E_constructor (c, ae) -> fprintf ppf "%a(%a)" constructor c expression ae - | E_constant (b, lst) -> fprintf ppf "%a(%a)" constant b (list_sep_d expression) lst - | E_tuple lst -> fprintf ppf "(%a)" (tuple_sep_d expression) lst - | E_accessor (ae, p) -> fprintf ppf "%a.%a" expression ae access_path p - | E_record m -> fprintf ppf "{%a}" (lrecord_sep expression (const " , ")) m - | E_update {record; update=(path,expr)} -> fprintf ppf "%a with { %a = %a }" expression record Stage_common.PP.label path expression expr - | E_map m -> fprintf ppf "[%a]" (list_sep_d assoc_expression) m - | E_big_map m -> fprintf ppf "big_map[%a]" (list_sep_d assoc_expression) m - | E_list lst -> fprintf ppf "[%a]" (list_sep_d expression) lst - | E_set lst -> fprintf ppf "{%a}" (list_sep_d expression) lst - | E_look_up (ds, ind) -> fprintf ppf "(%a)[%a]" expression ds expression ind - | E_lambda {binder;input_type;output_type;result} -> - fprintf ppf "lambda (%a:%a) : %a return %a" - option_type_name binder - (PP_helpers.option type_expression) input_type (PP_helpers.option type_expression) output_type - expression result - | E_matching (ae, m) -> - fprintf ppf "match %a with %a" expression ae (matching expression) m - | E_sequence (a , b) -> - fprintf ppf "%a ; %a" - expression a - expression b - | E_loop (expr , body) -> - fprintf ppf "%a ; %a" - expression expr - expression body - | E_assign (n , path , expr) -> - fprintf ppf "%a.%a := %a" - name n - PP_helpers.(list_sep access (const ".")) path - expression expr - | E_let_in { binder ; rhs ; result; inline } -> - fprintf ppf "let %a = %a%a in %a" option_type_name binder expression rhs option_inline inline expression result - | E_skip -> fprintf ppf "skip" - | E_ascription (expr , ty) -> fprintf ppf "%a : %a" expression expr type_expression ty - -and option_type_name ppf ((n , ty_opt) : expression_variable * type_expression option) = +and option_type_name ppf + ((n, ty_opt) : expression_variable * type_expression option) = match ty_opt with - | None -> fprintf ppf "%a" name n - | Some ty -> fprintf ppf "%a : %a" name n type_expression ty + | None -> + fprintf ppf "%a" expression_variable n + | Some ty -> + fprintf ppf "%a : %a" expression_variable n type_expression ty -and option_inline ppf inline = - if inline then - fprintf ppf "[@inline]" - else - fprintf ppf "" +and assoc_expression ppf : expr * expr -> unit = + fun (a, b) -> fprintf ppf "%a -> %a" expression a expression b -and assoc_expression ppf : (expr * expr) -> unit = fun (a, b) -> - fprintf ppf "%a -> %a" expression a expression b +and single_record_patch ppf ((p, expr) : label * expr) = + fprintf ppf "%a <- %a" label p expression expr -and access ppf (a:access) = - match a with - | Access_tuple i -> fprintf ppf "%d" i - | Access_record l -> fprintf ppf "%s" l - -and access_path ppf (p:access_path) = - fprintf ppf "%a" (list_sep access (const ".")) p - -and type_annotation ppf (ta:type_expression option) = match ta with - | None -> fprintf ppf "" - | Some t -> type_expression ppf t - -and single_record_patch ppf ((p, expr) : string * expr) = - fprintf ppf "%s <- %a" p expression expr - -and single_tuple_patch ppf ((p, expr) : int * expr) = - fprintf ppf "%d <- %a" p expression expr - -and matching_variant_case : type a . (_ -> a -> unit) -> _ -> (constructor * expression_variable) * a -> unit = +and matching_variant_case : type a . (_ -> a -> unit) -> _ -> (constructor' * expression_variable) * a -> unit = fun f ppf ((c,n),a) -> - fprintf ppf "| %a %a -> %a" constructor c name n f a + fprintf ppf "| %a %a -> %a" constructor c expression_variable n f a -and matching : type a . (formatter -> a -> unit) -> formatter -> (a,unit) matching -> unit = +and matching : type a . (formatter -> a -> unit) -> formatter -> (a,unit) matching_content -> unit = fun f ppf m -> match m with | Match_tuple ((lst, b), _) -> - fprintf ppf "let (%a) = %a" (list_sep_d name) lst f b + fprintf ppf "let (%a) = %a" (list_sep_d expression_variable) lst f b | Match_variant (lst, _) -> fprintf ppf "%a" (list_sep (matching_variant_case f) (tag "@.")) lst | Match_bool {match_true ; match_false} -> fprintf ppf "| True -> %a @.| False -> %a" f match_true f match_false | Match_list {match_nil ; match_cons = (hd, tl, match_cons, _)} -> - fprintf ppf "| Nil -> %a @.| %a :: %a -> %a" f match_nil name hd name tl f match_cons + fprintf ppf "| Nil -> %a @.| %a :: %a -> %a" f match_nil expression_variable hd expression_variable tl f match_cons | Match_option {match_none ; match_some = (some, match_some, _)} -> - fprintf ppf "| None -> %a @.| Some %a -> %a" f match_none name some f match_some + fprintf ppf "| None -> %a @.| Some %a -> %a" f match_none expression_variable some f match_some (* Shows the type expected for the matched value *) and matching_type ppf m = match m with @@ -120,13 +103,30 @@ and matching_type ppf m = match m with fprintf ppf "option" and matching_variant_case_type ppf ((c,n),_a) = - fprintf ppf "| %a %a" constructor c name n + fprintf ppf "| %a %a" constructor c expression_variable n -let declaration ppf (d:declaration) = match d with - | Declaration_type (type_name , te) -> - fprintf ppf "type %a = %a" type_variable (type_name) type_expression te - | Declaration_constant (name , ty_opt , inline, expr) -> - fprintf ppf "const %a = %a%a" option_type_name (name , ty_opt) expression expr option_inline inline +and option_mut ppf mut = + if mut then + fprintf ppf "[@mut]" + else + fprintf ppf "" -let program ppf (p:program) = - fprintf ppf "@[%a@]" (list_sep declaration (tag "@;")) (List.map Location.unwrap p) +and option_inline ppf inline = + if inline then + fprintf ppf "[@inline]" + else + fprintf ppf "" + +let declaration ppf (d : declaration) = + match d with + | Declaration_type (type_name, te) -> + fprintf ppf "type %a = %a" type_variable type_name type_expression te + | Declaration_constant (name, ty_opt, i, expr) -> + fprintf ppf "const %a = %a%a" option_type_name (name, ty_opt) expression + expr + option_inline i + +let program ppf (p : program) = + fprintf ppf "@[%a@]" + (list_sep declaration (tag "@;")) + (List.map Location.unwrap p) diff --git a/src/stages/ast_simplified/PP.mli b/src/stages/ast_simplified/PP.mli deleted file mode 100644 index afa18bb0c..000000000 --- a/src/stages/ast_simplified/PP.mli +++ /dev/null @@ -1,47 +0,0 @@ -(** Pretty printer for the Simplified Abstract Syntax Tree *) - -open Types -open Format - -(* -val list_sep_d : (formatter -> 'a -> unit) -> formatter -> 'a list -> unit - -val smap_sep_d : (formatter -> 'a -> unit) -> formatter -> 'a Map.String.t -> unit - -*) -val type_expression : formatter -> type_expression -> unit - -val literal : formatter -> literal -> unit - -val expression : formatter -> expression -> unit -(* -val option_type_name : formatter -> string * type_expression option -> unit -val assoc_expression : formatter -> (expr * expr) -> unit - -val access : formatter -> access -> unit - -val access_path : formatter -> access_path -> unit -*) - -val type_annotation : formatter -> type_expression option -> unit -val single_record_patch : formatter -> string * expr -> unit - -val single_tuple_patch : formatter -> int * expr -> unit -(* - -val matching_variant_case : (formatter -> 'a -> unit) -> formatter -> (constructor_name * name) * 'a -> unit - -val matching : (formatter -> 'a -> unit) -> formatter -> 'a matching -> unit -*) - -(** Shows the type expected for the matched value *) -val matching_type : formatter -> ('a, 'var) matching -> unit - -(* -val matching_variant_case_type : formatter -> ( ( constructor_name * name) * 'a) -> unit - -val declaration : formatter -> declaration -> unit - -*) -(** Pretty print a full program AST *) -val program : formatter -> program -> unit diff --git a/src/stages/ast_simplified/ast_simplified.ml b/src/stages/ast_simplified/ast_simplified.ml index f2eca5152..e9614490a 100644 --- a/src/stages/ast_simplified/ast_simplified.ml +++ b/src/stages/ast_simplified/ast_simplified.ml @@ -1,8 +1,8 @@ include Types + (* include Misc *) include Combinators - module Types = Types module Misc = Misc -module PP = PP +module PP=PP module Combinators = Combinators diff --git a/src/stages/ast_simplified/combinators.ml b/src/stages/ast_simplified/combinators.ml index 2a3e0ab33..7a5b2cf08 100644 --- a/src/stages/ast_simplified/combinators.ml +++ b/src/stages/ast_simplified/combinators.ml @@ -13,13 +13,19 @@ module Errors = struct ] in error ~data title message let bad_type_operator type_op = - let title () = Format.asprintf "bad type operator %a" (Stage_common.PP.type_operator PP.type_expression) type_op in + let title () = Format.asprintf "bad type operator %a" (PP.type_operator PP.type_expression) type_op in let message () = "" in error title message end open Errors -let make_t type_expression' = {type_expression'} +let make_t type_content = {type_content; type_meta = ()} + + +let tuple_to_record lst = + let aux (i,acc) el = (i+1,(string_of_int i, el)::acc) in + let (_, lst ) = List.fold_left aux (0,[]) lst in + lst let t_bool : type_expression = make_t @@ T_constant (TC_bool) let t_string : type_expression = make_t @@ T_constant (TC_string) @@ -36,8 +42,6 @@ let t_key_hash : type_expression = make_t @@ T_constant (TC_key_hash) let t_option o : type_expression = make_t @@ T_operator (TC_option o) let t_list t : type_expression = make_t @@ T_operator (TC_list t) let t_variable n : type_expression = make_t @@ T_variable (Var.of_name n) -let t_tuple lst : type_expression = make_t @@ T_operator (TC_tuple lst) -let t_pair (a , b) : type_expression = t_tuple [a ; b] let t_record_ez lst = let lst = List.map (fun (k, v) -> (Label k, v)) lst in let m = LMap.of_list lst in @@ -46,6 +50,9 @@ let t_record m : type_expression = let lst = Map.String.to_kv_list m in t_record_ez lst +let t_pair (a , b) : type_expression = t_record_ez [("0",a) ; ("1",b)] +let t_tuple lst : type_expression = t_record_ez (tuple_to_record lst) + let ez_t_sum (lst:(string * type_expression) list) : type_expression = let aux prev (k, v) = CMap.add (Constructor k) v prev in let map = List.fold_left aux CMap.empty lst in @@ -54,7 +61,7 @@ let t_sum m : type_expression = let lst = Map.String.to_kv_list m in ez_t_sum lst -let t_function param result : type_expression = make_t @@ T_arrow (param, result) +let t_function type1 type2 : type_expression = make_t @@ T_arrow {type1; type2} let t_map key value : type_expression = make_t @@ T_operator (TC_map (key, value)) let t_big_map key value : type_expression = make_t @@ T_operator (TC_big_map (key , value)) let t_set key : type_expression = make_t @@ T_operator (TC_set key) @@ -71,9 +78,9 @@ let t_operator op lst: type_expression result = | TC_contract _ , [t] -> ok @@ t_contract t | _ , _ -> fail @@ bad_type_operator op -let location_wrap ?(loc = Location.generated) expression = +let location_wrap ?(loc = Location.generated) expression_content = let location = loc in - { location ; expression } + { expression_content; location } let e_var ?loc (n: string) : expression = location_wrap ?loc @@ E_variable (Var.of_name n) let e_literal ?loc l : expression = location_wrap ?loc @@ E_literal l @@ -89,7 +96,7 @@ let e_signature ?loc s : expression = location_wrap ?loc @@ E_literal (Literal_s let e_key ?loc s : expression = location_wrap ?loc @@ E_literal (Literal_key s) let e_key_hash ?loc s : expression = location_wrap ?loc @@ E_literal (Literal_key_hash s) let e_chain_id ?loc s : expression = location_wrap ?loc @@ E_literal (Literal_chain_id s) -let e'_bytes b : expression' result = +let e'_bytes b : expression_content result = let%bind bytes = generic_try (simple_error "bad hex to bytes") (fun () -> Hex.to_bytes (`Hex b)) in ok @@ E_literal (Literal_bytes bytes) let e_bytes_hex ?loc b : expression result = @@ -100,37 +107,51 @@ let e_bytes_raw ?loc (b: bytes) : expression = let e_bytes_string ?loc (s: string) : expression = location_wrap ?loc @@ E_literal (Literal_bytes (Hex.to_bytes (Hex.of_string s))) let e_big_map ?loc lst : expression = location_wrap ?loc @@ E_big_map lst -let e_record ?loc map : expression = location_wrap ?loc @@ E_record map -let e_tuple ?loc lst : expression = location_wrap ?loc @@ E_tuple lst -let e_some ?loc s : expression = location_wrap ?loc @@ E_constant (C_SOME, [s]) -let e_none ?loc () : expression = location_wrap ?loc @@ E_constant (C_NONE, []) -let e_string_cat ?loc sl sr : expression = location_wrap ?loc @@ E_constant (C_CONCAT, [sl ; sr ]) -let e_map_add ?loc k v old : expression = location_wrap ?loc @@ E_constant (C_MAP_ADD, [k ; v ; old]) +let e_some ?loc s : expression = location_wrap ?loc @@ E_constant {cons_name = C_SOME; arguments = [s]} +let e_none ?loc () : expression = location_wrap ?loc @@ E_constant {cons_name = C_NONE; arguments = []} +let e_string_cat ?loc sl sr : expression = location_wrap ?loc @@ E_constant {cons_name = C_CONCAT; arguments = [sl ; sr ]} +let e_map_add ?loc k v old : expression = location_wrap ?loc @@ E_constant {cons_name = C_MAP_ADD; arguments = [k ; v ; old]} let e_map ?loc lst : expression = location_wrap ?loc @@ E_map lst let e_set ?loc lst : expression = location_wrap ?loc @@ E_set lst let e_list ?loc lst : expression = location_wrap ?loc @@ E_list lst -let e_pair ?loc a b : expression = location_wrap ?loc @@ E_tuple [a; b] -let e_constructor ?loc s a : expression = location_wrap ?loc @@ E_constructor (Constructor s , a) -let e_matching ?loc a b : expression = location_wrap ?loc @@ E_matching (a , b) +let e_constructor ?loc s a : expression = location_wrap ?loc @@ E_constructor { constructor = Constructor s; element = a} +let e_matching ?loc a b : expression = location_wrap ?loc @@ E_matching {matchee=a;cases=b} let e_matching_bool ?loc a b c : expression = e_matching ?loc a (Match_bool {match_true = b ; match_false = c}) -let e_accessor ?loc a b = location_wrap ?loc @@ E_accessor (a , b) -let e_accessor_props ?loc a b = e_accessor ?loc a (List.map (fun x -> Access_record x) b) +let e_accessor ?loc a b = location_wrap ?loc @@ E_record_accessor {expr = a; label= Label b} +let e_accessor_list ?loc a b = List.fold_left (fun a b -> e_accessor ?loc a b) a b let e_variable ?loc v = location_wrap ?loc @@ E_variable v let e_skip ?loc () = location_wrap ?loc @@ E_skip -let e_loop ?loc cond body = location_wrap ?loc @@ E_loop (cond , body) -let e_sequence ?loc a b = location_wrap ?loc @@ E_sequence (a , b) -let e_let_in ?loc (binder, ascr) inline rhs result = location_wrap ?loc @@ E_let_in { binder = (binder, ascr) ; rhs ; result ; inline } -let e_annotation ?loc expr ty = location_wrap ?loc @@ E_ascription (expr , ty) -let e_application ?loc a b = location_wrap ?loc @@ E_application (a , b) -let e_binop ?loc name a b = location_wrap ?loc @@ E_constant (name , [a ; b]) -let e_constant ?loc name lst = location_wrap ?loc @@ E_constant (name , lst) +let e_loop ?loc condition body = location_wrap ?loc @@ E_loop {condition; body} +let e_let_in ?loc (binder, ascr) mut inline rhs let_result = + location_wrap ?loc @@ E_let_in { let_binder = (binder, ascr) ; mut; rhs ; let_result; inline } +let e_annotation ?loc anno_expr ty = location_wrap ?loc @@ E_ascription {anno_expr; type_annotation = ty} +let e_application ?loc a b = location_wrap ?loc @@ E_application {expr1=a ; expr2=b} +let e_binop ?loc name a b = location_wrap ?loc @@ E_constant {cons_name = name ; arguments = [a ; b]} +let e_constant ?loc name lst = location_wrap ?loc @@ E_constant {cons_name=name ; arguments = lst} let e_look_up ?loc x y = location_wrap ?loc @@ E_look_up (x , y) -let e_assign ?loc a b c = location_wrap ?loc @@ E_assign (Var.of_name a , b , c) +let e_sequence ?loc expr1 expr2 = e_let_in ?loc (Var.fresh (), Some t_unit) false false expr1 expr2 +let e_cond ?loc expr match_true match_false = e_matching expr ?loc (Match_bool {match_true; match_false}) +(* +let e_assign ?loc a b c = location_wrap ?loc @@ E_assign (Var.of_name a , b , c) (* TODO handlethat*) +*) let ez_match_variant (lst : ((string * string) * 'a) list) = let lst = List.map (fun ((c,n),a) -> ((Constructor c, Var.of_name n), a) ) lst in Match_variant (lst,()) let e_matching_variant ?loc a (lst : ((string * string)* 'a) list) = e_matching ?loc a (ez_match_variant lst) +let e_record_ez ?loc (lst : (string * expr) list) : expression = + let map = List.fold_left (fun m (x, y) -> LMap.add (Label x) y m) LMap.empty lst in + location_wrap ?loc @@ E_record map +let e_record ?loc map = + let lst = Map.String.to_kv_list map in + e_record_ez ?loc lst + +let e_update ?loc record path update = + let path = Label path in + location_wrap ?loc @@ E_record_update {record; path; update} + +let e_tuple ?loc lst : expression = e_record_ez ?loc (tuple_to_record lst) +let e_pair ?loc a b : expression = e_tuple ?loc [a;b] let make_option_typed ?loc e t_opt = match t_opt with @@ -138,12 +159,6 @@ let make_option_typed ?loc e t_opt = | Some t -> e_annotation ?loc e t -let ez_e_record ?loc (lst : (string * expr) list) = - let aux prev (k, v) = LMap.add k v prev in - let lst = List.map (fun (k,v) -> (Label k, v)) lst in - let map = List.fold_left aux LMap.empty lst in - e_record ?loc map - let e_typed_none ?loc t_opt = let type_annotation = t_option t_opt in e_annotation ?loc (e_none ?loc ()) type_annotation @@ -156,6 +171,7 @@ let e_typed_big_map ?loc lst k v = e_annotation ?loc (e_big_map lst) (t_big_map let e_typed_set ?loc lst k = e_annotation ?loc (e_set lst) (t_set k) + let e_lambda ?loc (binder : expression_variable) (input_type : type_expression option) (output_type : type_expression option) @@ -168,34 +184,41 @@ let e_lambda ?loc (binder : expression_variable) result ; } -let e_ez_record ?loc (lst : (string * expr) list) : expression = - let map = List.fold_left (fun m (x, y) -> LMap.add (Label x) y m) LMap.empty lst in - location_wrap ?loc @@ E_record map -let e_record ?loc map = - let lst = Map.String.to_kv_list map in - e_ez_record ?loc lst -let e_update ?loc record path expr = - let update = (Label path, expr) in - location_wrap ?loc @@ E_update {record; update} +let e_assign_with_let ?loc var access_path expr = + let var = Var.of_name (var) in + match access_path with + | [] -> (var, None), true, expr, false + + | lst -> + let rec aux path record= match path with + | [] -> failwith "acces_path cannot be empty" + | [e] -> e_update ?loc record e expr + | elem::tail -> + let next_record = e_accessor record elem in + e_update ?loc record elem (aux tail next_record ) + in + (var, None), true, (aux lst (e_variable var)), false let get_e_accessor = fun t -> match t with - | E_accessor (a , b) -> ok (a , b) + | E_record_accessor {expr; label} -> ok (expr , label) | _ -> simple_fail "not an accessor" let assert_e_accessor = fun t -> let%bind _ = get_e_accessor t in ok () -let get_access_record : access -> string result = fun a -> - match a with - | Access_tuple _ -> simple_fail "not an access record" - | Access_record s -> ok s - let get_e_pair = fun t -> match t with - | E_tuple [a ; b] -> ok (a , b) + | E_record r -> ( + let lst = LMap.to_kv_list r in + match lst with + | [(Label "O",a);(Label "1",b)] + | [(Label "1",b);(Label "0",a)] -> + ok (a , b) + | _ -> simple_fail "not a pair" + ) | _ -> simple_fail "not a pair" let get_e_list = fun t -> @@ -203,27 +226,42 @@ let get_e_list = fun t -> | E_list lst -> ok lst | _ -> simple_fail "not a list" +let tuple_of_record (m: _ LMap.t) = + let aux i = + let opt = LMap.find_opt (Label (string_of_int i)) m in + Option.bind (fun opt -> Some (opt,i+1)) opt + in + Base.Sequence.to_list @@ Base.Sequence.unfold ~init:0 ~f:aux + let get_e_tuple = fun t -> match t with - | E_tuple lst -> ok lst + | E_record r -> ok @@ tuple_of_record r | _ -> simple_fail "ast_simplified: get_e_tuple: not a tuple" +(* Same as get_e_pair *) let extract_pair : expression -> (expression * expression) result = fun e -> - match e.expression with - | E_tuple [ a ; b ] -> ok (a , b) + match e.expression_content with + | E_record r -> ( + let lst = LMap.to_kv_list r in + match lst with + | [(Label "O",a);(Label "1",b)] + | [(Label "1",b);(Label "0",a)] -> + ok (a , b) + | _ -> fail @@ bad_kind "pair" e.location + ) | _ -> fail @@ bad_kind "pair" e.location let extract_list : expression -> (expression list) result = fun e -> - match e.expression with + match e.expression_content with | E_list lst -> ok lst | _ -> fail @@ bad_kind "list" e.location let extract_record : expression -> (label * expression) list result = fun e -> - match e.expression with + match e.expression_content with | E_record lst -> ok @@ LMap.to_kv_list lst | _ -> fail @@ bad_kind "record" e.location let extract_map : expression -> (expression * expression) list result = fun e -> - match e.expression with + match e.expression_content with | E_map lst -> ok lst | _ -> fail @@ bad_kind "map" e.location diff --git a/src/stages/ast_simplified/combinators.mli b/src/stages/ast_simplified/combinators.mli index d8349e0a2..9f47482ba 100644 --- a/src/stages/ast_simplified/combinators.mli +++ b/src/stages/ast_simplified/combinators.mli @@ -9,7 +9,7 @@ module Errors : sig val bad_kind : name -> Location.t -> unit -> error end *) -val make_t : type_expression type_expression' -> type_expression +val make_t : type_content -> type_expression val t_bool : type_expression val t_string : type_expression val t_bytes : type_expression @@ -27,11 +27,11 @@ val t_option : type_expression -> type_expression *) val t_list : type_expression -> type_expression val t_variable : string -> type_expression -val t_tuple : type_expression list -> type_expression (* val t_record : te_map -> type_expression *) val t_pair : ( type_expression * type_expression ) -> type_expression +val t_tuple : type_expression list -> type_expression val t_record : type_expression Map.String.t -> type_expression val t_record_ez : (string * type_expression) list -> type_expression @@ -42,7 +42,7 @@ val ez_t_sum : ( string * type_expression ) list -> type_expression val t_function : type_expression -> type_expression -> type_expression val t_map : type_expression -> type_expression -> type_expression -val t_operator : type_expression type_operator -> type_expression list -> type_expression result +val t_operator : type_operator -> type_expression list -> type_expression result val t_set : type_expression -> type_expression val e_var : ?loc:Location.t -> string -> expression @@ -59,14 +59,13 @@ val e_key : ?loc:Location.t -> string -> expression val e_key_hash : ?loc:Location.t -> string -> expression val e_chain_id : ?loc:Location.t -> string -> expression val e_mutez : ?loc:Location.t -> int -> expression -val e'_bytes : string -> expression' result +val e'_bytes : string -> expression_content result val e_bytes_hex : ?loc:Location.t -> string -> expression result val e_bytes_raw : ?loc:Location.t -> bytes -> expression val e_bytes_string : ?loc:Location.t -> string -> expression val e_big_map : ?loc:Location.t -> ( expr * expr ) list -> expression -(* -val e_record : ?loc:Location.t -> ( expr * expr ) list -> expression -*) + +val e_record_ez : ?loc:Location.t -> ( string * expr ) list -> expression val e_tuple : ?loc:Location.t -> expression list -> expression val e_some : ?loc:Location.t -> expression -> expression val e_none : ?loc:Location.t -> unit -> expression @@ -79,24 +78,23 @@ val e_pair : ?loc:Location.t -> expression -> expression -> expression val e_constructor : ?loc:Location.t -> string -> expression -> expression val e_matching : ?loc:Location.t -> expression -> matching_expr -> expression val e_matching_bool : ?loc:Location.t -> expression -> expression -> expression -> expression -val e_accessor : ?loc:Location.t -> expression -> access_path -> expression -val e_accessor_props : ?loc:Location.t -> expression -> string list -> expression +val e_accessor : ?loc:Location.t -> expression -> string -> expression +val e_accessor_list : ?loc:Location.t -> expression -> string list -> expression val e_variable : ?loc:Location.t -> expression_variable -> expression val e_skip : ?loc:Location.t -> unit -> expression val e_loop : ?loc:Location.t -> expression -> expression -> expression val e_sequence : ?loc:Location.t -> expression -> expression -> expression -val e_let_in : ?loc:Location.t -> ( expression_variable * type_expression option ) -> inline -> expression -> expression -> expression +val e_cond: ?loc:Location.t -> expression -> expression -> expression -> expression +val e_let_in : ?loc:Location.t -> ( expression_variable * type_expression option ) -> bool -> bool -> expression -> expression -> expression val e_annotation : ?loc:Location.t -> expression -> type_expression -> expression val e_application : ?loc:Location.t -> expression -> expression -> expression -val e_binop : ?loc:Location.t -> constant -> expression -> expression -> expression -val e_constant : ?loc:Location.t -> constant -> expression list -> expression +val e_binop : ?loc:Location.t -> constant' -> expression -> expression -> expression +val e_constant : ?loc:Location.t -> constant' -> expression list -> expression val e_look_up : ?loc:Location.t -> expression -> expression -> expression -val e_assign : ?loc:Location.t -> string -> access_path -> expression -> expression -val ez_match_variant : ((string * string ) * 'a ) list -> ('a,unit) matching +val ez_match_variant : ((string * string ) * 'a ) list -> ('a,unit) matching_content val e_matching_variant : ?loc:Location.t -> expression -> ((string * string) * expression) list -> expression val make_option_typed : ?loc:Location.t -> expression -> type_expression option -> expression -val ez_e_record : ?loc:Location.t -> ( string * expression ) list -> expression val e_typed_none : ?loc:Location.t -> type_expression -> expression @@ -110,20 +108,18 @@ val e_typed_set : ?loc:Location.t -> expression list -> type_expression -> expre val e_lambda : ?loc:Location.t -> expression_variable -> type_expression option -> type_expression option -> expression -> expression val e_record : ?loc:Location.t -> expr Map.String.t -> expression val e_update : ?loc:Location.t -> expression -> string -> expression -> expression +val e_assign_with_let : ?loc:Location.t -> string -> string list -> expression -> ((expression_variable*type_expression option)*bool*expression*bool) -val e_ez_record : ?loc:Location.t -> ( string * expr ) list -> expression (* val get_e_accessor : expression' -> ( expression * access_path ) result *) -val assert_e_accessor : expression' -> unit result +val assert_e_accessor : expression_content -> unit result -val get_access_record : access -> string result +val get_e_pair : expression_content -> ( expression * expression ) result -val get_e_pair : expression' -> ( expression * expression ) result - -val get_e_list : expression' -> ( expression list ) result -val get_e_tuple : expression' -> ( expression list ) result +val get_e_list : expression_content -> ( expression list ) result +val get_e_tuple : expression_content -> ( expression list ) result (* val get_e_failwith : expression -> expression result val is_e_failwith : expression -> bool diff --git a/src/stages/ast_simplified/misc.ml b/src/stages/ast_simplified/misc.ml index bc214863a..31cccf719 100644 --- a/src/stages/ast_simplified/misc.ml +++ b/src/stages/ast_simplified/misc.ml @@ -1,8 +1,7 @@ open Trace open Types -include Stage_common.Misc - +open Stage_common.Helpers module Errors = struct let different_literals_because_different_types name a b () = let title () = "literals have different types: " ^ name in @@ -56,6 +55,8 @@ let assert_literal_eq (a, b : literal * literal) : unit result = | Literal_bytes a, Literal_bytes b when a = b -> ok () | Literal_bytes _, Literal_bytes _ -> fail @@ different_literals "different bytess" a b | Literal_bytes _, _ -> fail @@ different_literals_because_different_types "bytes vs non-bytes" a b + | Literal_void, Literal_void -> ok () + | Literal_void, _ -> fail @@ different_literals_because_different_types "void vs non-void" a b | Literal_unit, Literal_unit -> ok () | Literal_unit, _ -> fail @@ different_literals_because_different_types "unit vs non-unit" a b | Literal_address a, Literal_address b when a = b -> ok () @@ -77,19 +78,20 @@ let assert_literal_eq (a, b : literal * literal) : unit result = | Literal_chain_id _, _ -> fail @@ different_literals_because_different_types "chain_id vs non-chain_id" a b let rec assert_value_eq (a, b: (expression * expression )) : unit result = + Format.printf "in assert_value_eq %a %a\n%!" PP.expression a PP.expression b; let error_content () = Format.asprintf "\n@[- %a@;- %a]" PP.expression a PP.expression b in trace (fun () -> error (thunk "not equal") error_content ()) @@ - match (a.expression , b.expression) with + match (a.expression_content , b.expression_content) with | E_literal a , E_literal b -> assert_literal_eq (a, b) | E_literal _ , _ -> simple_fail "comparing a literal with not a literal" - | E_constant (ca, lsta) , E_constant (cb, lstb) when ca = cb -> ( + | E_constant (ca) , E_constant (cb) when ca.cons_name = cb.cons_name -> ( let%bind lst = generic_try (simple_error "constants with different number of elements") - (fun () -> List.combine lsta lstb) in + (fun () -> List.combine ca.arguments cb.arguments) in let%bind _all = bind_list @@ List.map assert_value_eq lst in ok () ) @@ -103,8 +105,8 @@ let rec assert_value_eq (a, b: (expression * expression )) : unit result = in fail @@ (fun () -> error (thunk "comparing constant with other expression") error_content ()) - | E_constructor (ca, a), E_constructor (cb, b) when ca = cb -> ( - let%bind _eq = assert_value_eq (a, b) in + | E_constructor (ca), E_constructor (cb) when ca.constructor = cb.constructor -> ( + let%bind _eq = assert_value_eq (ca.element, cb.element) in ok () ) | E_constructor _, E_constructor _ -> @@ -112,15 +114,6 @@ let rec assert_value_eq (a, b: (expression * expression )) : unit result = | E_constructor _, _ -> simple_fail "comparing constructor with other expression" - | E_tuple lsta, E_tuple lstb -> ( - let%bind lst = - generic_try (simple_error "tuples with different number of elements") - (fun () -> List.combine lsta lstb) in - let%bind _all = bind_list @@ List.map assert_value_eq lst in - ok () - ) - | E_tuple _, _ -> - simple_fail "comparing tuple with other expression" | E_record sma, E_record smb -> ( let aux _ a b = @@ -134,17 +127,17 @@ let rec assert_value_eq (a, b: (expression * expression )) : unit result = | E_record _, _ -> simple_fail "comparing record with other expression" - | E_update ura, E_update urb -> + | E_record_update ura, E_record_update urb -> let _ = generic_try (simple_error "Updating different record") @@ fun () -> assert_value_eq (ura.record, urb.record) in - let aux ((Label a,expra),(Label b, exprb))= - assert (String.equal a b); - assert_value_eq (expra,exprb) + let aux (Label a,Label b) = + assert (String.equal a b) in - let%bind _all = aux (ura.update, urb.update) in + let () = aux (ura.path, urb.path) in + let%bind () = assert_value_eq (ura.update,urb.update) in ok () - | E_update _, _ -> + | E_record_update _, _ -> simple_fail "comparing record update with other expression" | (E_map lsta, E_map lstb | E_big_map lsta, E_big_map lstb) -> ( @@ -185,13 +178,13 @@ let rec assert_value_eq (a, b: (expression * expression )) : unit result = | E_set _, _ -> simple_fail "comparing set with other expression" - | (E_ascription (a , _) , _b') -> assert_value_eq (a , b) - | (_a' , E_ascription (b , _)) -> assert_value_eq (a , b) + | (E_ascription a , _b') -> assert_value_eq (a.anno_expr , b) + | (_a' , E_ascription b) -> assert_value_eq (a , b.anno_expr) | (E_variable _, _) | (E_lambda _, _) | (E_application _, _) | (E_let_in _, _) - | (E_accessor _, _) - | (E_look_up _, _) | (E_matching _, _) | (E_sequence _, _) - | (E_loop _, _) | (E_assign _, _) | (E_skip, _) -> simple_fail "comparing not a value" + | (E_record_accessor _, _) + | (E_look_up _, _) | (E_matching _, _) + | (E_loop _, _) | (E_skip, _) -> simple_fail "comparing not a value" let is_value_eq (a , b) = to_bool @@ assert_value_eq (a , b) diff --git a/src/stages/ast_simplified/misc.mli b/src/stages/ast_simplified/misc.mli index 20813de49..0784d109c 100644 --- a/src/stages/ast_simplified/misc.mli +++ b/src/stages/ast_simplified/misc.mli @@ -1,7 +1,6 @@ open Trace open Types -include module type of Stage_common.Misc (* diff --git a/src/stages/ast_simplified/types.ml b/src/stages/ast_simplified/types.ml index 94b64044f..9c1b9eaa1 100644 --- a/src/stages/ast_simplified/types.ml +++ b/src/stages/ast_simplified/types.ml @@ -1,14 +1,19 @@ [@@@warning "-30"] + module Location = Simple_utils.Location + +module Ast_simplified_parameter = struct + type type_meta = unit +end + include Stage_common.Types +(*include Ast_generic_type(Ast_simplified_parameter) +*) +include Ast_generic_type (Ast_simplified_parameter) + +type inline = bool type program = declaration Location.wrap list - -and inline = bool - -and type_expression = { - type_expression' : type_expression type_expression' - } and declaration = | Declaration_type of (type_variable * type_expression) @@ -19,59 +24,91 @@ and declaration = * an expression *) | Declaration_constant of (expression_variable * type_expression option * inline * expression) -and expr = expression +(* | Macro_declaration of macro_declaration *) +and expression = {expression_content: expression_content; location: Location.t} -and lambda = { - binder : (expression_variable * type_expression option) ; - input_type : type_expression option ; - output_type : type_expression option ; - result : expr ; -} - -and let_in = { - binder : (expression_variable * type_expression option) ; - rhs : expr ; - result : expr ; - inline : inline; -} - -and expression' = +and expression_content = (* Base *) | E_literal of literal - | E_constant of (constant * expr list) (* For language constants, like (Cons hd tl) or (plus i j) *) + | E_constant of constant (* For language constants, like (Cons hd tl) or (plus i j) *) | E_variable of expression_variable + | E_application of application | E_lambda of lambda - | E_application of (expr * expr) | E_let_in of let_in - (* E_Tuple *) - | E_tuple of expr list - (* Sum *) - | E_constructor of (constructor * expr) (* For user defined constructors *) - (* E_record *) - | E_record of expr label_map - (* TODO: Change it to (expr * access) *) - | E_accessor of (expr * access_path) - | E_update of update - (* Data Structures *) - | E_map of (expr * expr) list - | E_big_map of (expr * expr) list - | E_list of expr list - | E_set of expr list - | E_look_up of (expr * expr) - (* Matching *) - | E_matching of (expr * matching_expr) - (* Replace Statements *) - | E_sequence of (expr * expr) - | E_loop of (expr * expr) - | E_assign of (expression_variable * access_path * expr) | E_skip - (* Annotate *) - | E_ascription of expr * type_expression + (* Variant *) + | E_constructor of constructor (* For user defined constructors *) + | E_matching of matching + (* Record *) + | E_record of expression label_map + | E_record_accessor of accessor + | E_record_update of update + (* Data Structures *) + (* TODO : move to constant*) + | E_map of (expression * expression) list (*move to operator *) + | E_big_map of (expression * expression) list (*move to operator *) + | E_list of expression list + | E_set of expression list + | E_look_up of (expression * expression) + (* Advanced *) + | E_loop of loop + | E_ascription of ascription -and expression = { - expression : expression' ; - location : Location.t ; -} -and update = { record: expr; update: (label *expr) } +and constant = + { cons_name: constant' (* this is at the end because it is huge *) + ; arguments: expression list } -and matching_expr = (expr,unit) matching +and application = {expr1: expression; expr2: expression} + +and lambda = + { binder: expression_variable * type_expression option + ; input_type: type_expression option + ; output_type: type_expression option + ; result: expression } + +and let_in = + { let_binder: expression_variable * type_expression option + ; mut: bool + ; rhs: expression + ; let_result: expression + ; inline: bool } + +and constructor = {constructor: constructor'; element: expression} + +and accessor = {expr: expression; label: label} + +and update = {record: expression; path: label ; update: expression} + +and loop = {condition: expression; body: expression} + +and matching_expr = (expr,unit) matching_content +and matching = + { matchee: expression + ; cases: matching_expr + } + +and ascription = {anno_expr: expression; type_annotation: type_expression} + +and environment_element_definition = + | ED_binder + | ED_declaration of (expression * free_variables) + +and free_variables = expression_variable list + +and environment_element = + { type_value: type_expression + ; source_environment: full_environment + ; definition: environment_element_definition } + +and environment = (expression_variable * environment_element) list + +and type_environment = (type_variable * type_expression) list + +(* SUBST ??? *) +and small_environment = environment * type_environment + +and full_environment = small_environment List.Ne.t + +and expr = expression + +and texpr = type_expression diff --git a/src/stages/ast_typed/PP.ml b/src/stages/ast_typed/PP.ml index 9d412cd53..da7cd53c4 100644 --- a/src/stages/ast_typed/PP.ml +++ b/src/stages/ast_typed/PP.ml @@ -2,26 +2,60 @@ open Types open Format open PP_helpers + include Stage_common.PP +include Ast_PP_type(Ast_typed_type_parameter) -let list_sep_d x = list_sep x (const " , ") +let expression_variable ppf (ev : expression_variable) : unit = + fprintf ppf "%a" Var.pp ev -let rec type_value' ppf (tv':type_value type_expression') : unit = - type_expression' type_value ppf tv' +let rec expression ppf (e : expression) = + match e.expression_content with + | E_literal l -> + literal ppf l + | E_variable n -> + fprintf ppf "%a" expression_variable n + | E_application app -> + fprintf ppf "(%a)@(%a)" expression app.expr1 expression app.expr2 + | E_constructor c -> + fprintf ppf "%a(%a)" constructor c.constructor expression c.element + | E_constant c -> + fprintf ppf "%a(%a)" constant c.cons_name (list_sep_d expression) + c.arguments + | E_record m -> + fprintf ppf "record[%a]" (lmap_sep expression (const " , ")) m + | E_record_accessor ra -> + fprintf ppf "%a.%a" expression ra.expr label ra.label + | E_record_update {record; path; update} -> + fprintf ppf "{ %a with { %a = %a } }" expression record label path expression update + | E_map m -> + fprintf ppf "map[%a]" (list_sep_d assoc_expression) m + | E_big_map m -> + fprintf ppf "big_map[%a]" (list_sep_d assoc_expression) m + | E_list lst -> + fprintf ppf "list[%a]" (list_sep_d expression) lst + | E_set lst -> + fprintf ppf "set[%a]" (list_sep_d expression) lst + | E_look_up (ds, ind) -> + fprintf ppf "(%a)[%a]" expression ds expression ind + | E_lambda {binder; result} -> + fprintf ppf "lambda (%a) return %a" expression_variable binder + expression result + | E_matching {matchee; cases;} -> + fprintf ppf "match %a with %a" expression matchee (matching expression) cases + | E_loop l -> + fprintf ppf "while %a do %a" expression l.condition expression l.body + | E_let_in {let_binder; rhs; let_result; inline} -> + fprintf ppf "let %a = %a%a in %a" expression_variable let_binder expression + rhs option_inline inline expression let_result -and type_value ppf (tv:type_value) : unit = - type_value' ppf tv.type_value' +and assoc_expression ppf : expr * expr -> unit = + fun (a, b) -> fprintf ppf "%a -> %a" expression a expression b -let rec annotated_expression ppf (ae:annotated_expression) : unit = - match ae.type_annotation.simplified with - | _ -> fprintf ppf "@[%a:%a@]" expression ae.expression type_value ae.type_annotation +and single_record_patch ppf ((p, expr) : label * expr) = + fprintf ppf "%a <- %a" label p expression expr -and lambda ppf l = - let ({ binder ; body } : lambda) = l in - fprintf ppf "(lambda (%a) -> %a)" - name binder - annotated_expression body and option_inline ppf inline = if inline then @@ -29,68 +63,28 @@ and option_inline ppf inline = else fprintf ppf "" -and expression ppf (e:expression) : unit = - match e with - | E_literal l -> Stage_common.PP.literal ppf l - | E_constant (b, lst) -> fprintf ppf "(e_constant %a(%a))" constant b (list_sep_d annotated_expression) lst - | E_constructor (c, lst) -> fprintf ppf "(e_constructor %a(%a))" constructor c annotated_expression lst - | E_variable a -> fprintf ppf "(e_var %a)" name a - | E_application (f, arg) -> fprintf ppf "(%a) (%a)" annotated_expression f annotated_expression arg - | E_lambda l -> fprintf ppf "%a" lambda l - | E_tuple_accessor (ae, i) -> fprintf ppf "%a.%d" annotated_expression ae i - | E_record_accessor (ae, l) -> fprintf ppf "%a.%a" annotated_expression ae label l - | E_record_update (ae, (path,expr)) -> fprintf ppf "%a with record[%a=%a]" annotated_expression ae Stage_common.PP.label path annotated_expression expr - | E_tuple lst -> fprintf ppf "tuple[@; @[%a@]@;]" (list_sep annotated_expression (tag ",@;")) lst - | E_record m -> fprintf ppf "record[%a]" (lmap_sep annotated_expression (const " , ")) m - | E_map m -> fprintf ppf "map[@; @[%a@]@;]" (list_sep assoc_annotated_expression (tag ",@;")) m - | E_big_map m -> fprintf ppf "big_map[@; @[%a@]@;]" (list_sep assoc_annotated_expression (tag ",@;")) m - | E_list m -> fprintf ppf "list[@; @[%a@]@;]" (list_sep annotated_expression (tag ",@;")) m - | E_set m -> fprintf ppf "set[@; @[%a@]@;]" (list_sep annotated_expression (tag ",@;")) m - | E_look_up (ds, i) -> fprintf ppf "(%a)[%a]" annotated_expression ds annotated_expression i - | E_matching (ae, m) -> - fprintf ppf "match %a with %a" annotated_expression ae (matching annotated_expression) m - | E_sequence (a , b) -> fprintf ppf "(e_seq %a ; %a)" annotated_expression a annotated_expression b - | E_loop (expr , body) -> fprintf ppf "while %a { %a }" annotated_expression expr annotated_expression body - | E_assign (name , path , expr) -> - fprintf ppf "%a.%a := %a" - Stage_common.PP.name name.type_name - PP_helpers.(list_sep pre_access (const ".")) path - annotated_expression expr - | E_let_in { binder; rhs; result; inline } -> - fprintf ppf "let %a = %a%a in %a" name binder annotated_expression rhs option_inline inline annotated_expression result - -and value ppf v = annotated_expression ppf v - -and assoc_annotated_expression ppf : (ae * ae) -> unit = fun (a, b) -> - fprintf ppf "%a -> %a" annotated_expression a annotated_expression b - -and single_record_patch ppf ((s, ae) : string * ae) = - fprintf ppf "%s <- %a" s annotated_expression ae - -and matching_variant_case : type a . (_ -> a -> unit) -> _ -> (constructor * expression_variable) * a -> unit = +and matching_variant_case : type a . (_ -> a -> unit) -> _ -> (constructor' * expression_variable) * a -> unit = fun f ppf ((c,n),a) -> - fprintf ppf "| %a %a -> %a" constructor c name n f a + fprintf ppf "| %a %a -> %a" constructor c expression_variable n f a -and matching : type a . (formatter -> a -> unit) -> _ -> (a, 'var) matching -> unit = fun f ppf m -> match m with +and matching : type a . (formatter -> a -> unit) -> _ -> (a, 'var) matching_content -> unit = fun f ppf m -> match m with | Match_tuple ((lst, b),_) -> - fprintf ppf "let (%a) = %a" (list_sep_d Stage_common.PP.name) lst f b + fprintf ppf "let (%a) = %a" (list_sep_d expression_variable) lst f b | Match_variant (lst, _) -> fprintf ppf "%a" (list_sep (matching_variant_case f) (tag "@.")) lst | Match_bool {match_true ; match_false} -> fprintf ppf "| True -> %a @.| False -> %a" f match_true f match_false | Match_list {match_nil ; match_cons = (hd_name, tl_name, match_cons, _)} -> - fprintf ppf "| Nil -> %a @.| %a :: %a -> %a" f match_nil Stage_common.PP.name hd_name Stage_common.PP.name tl_name f match_cons + fprintf ppf "| Nil -> %a @.| %a :: %a -> %a" f match_nil expression_variable hd_name expression_variable tl_name f match_cons | Match_option {match_none ; match_some = (some, match_some, _)} -> - fprintf ppf "| None -> %a @.| Some %a -> %a" f match_none name some f match_some + fprintf ppf "| None -> %a @.| Some %a -> %a" f match_none expression_variable some f match_some -and pre_access ppf (a:access) = match a with - | Access_record n -> fprintf ppf ".%s" n - | Access_tuple i -> fprintf ppf ".%d" i - -let declaration ppf (d:declaration) = +let declaration ppf (d : declaration) = match d with - | Declaration_constant ({name ; annotated_expression = ae} , inline, _) -> - fprintf ppf "const %a = %a%a" Stage_common.PP.name name annotated_expression ae option_inline inline + | Declaration_constant (name, expr, inline,_) -> + fprintf ppf "const %a = %a%a" expression_variable name expression expr option_inline inline -let program ppf (p:program) = - fprintf ppf "@[%a@]" (list_sep declaration (tag "@;")) (List.map Location.unwrap p) +let program ppf (p : program) = + fprintf ppf "@[%a@]" + (list_sep declaration (tag "@;")) + (List.map Location.unwrap p) diff --git a/src/stages/ast_typed/PP.mli b/src/stages/ast_typed/PP.mli deleted file mode 100644 index 3dead24dc..000000000 --- a/src/stages/ast_typed/PP.mli +++ /dev/null @@ -1,33 +0,0 @@ -open Types -open Format - -val value : formatter -> annotated_expression -> unit - -val type_value : formatter -> type_value -> unit - -val single_record_patch : formatter -> ( string * ae ) -> unit - -val program : formatter -> program -> unit - -val expression : formatter -> expression -> unit - -val literal : formatter -> literal -> unit - -val annotated_expression : formatter -> annotated_expression -> unit - -(* -val list_sep_d : ( formatter -> 'a -> unit ) -> formatter -> 'a list -> unit -val smap_sep_d : ( formatter -> 'a -> unit ) -> formatter -> 'a Map.String.t -> unit - -val lambda : formatter -> lambda -> unit - -val assoc_annotated_expression : formatter -> (ae * ae) -> unit - -val matching_variant_case : ( formatter -> 'a -> unit ) -> formatter -> ( T.constructor_name * name ) * 'a -> unit - -val matching : ( formatter -> 'a -> unit ) -> formatter -> 'a matching -> unit - -val pre_access : formatter -> access -> unit - -val declaration : formatter -> declaration -> unit -*) diff --git a/src/stages/ast_typed/combinators.ml b/src/stages/ast_typed/combinators.ml index 17037787f..d1c0c4b1a 100644 --- a/src/stages/ast_typed/combinators.ml +++ b/src/stages/ast_typed/combinators.ml @@ -13,7 +13,7 @@ module Errors = struct let message () = Format.asprintf "Expected the type %s but got the type %a" expected_type - PP.type_value actual_type in + PP.type_expression actual_type in error (thunk "Expected a different type") message let declaration_not_found expected_declaration () = @@ -23,177 +23,182 @@ module Errors = struct error (thunk "No declaration with the given name") message end -let make_t type_value' simplified = { type_value' ; simplified } -let make_a_e ?(location = Location.generated) expression type_annotation environment = { - expression ; - type_annotation ; +let make_t type_content simplified = { type_content ; type_meta=simplified } +let make_a_e ?(location = Location.generated) expression_content type_expression environment = { + expression_content ; + type_expression ; environment ; location ; } -let make_n_e name a_e = { name ; annotated_expression = a_e } let make_n_t type_name type_value = { type_name ; type_value } -let t_signature ?s () : type_value = make_t (T_constant TC_signature) s -let t_chain_id ?s () : type_value = make_t (T_constant TC_chain_id) s -let t_bool ?s () : type_value = make_t (T_constant TC_bool) s -let t_string ?s () : type_value = make_t (T_constant TC_string) s -let t_bytes ?s () : type_value = make_t (T_constant TC_bytes) s -let t_key ?s () : type_value = make_t (T_constant TC_key) s -let t_key_hash ?s () : type_value = make_t (T_constant TC_key_hash) s -let t_int ?s () : type_value = make_t (T_constant TC_int) s -let t_address ?s () : type_value = make_t (T_constant TC_address) s -let t_operation ?s () : type_value = make_t (T_constant TC_operation) s -let t_nat ?s () : type_value = make_t (T_constant TC_nat) s -let t_mutez ?s () : type_value = make_t (T_constant TC_mutez) s -let t_timestamp ?s () : type_value = make_t (T_constant TC_timestamp) s -let t_unit ?s () : type_value = make_t (T_constant TC_unit) s -let t_option o ?s () : type_value = make_t (T_operator (TC_option o)) s -let t_tuple lst ?s () : type_value = make_t (T_operator (TC_tuple lst)) s -let t_variable t ?s () : type_value = make_t (T_variable t) s -let t_list t ?s () : type_value = make_t (T_operator (TC_list t)) s -let t_set t ?s () : type_value = make_t (T_operator (TC_set t)) s -let t_contract t ?s () : type_value = make_t (T_operator (TC_contract t)) s -let t_pair a b ?s () : type_value = t_tuple [a ; b] ?s () +let t_signature ?s () : type_expression = make_t (T_constant TC_signature) s +let t_chain_id ?s () : type_expression = make_t (T_constant TC_chain_id) s +let t_bool ?s () : type_expression = make_t (T_constant TC_bool) s +let t_string ?s () : type_expression = make_t (T_constant TC_string) s +let t_bytes ?s () : type_expression = make_t (T_constant TC_bytes) s +let t_key ?s () : type_expression = make_t (T_constant TC_key) s +let t_key_hash ?s () : type_expression = make_t (T_constant TC_key_hash) s +let t_int ?s () : type_expression = make_t (T_constant TC_int) s +let t_address ?s () : type_expression = make_t (T_constant TC_address) s +let t_operation ?s () : type_expression = make_t (T_constant TC_operation) s +let t_nat ?s () : type_expression = make_t (T_constant TC_nat) s +let t_mutez ?s () : type_expression = make_t (T_constant TC_mutez) s +let t_timestamp ?s () : type_expression = make_t (T_constant TC_timestamp) s +let t_unit ?s () : type_expression = make_t (T_constant TC_unit) s +let t_option o ?s () : type_expression = make_t (T_operator (TC_option o)) s +let t_variable t ?s () : type_expression = make_t (T_variable t) s +let t_list t ?s () : type_expression = make_t (T_operator (TC_list t)) s +let t_set t ?s () : type_expression = make_t (T_operator (TC_set t)) s +let t_contract t ?s () : type_expression = make_t (T_operator (TC_contract t)) s -let t_record m ?s () : type_value = make_t (T_record m) s -let make_t_ez_record (lst:(label * type_value) list) : type_value = - let aux prev (k, v) = LMap.add k v prev in - let map = List.fold_left aux LMap.empty lst in +let t_record m ?s () : type_expression = make_t (T_record m) s +let make_t_ez_record (lst:(string * type_expression) list) : type_expression = + let lst = List.map (fun (x,y) -> (Label x, y) ) lst in + let map = LMap.of_list lst in make_t (T_record map) None -let ez_t_record lst ?s () : type_value = +let ez_t_record lst ?s () : type_expression = let m = LMap.of_list lst in t_record m ?s () +let t_pair a b ?s () : type_expression = ez_t_record [(Label "0",a) ; (Label "1",b)] ?s () let t_map key value ?s () = make_t (T_operator (TC_map (key , value))) s let t_big_map key value ?s () = make_t (T_operator (TC_big_map (key , value))) s -let t_sum m ?s () : type_value = make_t (T_sum m) s -let make_t_ez_sum (lst:(constructor * type_value) list) : type_value = +let t_sum m ?s () : type_expression = make_t (T_sum m) s +let make_t_ez_sum (lst:(constructor' * type_expression) list) : type_expression = let aux prev (k, v) = CMap.add k v prev in let map = List.fold_left aux CMap.empty lst in make_t (T_sum map) None -let t_function param result ?s () : type_value = make_t (T_arrow (param, result)) s -let t_shallow_closure param result ?s () : type_value = make_t (T_arrow (param, result)) s +let t_function param result ?s () : type_expression = make_t (T_arrow {type1=param; type2=result}) s +let t_shallow_closure param result ?s () : type_expression = make_t (T_arrow {type1=param; type2=result}) s -let get_type_annotation (x:annotated_expression) = x.type_annotation -let get_type' (x:type_value) = x.type_value' -let get_environment (x:annotated_expression) = x.environment -let get_expression (x:annotated_expression) = x.expression +let get_type_expression (x:expression) = x.type_expression +let get_type' (x:type_expression) = x.type_content +let get_environment (x:expression) = x.environment +let get_expression (x:expression) = x.expression_content -let get_lambda e : _ result = match e with +let get_lambda e : _ result = match e.expression_content with | E_lambda l -> ok l | _ -> fail @@ Errors.not_a_x_expression "lambda" e () let get_lambda_with_type e = - match (e.expression , e.type_annotation.type_value') with - | E_lambda l , T_arrow (i,o) -> ok (l , (i,o)) - | _ -> fail @@ Errors.not_a_x_expression "lambda with functional type" e.expression () + match (e.expression_content , e.type_expression.type_content) with + | E_lambda l , T_arrow {type1;type2} -> ok (l , (type1,type2)) + | _ -> simple_fail "not a lambda with functional type" -let get_t_bool (t:type_value) : unit result = match t.type_value' with +let get_t_bool (t:type_expression) : unit result = match t.type_content with | T_constant (TC_bool) -> ok () | _ -> fail @@ Errors.not_a_x_type "bool" t () -let get_t_int (t:type_value) : unit result = match t.type_value' with +let get_t_int (t:type_expression) : unit result = match t.type_content with | T_constant (TC_int) -> ok () | _ -> fail @@ Errors.not_a_x_type "int" t () -let get_t_nat (t:type_value) : unit result = match t.type_value' with +let get_t_nat (t:type_expression) : unit result = match t.type_content with | T_constant (TC_nat) -> ok () | _ -> fail @@ Errors.not_a_x_type "nat" t () -let get_t_unit (t:type_value) : unit result = match t.type_value' with +let get_t_unit (t:type_expression) : unit result = match t.type_content with | T_constant (TC_unit) -> ok () | _ -> fail @@ Errors.not_a_x_type "unit" t () -let get_t_mutez (t:type_value) : unit result = match t.type_value' with +let get_t_mutez (t:type_expression) : unit result = match t.type_content with | T_constant (TC_mutez) -> ok () | _ -> fail @@ Errors.not_a_x_type "tez" t () -let get_t_bytes (t:type_value) : unit result = match t.type_value' with +let get_t_bytes (t:type_expression) : unit result = match t.type_content with | T_constant (TC_bytes) -> ok () | _ -> fail @@ Errors.not_a_x_type "bytes" t () -let get_t_string (t:type_value) : unit result = match t.type_value' with +let get_t_string (t:type_expression) : unit result = match t.type_content with | T_constant (TC_string) -> ok () | _ -> fail @@ Errors.not_a_x_type "string" t () -let get_t_contract (t:type_value) : type_value result = match t.type_value' with +let get_t_contract (t:type_expression) : type_expression result = match t.type_content with | T_operator (TC_contract x) -> ok x | _ -> fail @@ Errors.not_a_x_type "contract" t () -let get_t_option (t:type_value) : type_value result = match t.type_value' with +let get_t_option (t:type_expression) : type_expression result = match t.type_content with | T_operator (TC_option o) -> ok o | _ -> fail @@ Errors.not_a_x_type "option" t () -let get_t_list (t:type_value) : type_value result = match t.type_value' with +let get_t_list (t:type_expression) : type_expression result = match t.type_content with | T_operator (TC_list l) -> ok l | _ -> fail @@ Errors.not_a_x_type "list" t () -let get_t_set (t:type_value) : type_value result = match t.type_value' with +let get_t_set (t:type_expression) : type_expression result = match t.type_content with | T_operator (TC_set s) -> ok s | _ -> fail @@ Errors.not_a_x_type "set" t () -let get_t_key (t:type_value) : unit result = match t.type_value' with +let get_t_key (t:type_expression) : unit result = match t.type_content with | T_constant (TC_key) -> ok () | _ -> fail @@ Errors.not_a_x_type "key" t () -let get_t_signature (t:type_value) : unit result = match t.type_value' with +let get_t_signature (t:type_expression) : unit result = match t.type_content with | T_constant (TC_signature) -> ok () | _ -> fail @@ Errors.not_a_x_type "signature" t () -let get_t_key_hash (t:type_value) : unit result = match t.type_value' with +let get_t_key_hash (t:type_expression) : unit result = match t.type_content with | T_constant (TC_key_hash) -> ok () | _ -> fail @@ Errors.not_a_x_type "key_hash" t () -let get_t_tuple (t:type_value) : type_value list result = match t.type_value' with - | T_operator (TC_tuple lst) -> ok lst +let tuple_of_record (m: _ LMap.t) = + let aux i = + let opt = LMap.find_opt (Label (string_of_int i)) m in + Option.bind (fun opt -> Some (opt,i+1)) opt + in + Base.Sequence.to_list @@ Base.Sequence.unfold ~init:0 ~f:aux + +let get_t_tuple (t:type_expression) : type_expression list result = match t.type_content with + | T_record lst -> ok @@ tuple_of_record lst | _ -> fail @@ Errors.not_a_x_type "tuple" t () -let get_t_pair (t:type_value) : (type_value * type_value) result = match t.type_value' with - | T_operator (TC_tuple lst) -> +let get_t_pair (t:type_expression) : (type_expression * type_expression) result = match t.type_content with + | T_record m -> + let lst = tuple_of_record m in let%bind () = trace_strong (Errors.not_a_x_type "pair (tuple with two elements)" t ()) @@ Assert.assert_list_size lst 2 in ok List.(nth lst 0 , nth lst 1) | _ -> fail @@ Errors.not_a_x_type "pair (tuple with two elements)" t () -let get_t_function (t:type_value) : (type_value * type_value) result = match t.type_value' with - | T_arrow (a,r) -> ok (a,r) - | T_operator (TC_arrow (a , b)) -> ok (a , b) - | _ -> fail @@ Errors.not_a_x_type "function" t () +let get_t_function (t:type_expression) : (type_expression * type_expression) result = match t.type_content with + | T_arrow {type1;type2} -> ok (type1,type2) + | _ -> simple_fail "not a function" -let get_t_sum (t:type_value) : type_value constructor_map result = match t.type_value' with +let get_t_sum (t:type_expression) : type_expression constructor_map result = match t.type_content with | T_sum m -> ok m | _ -> fail @@ Errors.not_a_x_type "sum" t () -let get_t_record (t:type_value) : type_value label_map result = match t.type_value' with +let get_t_record (t:type_expression) : type_expression label_map result = match t.type_content with | T_record m -> ok m | _ -> fail @@ Errors.not_a_x_type "record" t () -let get_t_map (t:type_value) : (type_value * type_value) result = - match t.type_value' with +let get_t_map (t:type_expression) : (type_expression * type_expression) result = + match t.type_content with | T_operator (TC_map (k,v)) -> ok (k, v) | _ -> fail @@ Errors.not_a_x_type "map" t () -let get_t_big_map (t:type_value) : (type_value * type_value) result = - match t.type_value' with +let get_t_big_map (t:type_expression) : (type_expression * type_expression) result = + match t.type_content with | T_operator (TC_big_map (k,v)) -> ok (k, v) | _ -> fail @@ Errors.not_a_x_type "big_map" t () -let get_t_map_key : type_value -> type_value result = fun t -> +let get_t_map_key : type_expression -> type_expression result = fun t -> let%bind (key , _) = get_t_map t in ok key -let get_t_map_value : type_value -> type_value result = fun t -> +let get_t_map_value : type_expression -> type_expression result = fun t -> let%bind (_ , value) = get_t_map t in ok value -let get_t_big_map_key : type_value -> type_value result = fun t -> +let get_t_big_map_key : type_expression -> type_expression result = fun t -> let%bind (key , _) = get_t_big_map t in ok key -let get_t_big_map_value : type_value -> type_value result = fun t -> +let get_t_big_map_value : type_expression -> type_expression result = fun t -> let%bind (_ , value) = get_t_big_map t in ok value @@ -204,12 +209,12 @@ let assert_t_map = fun t -> let is_t_map = Function.compose to_bool get_t_map let is_t_big_map = Function.compose to_bool get_t_big_map -let assert_t_mutez : type_value -> unit result = get_t_mutez +let assert_t_mutez : type_expression -> unit result = get_t_mutez let assert_t_key = get_t_key let assert_t_signature = get_t_signature let assert_t_key_hash = get_t_key_hash -let assert_t_contract (t:type_value) : unit result = match t.type_value' with +let assert_t_contract (t:type_expression) : unit result = match t.type_content with | T_operator (TC_contract _) -> ok () | _ -> simple_fail "not a contract" @@ -228,57 +233,56 @@ let assert_t_bytes = fun t -> let%bind _ = get_t_bytes t in ok () -let assert_t_operation (t:type_value) : unit result = - match t.type_value' with +let assert_t_operation (t:type_expression) : unit result = + match t.type_content with | T_constant (TC_operation) -> ok () | _ -> simple_fail "assert: not an operation" -let assert_t_list_operation (t : type_value) : unit result = +let assert_t_list_operation (t : type_expression) : unit result = let%bind t' = get_t_list t in assert_t_operation t' -let assert_t_int : type_value -> unit result = fun t -> match t.type_value' with +let assert_t_int : type_expression -> unit result = fun t -> match t.type_content with | T_constant (TC_int) -> ok () | _ -> simple_fail "not an int" -let assert_t_nat : type_value -> unit result = fun t -> match t.type_value' with +let assert_t_nat : type_expression -> unit result = fun t -> match t.type_content with | T_constant (TC_nat) -> ok () | _ -> simple_fail "not an nat" -let assert_t_bool : type_value -> unit result = fun v -> get_t_bool v -let assert_t_unit : type_value -> unit result = fun v -> get_t_unit v +let assert_t_bool : type_expression -> unit result = fun v -> get_t_bool v +let assert_t_unit : type_expression -> unit result = fun v -> get_t_unit v -let e_record map : expression = E_record map -let ez_e_record (lst : (label * ae) list) : expression = +let e_record map : expression_content = E_record map +let ez_e_record (lst : (label * expression) list) : expression_content = let aux prev (k, v) = LMap.add k v prev in let map = List.fold_left aux LMap.empty lst in e_record map -let e_some s : expression = E_constant (C_SOME, [s]) -let e_none () : expression = E_constant (C_NONE, []) +let e_some s : expression_content = E_constant {cons_name=C_SOME;arguments=[s]} +let e_none (): expression_content = E_constant {cons_name=C_NONE; arguments=[]} -let e_map lst : expression = E_map lst +let e_map lst : expression_content = E_map lst -let e_unit () : expression = E_literal (Literal_unit) -let e_int n : expression = E_literal (Literal_int n) -let e_nat n : expression = E_literal (Literal_nat n) -let e_mutez n : expression = E_literal (Literal_mutez n) -let e_bool b : expression = E_literal (Literal_bool b) -let e_string s : expression = E_literal (Literal_string s) -let e_bytes s : expression = E_literal (Literal_bytes s) -let e_timestamp s : expression = E_literal (Literal_timestamp s) -let e_address s : expression = E_literal (Literal_address s) -let e_signature s : expression = E_literal (Literal_signature s) -let e_key s : expression = E_literal (Literal_key s) -let e_key_hash s : expression = E_literal (Literal_key_hash s) -let e_chain_id s : expression = E_literal (Literal_chain_id s) -let e_operation s : expression = E_literal (Literal_operation s) -let e_lambda l : expression = E_lambda l -let e_pair a b : expression = E_tuple [a; b] -let e_application a b : expression = E_application (a , b) -let e_variable v : expression = E_variable v -let e_list lst : expression = E_list lst -let e_let_in binder inline rhs result = E_let_in { binder ; rhs ; result; inline } -let e_tuple lst : expression = E_tuple lst +let e_unit () : expression_content = E_literal (Literal_unit) +let e_int n : expression_content = E_literal (Literal_int n) +let e_nat n : expression_content = E_literal (Literal_nat n) +let e_mutez n : expression_content = E_literal (Literal_mutez n) +let e_bool b : expression_content = E_literal (Literal_bool b) +let e_string s : expression_content = E_literal (Literal_string s) +let e_bytes s : expression_content = E_literal (Literal_bytes s) +let e_timestamp s : expression_content = E_literal (Literal_timestamp s) +let e_address s : expression_content = E_literal (Literal_address s) +let e_signature s : expression_content = E_literal (Literal_signature s) +let e_key s : expression_content = E_literal (Literal_key s) +let e_key_hash s : expression_content = E_literal (Literal_key_hash s) +let e_chain_id s : expression_content = E_literal (Literal_chain_id s) +let e_operation s : expression_content = E_literal (Literal_operation s) +let e_lambda l : expression_content = E_lambda l +let e_pair a b : expression_content = ez_e_record [(Label "0",a);(Label "1", b)] +let e_application expr1 expr2 : expression_content = E_application {expr1;expr2} +let e_variable v : expression_content = E_variable v +let e_list lst : expression_content = E_list lst +let e_let_in let_binder inline rhs let_result = E_let_in { let_binder ; rhs ; let_result; inline } let e_a_unit = make_a_e (e_unit ()) (t_unit ()) let e_a_int n = make_a_e (e_int n) (t_int ()) @@ -287,44 +291,44 @@ let e_a_mutez n = make_a_e (e_mutez n) (t_mutez ()) let e_a_bool b = make_a_e (e_bool b) (t_bool ()) let e_a_string s = make_a_e (e_string s) (t_string ()) let e_a_address s = make_a_e (e_address s) (t_address ()) -let e_a_pair a b = make_a_e (e_pair a b) (t_pair a.type_annotation b.type_annotation ()) -let e_a_some s = make_a_e (e_some s) (t_option s.type_annotation ()) +let e_a_pair a b = make_a_e (e_pair a b) (t_pair a.type_expression b.type_expression ()) +let e_a_some s = make_a_e (e_some s) (t_option s.type_expression ()) let e_a_lambda l in_ty out_ty = make_a_e (e_lambda l) (t_function in_ty out_ty ()) let e_a_none t = make_a_e (e_none ()) (t_option t ()) -let e_a_tuple lst = make_a_e (E_tuple lst) (t_tuple (List.map get_type_annotation lst) ()) -let e_a_record r = make_a_e (e_record r) (t_record (LMap.map get_type_annotation r) ()) -let e_a_application a b = make_a_e (e_application a b) (get_type_annotation b) +let e_a_record r = make_a_e (e_record r) (t_record (LMap.map get_type_expression r) ()) +let e_a_application a b = make_a_e (e_application a b) (get_type_expression b) let e_a_variable v ty = make_a_e (e_variable v) ty -let ez_e_a_record r = make_a_e (ez_e_record r) (ez_t_record (List.map (fun (x, y) -> x, y.type_annotation) r) ()) +let ez_e_a_record r = make_a_e (ez_e_record r) (ez_t_record (List.map (fun (x, y) -> x, y.type_expression) r) ()) let e_a_map lst k v = make_a_e (e_map lst) (t_map k v ()) let e_a_list lst t = make_a_e (e_list lst) (t_list t ()) -let e_a_let_in binder expr body attributes = make_a_e (e_let_in binder expr body attributes) (get_type_annotation body) +let e_a_let_in binder expr body attributes = make_a_e (e_let_in binder expr body attributes) (get_type_expression body) -let get_a_int (t:annotated_expression) = - match t.expression with + +let get_a_int (t:expression) = + match t.expression_content with | E_literal (Literal_int n) -> ok n | _ -> simple_fail "not an int" -let get_a_unit (t:annotated_expression) = - match t.expression with +let get_a_unit (t:expression) = + match t.expression_content with | E_literal (Literal_unit) -> ok () | _ -> simple_fail "not a unit" -let get_a_bool (t:annotated_expression) = - match t.expression with +let get_a_bool (t:expression) = + match t.expression_content with | E_literal (Literal_bool b) -> ok b | _ -> simple_fail "not a bool" let get_a_record_accessor = fun t -> - match t.expression with - | E_record_accessor (a , b) -> ok (a , b) + match t.expression_content with + | E_record_accessor {expr ; label} -> ok (expr , label) | _ -> simple_fail "not an accessor" let get_declaration_by_name : program -> string -> declaration result = fun p name -> let aux : declaration -> bool = fun declaration -> match declaration with - | Declaration_constant (d , _, _) -> d.name = Var.of_name name + | Declaration_constant (d, _, _, _) -> d = Var.of_name name in trace_option (Errors.declaration_not_found name ()) @@ List.find_opt aux @@ List.map Location.unwrap p diff --git a/src/stages/ast_typed/combinators.mli b/src/stages/ast_typed/combinators.mli index 4f794deb8..273fa15be 100644 --- a/src/stages/ast_typed/combinators.mli +++ b/src/stages/ast_typed/combinators.mli @@ -1,162 +1,155 @@ open Trace open Types -open Stage_common.Types -val make_n_e : expression_variable -> annotated_expression -> named_expression -val make_n_t : expression_variable -> type_value -> named_type_value -val make_t : type_value' -> S.type_expression option -> type_value -val make_a_e : ?location:Location.t -> expression -> type_value -> full_environment -> annotated_expression +val make_n_t : type_variable -> type_expression -> named_type_content +val make_t : type_content -> S.type_expression option -> type_expression +val make_a_e : ?location:Location.t -> expression_content -> type_expression -> full_environment -> expression -val t_bool : ?s:S.type_expression -> unit -> type_value -val t_string : ?s:S.type_expression -> unit -> type_value -val t_bytes : ?s:S.type_expression -> unit -> type_value -val t_key : ?s:S.type_expression -> unit -> type_value -val t_key_hash : ?s:S.type_expression -> unit -> type_value -val t_operation : ?s:S.type_expression -> unit -> type_value -val t_timestamp : ?s:S.type_expression -> unit -> type_value -val t_set : type_value -> ?s:S.type_expression -> unit -> type_value -val t_contract : type_value -> ?s:S.type_expression -> unit -> type_value -val t_int : ?s:S.type_expression -> unit -> type_value -val t_nat : ?s:S.type_expression -> unit -> type_value -val t_mutez : ?s:S.type_expression -> unit -> type_value -val t_address : ?s:S.type_expression -> unit -> type_value -val t_chain_id : ?s:S.type_expression -> unit -> type_value -val t_signature : ?s:S.type_expression -> unit -> type_value -val t_unit : ?s:S.type_expression -> unit -> type_value -val t_option : type_value -> ?s:S.type_expression -> unit -> type_value -val t_pair : type_value -> type_value -> ?s:S.type_expression -> unit -> type_value -val t_list : type_value -> ?s:S.type_expression -> unit -> type_value -val t_tuple : type_value list -> ?s:S.type_expression -> unit -> type_value -val t_variable : type_variable -> ?s:S.type_expression -> unit -> type_value -val t_record : type_value label_map -> ?s:S.type_expression -> unit -> type_value -val make_t_ez_record : (label* type_value) list -> type_value -(* -val ez_t_record : ( string * type_value ) list -> ?s:S.type_expression -> unit -> type_value -*) +val t_bool : ?s:S.type_expression -> unit -> type_expression +val t_string : ?s:S.type_expression -> unit -> type_expression +val t_bytes : ?s:S.type_expression -> unit -> type_expression +val t_key : ?s:S.type_expression -> unit -> type_expression +val t_key_hash : ?s:S.type_expression -> unit -> type_expression +val t_operation : ?s:S.type_expression -> unit -> type_expression +val t_timestamp : ?s:S.type_expression -> unit -> type_expression +val t_set : type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_contract : type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_int : ?s:S.type_expression -> unit -> type_expression +val t_nat : ?s:S.type_expression -> unit -> type_expression +val t_mutez : ?s:S.type_expression -> unit -> type_expression +val t_address : ?s:S.type_expression -> unit -> type_expression +val t_chain_id : ?s:S.type_expression -> unit -> type_expression +val t_signature : ?s:S.type_expression -> unit -> type_expression +val t_unit : ?s:S.type_expression -> unit -> type_expression +val t_option : type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_pair : type_expression -> type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_list : type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_variable : type_variable -> ?s:S.type_expression -> unit -> type_expression +val t_record : type_expression label_map -> ?s:S.type_expression -> unit -> type_expression +val make_t_ez_record : (string* type_expression) list -> type_expression +val ez_t_record : ( label * type_expression ) list -> ?s:S.type_expression -> unit -> type_expression -val t_map : type_value -> type_value -> ?s:S.type_expression -> unit -> type_value -val t_big_map : type_value -> type_value -> ?s:S.type_expression -> unit -> type_value -val t_sum : type_value constructor_map -> ?s:S.type_expression -> unit -> type_value -val make_t_ez_sum : ( constructor * type_value ) list -> type_value -val t_function : type_value -> type_value -> ?s:S.type_expression -> unit -> type_value -val t_shallow_closure : type_value -> type_value -> ?s:S.type_expression -> unit -> type_value -val get_type_annotation : annotated_expression -> type_value -val get_type' : type_value -> type_value' -val get_environment : annotated_expression -> full_environment -val get_expression : annotated_expression -> expression +val t_map : type_expression -> type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_big_map : type_expression -> type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_sum : type_expression constructor_map -> ?s:S.type_expression -> unit -> type_expression +val make_t_ez_sum : ( constructor' * type_expression ) list -> type_expression +val t_function : type_expression -> type_expression -> ?s:S.type_expression -> unit -> type_expression +val t_shallow_closure : type_expression -> type_expression -> ?s:S.type_expression -> unit -> type_expression +val get_type_expression : expression -> type_expression +val get_type' : type_expression -> type_content +val get_environment : expression -> full_environment +val get_expression : expression -> expression_content val get_lambda : expression -> lambda result -val get_lambda_with_type : annotated_expression -> (lambda * ( type_value * type_value) ) result -val get_t_bool : type_value -> unit result +val get_lambda_with_type : expression -> (lambda * ( type_expression * type_expression) ) result +val get_t_bool : type_expression -> unit result (* -val get_t_int : type_value -> unit result -val get_t_nat : type_value -> unit result -val get_t_unit : type_value -> unit result -val get_t_mutez : type_value -> unit result -val get_t_bytes : type_value -> unit result -val get_t_string : type_value -> unit result +val get_t_int : type_expression -> unit result +val get_t_nat : type_expression -> unit result +val get_t_unit : type_expression -> unit result +val get_t_mutez : type_expression -> unit result +val get_t_bytes : type_expression -> unit result +val get_t_string : type_expression -> unit result *) -val get_t_contract : type_value -> type_value result -val get_t_option : type_value -> type_value result -val get_t_list : type_value -> type_value result -val get_t_set : type_value -> type_value result +val get_t_contract : type_expression -> type_expression result +val get_t_option : type_expression -> type_expression result +val get_t_list : type_expression -> type_expression result +val get_t_set : type_expression -> type_expression result (* -val get_t_key : type_value -> unit result -val get_t_signature : type_value -> unit result -val get_t_key_hash : type_value -> unit result +val get_t_key : type_expression -> unit result +val get_t_signature : type_expression -> unit result +val get_t_key_hash : type_expression -> unit result *) -val get_t_tuple : type_value -> type_value list result -val get_t_pair : type_value -> ( type_value * type_value ) result -val get_t_function : type_value -> ( type_value * type_value ) result -val get_t_sum : type_value -> type_value constructor_map result -val get_t_record : type_value -> type_value label_map result -val get_t_map : type_value -> ( type_value * type_value ) result -val get_t_big_map : type_value -> ( type_value * type_value ) result -val get_t_map_key : type_value -> type_value result -val get_t_map_value : type_value -> type_value result -val get_t_big_map_key : type_value -> type_value result -val get_t_big_map_value : type_value -> type_value result +val get_t_tuple : type_expression -> type_expression list result +val get_t_pair : type_expression -> ( type_expression * type_expression ) result +val get_t_function : type_expression -> ( type_expression * type_expression ) result +val get_t_sum : type_expression -> type_expression constructor_map result +val get_t_record : type_expression -> type_expression label_map result +val get_t_map : type_expression -> ( type_expression * type_expression ) result +val get_t_big_map : type_expression -> ( type_expression * type_expression ) result +val get_t_map_key : type_expression -> type_expression result +val get_t_map_value : type_expression -> type_expression result +val get_t_big_map_key : type_expression -> type_expression result +val get_t_big_map_value : type_expression -> type_expression result -val assert_t_map : type_value -> unit result +val assert_t_map : type_expression -> unit result -val is_t_map : type_value -> bool -val is_t_big_map : type_value -> bool +val is_t_map : type_expression -> bool +val is_t_big_map : type_expression -> bool -val assert_t_mutez : type_value -> unit result -val assert_t_key : type_value -> unit result -val assert_t_signature : type_value -> unit result -val assert_t_key_hash : type_value -> unit result +val assert_t_mutez : type_expression -> unit result +val assert_t_key : type_expression -> unit result +val assert_t_signature : type_expression -> unit result +val assert_t_key_hash : type_expression -> unit result -val assert_t_list : type_value -> unit result +val assert_t_list : type_expression -> unit result -val is_t_list : type_value -> bool -val is_t_set : type_value -> bool -val is_t_nat : type_value -> bool -val is_t_string : type_value -> bool -val is_t_bytes : type_value -> bool -val is_t_int : type_value -> bool +val is_t_list : type_expression -> bool +val is_t_set : type_expression -> bool +val is_t_nat : type_expression -> bool +val is_t_string : type_expression -> bool +val is_t_bytes : type_expression -> bool +val is_t_int : type_expression -> bool -val assert_t_bytes : type_value -> unit result +val assert_t_bytes : type_expression -> unit result (* -val assert_t_operation : type_value -> unit result +val assert_t_operation : type_expression -> unit result *) -val assert_t_list_operation : type_value -> unit result -val assert_t_int : type_value -> unit result -val assert_t_nat : type_value -> unit result -val assert_t_bool : type_value -> unit result -val assert_t_unit : type_value -> unit result -val assert_t_contract : type_value -> unit result +val assert_t_list_operation : type_expression -> unit result +val assert_t_int : type_expression -> unit result +val assert_t_nat : type_expression -> unit result +val assert_t_bool : type_expression -> unit result +val assert_t_unit : type_expression -> unit result +val assert_t_contract : type_expression -> unit result (* val e_record : ae_map -> expression -val ez_e_record : ( string * annotated_expression ) list -> expression +val ez_e_record : ( string * expression ) list -> expression *) -val e_some : value -> expression -val e_none : unit -> expression -val e_map : ( value * value ) list -> expression -val e_unit : unit -> expression -val e_int : int -> expression -val e_nat : int -> expression -val e_mutez : int -> expression -val e_bool : bool -> expression -val e_string : string -> expression -val e_bytes : bytes -> expression -val e_timestamp : int -> expression -val e_address : string -> expression -val e_signature : string -> expression -val e_key : string -> expression -val e_key_hash : string -> expression -val e_chain_id : string -> expression -val e_operation : Memory_proto_alpha.Protocol.Alpha_context.packed_internal_operation -> expression -val e_lambda : lambda -> expression -val e_pair : value -> value -> expression -val e_application : value -> value -> expression -val e_variable : expression_variable -> expression -val e_list : value list -> expression -val e_let_in : expression_variable -> inline -> value -> value -> expression -val e_tuple : value list -> expression +val e_some : expression -> expression_content +val e_none : unit -> expression_content +val e_map : ( expression * expression ) list -> expression_content +val e_unit : unit -> expression_content +val e_int : int -> expression_content +val e_nat : int -> expression_content +val e_mutez : int -> expression_content +val e_bool : bool -> expression_content +val e_string : string -> expression_content +val e_bytes : bytes -> expression_content +val e_timestamp : int -> expression_content +val e_address : string -> expression_content +val e_signature : string -> expression_content +val e_key : string -> expression_content +val e_key_hash : string -> expression_content +val e_chain_id : string -> expression_content +val e_operation : Memory_proto_alpha.Protocol.Alpha_context.packed_internal_operation -> expression_content +val e_lambda : lambda -> expression_content +val e_pair : expression -> expression -> expression_content +val e_application : expression -> expr -> expression_content +val e_variable : expression_variable -> expression_content +val e_list : expression list -> expression_content +val e_let_in : expression_variable -> inline -> expression -> expression -> expression_content -val e_a_unit : full_environment -> annotated_expression -val e_a_int : int -> full_environment -> annotated_expression -val e_a_nat : int -> full_environment -> annotated_expression -val e_a_mutez : int -> full_environment -> annotated_expression -val e_a_bool : bool -> full_environment -> annotated_expression -val e_a_string : string -> full_environment -> annotated_expression -val e_a_address : string -> full_environment -> annotated_expression -val e_a_pair : annotated_expression -> annotated_expression -> full_environment -> annotated_expression -val e_a_some : annotated_expression -> full_environment -> annotated_expression -val e_a_lambda : lambda -> type_value -> type_value -> full_environment -> annotated_expression -val e_a_none : type_value -> full_environment -> annotated_expression -val e_a_tuple : annotated_expression list -> full_environment -> annotated_expression -val e_a_record : annotated_expression label_map -> full_environment -> annotated_expression -val e_a_application : annotated_expression -> annotated_expression -> full_environment -> annotated_expression -val e_a_variable : expression_variable -> type_value -> full_environment -> annotated_expression -val ez_e_a_record : ( label * annotated_expression ) list -> full_environment -> annotated_expression -val e_a_map : ( annotated_expression * annotated_expression ) list -> type_value -> type_value -> full_environment -> annotated_expression -val e_a_list : annotated_expression list -> type_value -> full_environment -> annotated_expression -val e_a_let_in : expression_variable -> inline -> annotated_expression -> annotated_expression -> full_environment -> annotated_expression +val e_a_unit : full_environment -> expression +val e_a_int : int -> full_environment -> expression +val e_a_nat : int -> full_environment -> expression +val e_a_mutez : int -> full_environment -> expression +val e_a_bool : bool -> full_environment -> expression +val e_a_string : string -> full_environment -> expression +val e_a_address : string -> full_environment -> expression +val e_a_pair : expression -> expression -> full_environment -> expression +val e_a_some : expression -> full_environment -> expression +val e_a_lambda : lambda -> type_expression -> type_expression -> full_environment -> expression +val e_a_none : type_expression -> full_environment -> expression +val e_a_record : expression label_map -> full_environment -> expression +val e_a_application : expression -> expression -> full_environment -> expression +val e_a_variable : expression_variable -> type_expression -> full_environment -> expression +val ez_e_a_record : ( label * expression ) list -> full_environment -> expression +val e_a_map : ( expression * expression ) list -> type_expression -> type_expression -> full_environment -> expression +val e_a_list : expression list -> type_expression -> full_environment -> expression +val e_a_let_in : expression_variable -> bool -> expression -> expression -> full_environment -> expression -val get_a_int : annotated_expression -> int result -val get_a_unit : annotated_expression -> unit result -val get_a_bool : annotated_expression -> bool result -val get_a_record_accessor : annotated_expression -> (annotated_expression * label) result +val get_a_int : expression -> int result +val get_a_unit : expression -> unit result +val get_a_bool : expression -> bool result +val get_a_record_accessor : expression -> (expression * label) result val get_declaration_by_name : program -> string -> declaration result diff --git a/src/stages/ast_typed/combinators_environment.ml b/src/stages/ast_typed/combinators_environment.ml index fb9f97755..f92ef3aea 100644 --- a/src/stages/ast_typed/combinators_environment.ml +++ b/src/stages/ast_typed/combinators_environment.ml @@ -13,7 +13,6 @@ let e_a_empty_address s = e_a_address s Environment.full_empty let e_a_empty_pair a b = e_a_pair a b Environment.full_empty let e_a_empty_some s = e_a_some s Environment.full_empty let e_a_empty_none t = e_a_none t Environment.full_empty -let e_a_empty_tuple lst = e_a_tuple lst Environment.full_empty let e_a_empty_record r = e_a_record r Environment.full_empty let e_a_empty_map lst k v = e_a_map lst k v Environment.full_empty let e_a_empty_list lst t = e_a_list lst t Environment.full_empty @@ -24,5 +23,5 @@ open Environment let env_sum_type ?(env = full_empty) ?(type_name = Var.of_name "a_sum_type") - (lst : (constructor * type_value) list) = + (lst : (constructor' * type_expression) list) = add_type type_name (make_t_ez_sum lst) env diff --git a/src/stages/ast_typed/combinators_environment.mli b/src/stages/ast_typed/combinators_environment.mli index d6fdc66b5..da4b2cfb9 100644 --- a/src/stages/ast_typed/combinators_environment.mli +++ b/src/stages/ast_typed/combinators_environment.mli @@ -1,22 +1,21 @@ open Types -val make_a_e_empty : expression -> type_value -> annotated_expression +val make_a_e_empty : expression_content -> type_expression -> expression -val e_a_empty_unit : annotated_expression -val e_a_empty_int : int -> annotated_expression -val e_a_empty_nat : int -> annotated_expression -val e_a_empty_mutez : int -> annotated_expression -val e_a_empty_bool : bool -> annotated_expression -val e_a_empty_string : string -> annotated_expression -val e_a_empty_address : string -> annotated_expression -val e_a_empty_pair : annotated_expression -> annotated_expression -> annotated_expression -val e_a_empty_some : annotated_expression -> annotated_expression -val e_a_empty_none : type_value -> annotated_expression -val e_a_empty_tuple : annotated_expression list -> annotated_expression -val e_a_empty_record : annotated_expression label_map -> annotated_expression -val e_a_empty_map : (annotated_expression * annotated_expression ) list -> type_value -> type_value -> annotated_expression -val e_a_empty_list : annotated_expression list -> type_value -> annotated_expression -val ez_e_a_empty_record : ( label * annotated_expression ) list -> annotated_expression -val e_a_empty_lambda : lambda -> type_value -> type_value -> annotated_expression +val e_a_empty_unit : expression +val e_a_empty_int : int -> expression +val e_a_empty_nat : int -> expression +val e_a_empty_mutez : int -> expression +val e_a_empty_bool : bool -> expression +val e_a_empty_string : string -> expression +val e_a_empty_address : string -> expression +val e_a_empty_pair : expression -> expression -> expression +val e_a_empty_some : expression -> expression +val e_a_empty_none : type_expression -> expression +val e_a_empty_record : expression label_map -> expression +val e_a_empty_map : (expression * expression ) list -> type_expression -> type_expression -> expression +val e_a_empty_list : expression list -> type_expression -> expression +val ez_e_a_empty_record : ( label * expression ) list -> expression +val e_a_empty_lambda : lambda -> type_expression -> type_expression -> expression -val env_sum_type : ?env:full_environment -> ?type_name:type_variable -> (constructor * type_value) list -> full_environment +val env_sum_type : ?env:full_environment -> ?type_name:type_variable -> (constructor' * type_expression) list -> full_environment diff --git a/src/stages/ast_typed/environment.ml b/src/stages/ast_typed/environment.ml index 110b0732e..61c21ed8a 100644 --- a/src/stages/ast_typed/environment.ml +++ b/src/stages/ast_typed/environment.ml @@ -1,15 +1,14 @@ open Types -open Stage_common.Types open Combinators type element = environment_element -let make_element : type_value -> full_environment -> environment_element_definition -> element = +let make_element : type_expression -> full_environment -> environment_element_definition -> element = fun type_value source_environment definition -> {type_value ; source_environment ; definition} let make_element_binder = fun t s -> make_element t s ED_binder -let make_element_declaration = fun s (ae : annotated_expression) -> - let free_variables = Misc.Free_variables.(annotated_expression empty ae) in - make_element (get_type_annotation ae) s (ED_declaration (ae , free_variables)) +let make_element_declaration = fun s (ae : expression) -> + let free_variables = Misc.Free_variables.(expression empty ae) in + make_element (get_type_expression ae) s (ED_declaration (ae , free_variables)) module Small = struct type t = small_environment @@ -22,28 +21,28 @@ module Small = struct let map_type_environment : _ -> t -> t = fun f (a , b) -> (a , f b) let add : expression_variable -> element -> t -> t = fun k v -> map_environment (fun x -> (k , v) :: x) - let add_type : type_variable -> type_value -> t -> t = fun k v -> map_type_environment (fun x -> (k , v) :: x) + let add_type : type_variable -> type_expression -> t -> t = fun k v -> map_type_environment (fun x -> (k , v) :: x) let get_opt : expression_variable -> t -> element option = fun k x -> List.assoc_opt k (get_environment x) - let get_type_opt : type_variable -> t -> type_value option = fun k x -> List.assoc_opt k (get_type_environment x) + let get_type_opt : type_variable -> t -> type_expression option = fun k x -> List.assoc_opt k (get_type_environment x) end type t = full_environment let empty : environment = Small.(get_environment empty) let full_empty : t = List.Ne.singleton Small.empty let add : expression_variable -> element -> t -> t = fun k v -> List.Ne.hd_map (Small.add k v) -let add_ez_binder : expression_variable -> type_value -> t -> t = fun k v e -> +let add_ez_binder : expression_variable -> type_expression -> t -> t = fun k v e -> List.Ne.hd_map (Small.add k (make_element_binder v e)) e -let add_ez_declaration : expression_variable -> annotated_expression -> t -> t = fun k ae e -> +let add_ez_declaration : expression_variable -> expression -> t -> t = fun k ae e -> List.Ne.hd_map (Small.add k (make_element_declaration e ae)) e let add_ez_ae = add_ez_declaration -let add_type : type_variable -> type_value -> t -> t = fun k v -> List.Ne.hd_map (Small.add_type k v) +let add_type : type_variable -> type_expression -> t -> t = fun k v -> List.Ne.hd_map (Small.add_type k v) let get_opt : expression_variable -> t -> element option = fun k x -> List.Ne.find_map (Small.get_opt k) x -let get_type_opt : type_variable -> t -> type_value option = fun k x -> List.Ne.find_map (Small.get_type_opt k) x +let get_type_opt : type_variable -> t -> type_expression option = fun k x -> List.Ne.find_map (Small.get_type_opt k) x -let get_constructor : constructor -> t -> (type_value * type_value) option = fun k x -> (* Left is the constructor, right is the sum type *) +let get_constructor : constructor' -> t -> (type_expression * type_expression) option = fun k x -> (* Left is the constructor, right is the sum type *) let aux = fun x -> let aux = fun (_type_name , x) -> - match x.type_value' with + match x.type_content with | T_sum m -> (match CMap.find_opt k m with Some km -> Some (km , x) @@ -56,15 +55,16 @@ let get_constructor : constructor -> t -> (type_value * type_value) option = fun module PP = struct open Format + include PP open PP_helpers let list_sep_scope x = list_sep x (const " | ") let environment_element = fun ppf (k , (ele : environment_element)) -> - fprintf ppf "%a -> %a" Stage_common.PP.name k PP.type_value ele.type_value + fprintf ppf "%a -> %a" PP.expression_variable k PP.type_expression ele.type_value let type_environment_element = fun ppf (k , tv) -> - fprintf ppf "%a -> %a" Stage_common.PP.type_variable k PP.type_value tv + fprintf ppf "%a -> %a" PP.type_variable k PP.type_expression tv let environment : _ -> environment -> unit = fun ppf lst -> fprintf ppf "E[%a]" (list_sep environment_element (const " , ")) lst @@ -87,6 +87,6 @@ open Trace let get_trace : expression_variable -> t -> element result = fun s env -> let error = let title () = "missing var not in env" in - let content () = Format.asprintf "\nvar: %a\nenv: %a\n" Stage_common.PP.name s PP.full_environment env in + let content () = Format.asprintf "\nvar: %a\nenv: %a\n" PP. expression_variable s PP.full_environment env in error title content in trace_option error @@ get_opt s env diff --git a/src/stages/ast_typed/environment.mli b/src/stages/ast_typed/environment.mli index 41c805532..a0615e16b 100644 --- a/src/stages/ast_typed/environment.mli +++ b/src/stages/ast_typed/environment.mli @@ -8,13 +8,13 @@ val get_trace : expression_variable -> t -> element result val empty : environment val full_empty : t val add : expression_variable -> element -> t -> t -val add_ez_binder : expression_variable -> type_value -> t -> t -val add_ez_declaration : expression_variable -> annotated_expression -> t -> t -val add_ez_ae : expression_variable -> annotated_expression -> t -> t -val add_type : type_variable -> type_value -> t -> t +val add_ez_binder : expression_variable -> type_expression -> t -> t +val add_ez_declaration : expression_variable -> expression -> t -> t +val add_ez_ae : expression_variable -> expression -> t -> t +val add_type : type_variable -> type_expression -> t -> t val get_opt : expression_variable -> t -> element option -val get_type_opt : type_variable -> t -> type_value option -val get_constructor : constructor -> t -> (type_value * type_value) option +val get_type_opt : type_variable -> t -> type_expression option +val get_constructor : constructor' -> t -> (type_expression * type_expression) option module Small : sig type t = small_environment @@ -28,16 +28,16 @@ module Small : sig val map_type_environment : ( type_environment -> type_environment ) -> t -> t val add : string -> element -> t -> t - val add_type : string -> type_value -> t -> t + val add_type : string -> type_expression -> t -> t val get_opt : string -> t -> element option - val get_type_opt : string -> t -> type_value option + val get_type_opt : string -> t -> type_expression option *) end (* -val make_element : type_value -> full_environment -> environment_element_definition -> element -val make_element_binder : type_value -> full_environment -> element -val make_element_declaration : full_environment -> annotated_expression -> element +val make_element : type_expression -> full_environment -> environment_element_definition -> element +val make_element_binder : type_expression -> full_environment -> element +val make_element_declaration : full_environment -> expression -> element *) @@ -50,7 +50,7 @@ module PP : sig (* val environment_element : formatter -> ( string * environment_element ) -> unit - val type_environment_element : formatter -> ( string * type_value ) -> unit + val type_environment_element : formatter -> ( string * type_expression ) -> unit val environment : formatter -> environment -> unit diff --git a/src/stages/ast_typed/misc.ml b/src/stages/ast_typed/misc.ml index f56558b13..b0f31e74d 100644 --- a/src/stages/ast_typed/misc.ml +++ b/src/stages/ast_typed/misc.ml @@ -1,15 +1,13 @@ open Trace open Types -include Stage_common.Misc - module Errors = struct let different_kinds a b () = let title = (thunk "different kinds") in let message () = "" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.type_value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.type_value b ) + ("a" , fun () -> Format.asprintf "%a" PP.type_expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.type_expression b ) ] in error ~data title message () @@ -17,16 +15,16 @@ module Errors = struct let title = (thunk "different type constructors") in let message () = "Expected these two constant type constructors to be the same, but they're different" in let data = [ - ("a" , fun () -> Format.asprintf "%a" Stage_common.PP.type_constant a) ; - ("b" , fun () -> Format.asprintf "%a" Stage_common.PP.type_constant b ) + ("a" , fun () -> Format.asprintf "%a" PP.type_constant a) ; + ("b" , fun () -> Format.asprintf "%a" PP.type_constant b ) ] in error ~data title message () let different_operators a b () = let title = (thunk "different type constructors") in let message () = "Expected these two n-ary type constructors to be the same, but they're different" in let data = [ - ("a" , fun () -> Format.asprintf "%a" (Stage_common.PP.type_operator PP.type_value) a) ; - ("b" , fun () -> Format.asprintf "%a" (Stage_common.PP.type_operator PP.type_value) b) + ("a" , fun () -> Format.asprintf "%a" (PP.type_operator PP.type_expression) a) ; + ("b" , fun () -> Format.asprintf "%a" (PP.type_operator PP.type_expression) b) ] in error ~data title message () @@ -37,8 +35,8 @@ module Errors = struct "Expected these two n-ary type constructors to be the same, but they have different numbers of arguments (both use the %s type constructor, but they have %d and %d arguments, respectively)" (type_operator_name opa) lena lenb in let data = [ - ("a" , fun () -> Format.asprintf "%a" (Stage_common.PP.type_operator PP.type_value) opa) ; - ("b" , fun () -> Format.asprintf "%a" (Stage_common.PP.type_operator PP.type_value) opb) ; + ("a" , fun () -> Format.asprintf "%a" (PP.type_operator PP.type_expression) opa) ; + ("b" , fun () -> Format.asprintf "%a" (PP.type_operator PP.type_expression) opb) ; ("op" , fun () -> type_operator_name opa) ; ("len_a" , fun () -> Format.asprintf "%d" lena) ; ("len_b" , fun () -> Format.asprintf "%d" lenb) ; @@ -49,8 +47,8 @@ module Errors = struct let title () = name ^ " have different sizes" in let message () = "Expected these two types to be the same, but they're different (both are " ^ name ^ ", but with a different number of arguments)" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.type_value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.type_value b ) + ("a" , fun () -> Format.asprintf "%a" PP.type_expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.type_expression b ) ] in error ~data title message () @@ -73,8 +71,8 @@ module Errors = struct let title () = name ^ " are different" in let message () = "Expected these two types to be the same, but they're different" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.type_value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.type_value b ) + ("a" , fun () -> Format.asprintf "%a" PP.type_expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.type_expression b ) ] in error ~data title message () @@ -91,8 +89,8 @@ module Errors = struct let title () = name ^ " are different" in let message () = "" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.value b ) + ("a" , fun () -> Format.asprintf "%a" PP.expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.expression b ) ] in error ~data title message () @@ -109,8 +107,8 @@ module Errors = struct let title () = "values have different types: " ^ name in let message () = "" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.value b ) + ("a" , fun () -> Format.asprintf "%a" PP.expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.expression b) ] in error ~data title message () @@ -127,8 +125,8 @@ module Errors = struct let title () = name ^ " are not comparable" in let message () = "" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.value b ) + ("a" , fun () -> Format.asprintf "%a" PP.expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.expression b ) ] in error ~data title message () @@ -136,8 +134,8 @@ module Errors = struct let title () = name in let message () = "" in let data = [ - ("a" , fun () -> Format.asprintf "%a" PP.value a) ; - ("b" , fun () -> Format.asprintf "%a" PP.value b ) + ("a" , fun () -> Format.asprintf "%a" PP.expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.expression b ) ] in error ~data title message () @@ -177,49 +175,45 @@ module Free_variables = struct let empty : bindings = [] let of_list : expression_variable list -> bindings = fun x -> x - let rec expression : bindings -> expression -> bindings = fun b e -> - let self = annotated_expression b in - match e with + let rec expression_content : bindings -> expression_content -> bindings = fun b ec -> + let self = expression b in + match ec with | E_lambda l -> lambda b l | E_literal _ -> empty - | E_constant (_ , lst) -> unions @@ List.map self lst + | E_constant {arguments;_} -> unions @@ List.map self arguments | E_variable name -> ( match mem name b with | true -> empty | false -> singleton name ) - | E_application (a, b) -> unions @@ List.map self [ a ; b ] - | E_tuple lst -> unions @@ List.map self lst - | E_constructor (_ , a) -> self a + | E_application {expr1;expr2} -> unions @@ List.map self [ expr1 ; expr2 ] + | E_constructor {element;_} -> self element | E_record m -> unions @@ List.map self @@ LMap.to_list m - | E_record_accessor (a, _) -> self a - | E_record_update (r,(_,e)) -> union (self r) @@ self e - | E_tuple_accessor (a, _) -> self a + | E_record_accessor {expr;_} -> self expr + | E_record_update {record; update;_} -> union (self record) @@ self update | E_list lst -> unions @@ List.map self lst | E_set lst -> unions @@ List.map self lst | (E_map m | E_big_map m) -> unions @@ List.map self @@ List.concat @@ List.map (fun (a, b) -> [ a ; b ]) m | E_look_up (a , b) -> unions @@ List.map self [ a ; b ] - | E_matching (a , cs) -> union (self a) (matching_expression b cs) - | E_sequence (a , b) -> unions @@ List.map self [ a ; b ] - | E_loop (expr , body) -> unions @@ List.map self [ expr ; body ] - | E_assign (_ , _ , expr) -> self expr - | E_let_in { binder; rhs; result; _ } -> - let b' = union (singleton binder) b in + | E_matching {matchee; cases;_} -> union (self matchee) (matching_expression b cases) + | E_loop {condition ; body} -> unions @@ List.map self [ condition ; body ] + | E_let_in { let_binder; rhs; let_result; _} -> + let b' = union (singleton let_binder) b in union - (annotated_expression b' result) - (annotated_expression b rhs) + (expression b' let_result) + (self rhs) and lambda : bindings -> lambda -> bindings = fun b l -> let b' = union (singleton l.binder) b in - annotated_expression b' l.body + expression b' l.result - and annotated_expression : bindings -> annotated_expression -> bindings = fun b ae -> - expression b ae.expression + and expression : bindings -> expression -> bindings = fun b e -> + expression_content b e.expression_content - and matching_variant_case : type a . (bindings -> a -> bindings) -> bindings -> ((constructor * expression_variable) * a) -> bindings = fun f b ((_,n),c) -> + and matching_variant_case : type a . (bindings -> a -> bindings) -> bindings -> ((constructor' * expression_variable) * a) -> bindings = fun f b ((_,n),c) -> f (union (singleton n) b) c - and matching : type a . (bindings -> a -> bindings) -> bindings -> (a,'var) matching -> bindings = fun f b m -> + and matching : type a . (bindings -> a -> bindings) -> bindings -> (a,'var) matching_content -> bindings = fun f b m -> match m with | Match_bool { match_true = t ; match_false = fa } -> union (f b t) (f b fa) | Match_list { match_nil = n ; match_cons = (hd, tl, c, _) } -> union (f b n) (f (union (of_list [hd ; tl]) b) c) @@ -228,7 +222,7 @@ module Free_variables = struct f (union (of_list lst) b) a | Match_variant (lst,_) -> unions @@ List.map (matching_variant_case f b) lst - and matching_expression = fun x -> matching annotated_expression x + and matching_expression = fun x -> matching expression x end @@ -314,7 +308,7 @@ end open Errors -let rec assert_type_value_eq (a, b: (type_value * type_value)) : unit result = match (a.type_value', b.type_value') with +let rec assert_type_expression_eq (a, b: (type_expression * type_expression)) : unit result = match (a.type_content, b.type_content) with | T_constant ca, T_constant cb -> ( trace_strong (different_constants ca cb) @@ Assert.assert_true (ca = cb) @@ -328,16 +322,14 @@ let rec assert_type_value_eq (a, b: (type_value * type_value)) : unit result = m | TC_set la, TC_set lb -> ok @@ ([la], [lb]) | TC_map (ka,va), TC_map (kb,vb) | TC_big_map (ka,va), TC_big_map (kb,vb) -> ok @@ ([ka;va] ,[kb;vb]) - | TC_tuple lsta, TC_tuple lstb -> ok @@ (lsta , lstb) - | TC_arrow (froma , toa) , TC_arrow (fromb , tob) -> ok @@ ([froma;toa] , [fromb;tob]) - | (TC_option _ | TC_list _ | TC_contract _ | TC_set _ | TC_map _ | TC_big_map _ | TC_tuple _ | TC_arrow _), - (TC_option _ | TC_list _ | TC_contract _ | TC_set _ | TC_map _ | TC_big_map _ | TC_tuple _ | TC_arrow _) -> fail @@ different_operators opa opb + | (TC_option _ | TC_list _ | TC_contract _ | TC_set _ | TC_map _ | TC_big_map _ | TC_arrow _), + (TC_option _ | TC_list _ | TC_contract _ | TC_set _ | TC_map _ | TC_big_map _ | TC_arrow _ ) -> fail @@ different_operators opa opb in if List.length lsta <> List.length lstb then fail @@ different_operator_number_of_arguments opa opb (List.length lsta) (List.length lstb) else trace (different_types "arguments to type operators" a b) - @@ bind_list_iter (fun (a,b) -> assert_type_value_eq (a,b) )(List.combine lsta lstb) + @@ bind_list_iter (fun (a,b) -> assert_type_expression_eq (a,b) )(List.combine lsta lstb) ) | T_operator _, _ -> fail @@ different_kinds a b | T_sum sa, T_sum sb -> ( @@ -347,7 +339,7 @@ let rec assert_type_value_eq (a, b: (type_value * type_value)) : unit result = m let%bind _ = Assert.assert_true ~msg:"different keys in sum types" @@ (ka = kb) in - assert_type_value_eq (va, vb) + assert_type_expression_eq (va, vb) in let%bind _ = trace_strong (different_size_sums a b) @@ -366,7 +358,7 @@ let rec assert_type_value_eq (a, b: (type_value * type_value)) : unit result = m let Label kb = kb in trace_strong (different_props_in_record ka kb) @@ Assert.assert_true (ka = kb) in - assert_type_value_eq (va, vb) + assert_type_expression_eq (va, vb) in let%bind _ = trace_strong (different_size_records a b) @@ -376,16 +368,16 @@ let rec assert_type_value_eq (a, b: (type_value * type_value)) : unit result = m ) | T_record _, _ -> fail @@ different_kinds a b - | T_arrow (param, result), T_arrow (param', result') -> - let%bind _ = assert_type_value_eq (param, param') in - let%bind _ = assert_type_value_eq (result, result') in + | T_arrow {type1;type2}, T_arrow {type1=type1';type2=type2'} -> + let%bind _ = assert_type_expression_eq (type1, type1') in + let%bind _ = assert_type_expression_eq (type2, type2') in ok () | T_arrow _, _ -> fail @@ different_kinds a b | T_variable x, T_variable y -> let _ = (x = y) in failwith "TODO : we must check that the two types were bound at the same location (even if they have the same name), i.e. use something like De Bruijn indices or a propper graph encoding" | T_variable _, _ -> fail @@ different_kinds a b (* No information about what made it fail *) -let type_value_eq ab = Trace.to_bool @@ assert_type_value_eq ab +let type_expression_eq ab = Trace.to_bool @@ assert_type_expression_eq ab let assert_literal_eq (a, b : literal * literal) : unit result = match (a, b) with @@ -410,6 +402,8 @@ let assert_literal_eq (a, b : literal * literal) : unit result = | Literal_bytes a, Literal_bytes b when a = b -> ok () | Literal_bytes _, Literal_bytes _ -> fail @@ different_literals "different bytes" a b | Literal_bytes _, _ -> fail @@ different_literals_because_different_types "bytes vs non-bytes" a b + | Literal_void, Literal_void -> ok () + | Literal_void, _ -> fail @@ different_literals_because_different_types "void vs non-void" a b | Literal_unit, Literal_unit -> ok () | Literal_unit, _ -> fail @@ different_literals_because_different_types "unit vs non-unit" a b | Literal_address a, Literal_address b when a = b -> ok () @@ -431,15 +425,15 @@ let assert_literal_eq (a, b : literal * literal) : unit result = | Literal_operation _, _ -> fail @@ different_literals_because_different_types "operation vs non-operation" a b -let rec assert_value_eq (a, b: (value*value)) : unit result = +let rec assert_value_eq (a, b: (expression*expression)) : unit result = let error_content () = - Format.asprintf "\n%a vs %a" PP.value a PP.value b + Format.asprintf "\n%a vs %a" PP.expression a PP.expression b in trace (fun () -> error (thunk "not equal") error_content ()) @@ - match (a.expression, b.expression) with + match (a.expression_content, b.expression_content) with | E_literal a, E_literal b -> assert_literal_eq (a, b) - | E_constant (ca, lsta), E_constant (cb, lstb) when ca = cb -> ( + | E_constant {cons_name=ca;arguments=lsta}, E_constant {cons_name=cb;arguments=lstb} when ca = cb -> ( let%bind lst = generic_try (different_size_values "constants with different number of elements" a b) (fun () -> List.combine lsta lstb) in @@ -451,12 +445,12 @@ let rec assert_value_eq (a, b: (value*value)) : unit result = | E_constant _, _ -> let error_content () = Format.asprintf "%a vs %a" - PP.annotated_expression a - PP.annotated_expression b + PP.expression a + PP.expression b in fail @@ (fun () -> error (thunk "comparing constant with other stuff") error_content ()) - | E_constructor (ca, a), E_constructor (cb, b) when ca = cb -> ( + | E_constructor {constructor=ca;element=a}, E_constructor {constructor=cb;element=b} when ca = cb -> ( let%bind _eq = assert_value_eq (a, b) in ok () ) @@ -464,24 +458,13 @@ let rec assert_value_eq (a, b: (value*value)) : unit result = fail @@ different_values "constructors" a b | E_constructor _, _ -> fail @@ different_values_because_different_types "constructor vs. non-constructor" a b - - | E_tuple lsta, E_tuple lstb -> ( - let%bind lst = - generic_try (different_size_values "tuples with different number of elements" a b) - (fun () -> List.combine lsta lstb) in - let%bind _all = bind_list @@ List.map assert_value_eq lst in - ok () - ) - | E_tuple _, _ -> - fail @@ different_values_because_different_types "tuple vs. non-tuple" a b - | E_record sma, E_record smb -> ( let aux (Label k) a b = match a, b with | Some a, Some b -> Some (assert_value_eq (a, b)) | _ -> Some (fail @@ missing_key_in_record_value k) in - let%bind _all = bind_lmap @@ LMap.merge aux sma smb in + let%bind _all = Stage_common.Helpers.bind_lmap @@ LMap.merge aux sma smb in ok () ) | E_record _, _ -> @@ -522,30 +505,28 @@ let rec assert_value_eq (a, b: (value*value)) : unit result = | E_set _, _ -> fail @@ different_values_because_different_types "set vs. non-set" a b | (E_literal _, _) | (E_variable _, _) | (E_application _, _) - | (E_lambda _, _) | (E_let_in _, _) | (E_tuple_accessor _, _) - | (E_record_update _,_) - | (E_record_accessor _, _) + | (E_lambda _, _) | (E_let_in _, _) + | (E_record_accessor _, _) | (E_record_update _,_) | (E_look_up _, _) | (E_matching _, _) - | (E_assign _ , _) - | (E_sequence _, _) | (E_loop _, _)-> fail @@ error_uncomparable_values "can't compare sequences nor loops" a b + | (E_loop _, _)-> fail @@ error_uncomparable_values "can't compare sequences nor loops" a b -let merge_annotation (a:type_value option) (b:type_value option) err : type_value result = +let merge_annotation (a:type_expression option) (b:type_expression option) err : type_expression result = match a, b with | None, None -> fail @@ err | Some a, None -> ok a | None, Some b -> ok b | Some a, Some b -> - let%bind _ = assert_type_value_eq (a, b) in - match a.simplified, b.simplified with + let%bind _ = assert_type_expression_eq (a, b) in + match a.type_meta, b.type_meta with | _, None -> ok a | _, Some _ -> ok b -let get_entry (lst : program) (name : string) : annotated_expression result = +let get_entry (lst : program) (name : string) : expression result = trace_option (Errors.missing_entry_point name) @@ let aux x = - let (Declaration_constant (an , _, _)) = Location.unwrap x in - if (an.name = Var.of_name name) - then Some an.annotated_expression + let (Declaration_constant (an , expr, _, _)) = Location.unwrap x in + if (an = Var.of_name name) + then Some expr else None in List.find_map aux lst @@ -553,4 +534,4 @@ let get_entry (lst : program) (name : string) : annotated_expression result = let program_environment (program : program) : full_environment = let last_declaration = Location.unwrap List.(hd @@ rev program) in match last_declaration with - | Declaration_constant (_ , _, (_ , post_env)) -> post_env + | Declaration_constant (_ , _, _, post_env) -> post_env diff --git a/src/stages/ast_typed/misc.mli b/src/stages/ast_typed/misc.mli index 44e3ca324..d92bb8ae1 100644 --- a/src/stages/ast_typed/misc.mli +++ b/src/stages/ast_typed/misc.mli @@ -1,16 +1,14 @@ open Trace open Types -include module type of Stage_common.Misc +val assert_value_eq : ( expression * expression ) -> unit result -val assert_value_eq : ( value * value ) -> unit result +val assert_type_expression_eq : ( type_expression * type_expression ) -> unit result -val assert_type_value_eq : ( type_value * type_value ) -> unit result - -val merge_annotation : type_value option -> type_value option -> error_thunk -> type_value result +val merge_annotation : type_expression option -> type_expression option -> error_thunk -> type_expression result (* No information about what made it fail *) -val type_value_eq : ( type_value * type_value ) -> bool +val type_expression_eq : ( type_expression * type_expression ) -> bool module Free_variables : sig type bindings = expression_variable list @@ -18,7 +16,7 @@ module Free_variables : sig val matching_expression : bindings -> matching_expr -> bindings val lambda : bindings -> lambda -> bindings - val annotated_expression : bindings -> annotated_expression -> bindings + val expression : bindings -> expression -> bindings val empty : bindings val singleton : expression_variable -> bindings @@ -40,14 +38,15 @@ end module Errors : sig (* - val different_kinds : type_value -> type_value -> unit -> error + val different_kinds : type_expression -> type_expression -> unit -> error val different_constants : string -> string -> unit -> error - val different_size_type : name -> type_value -> type_value -> unit -> error + val different_size_type : name -> type_expression -> type_expression -> unit -> error val different_props_in_record : string -> string -> unit -> error - val different_size_constants : type_value -> type_value -> unit -> error - val different_size_sums : type_value -> type_value -> unit -> error - val different_size_records : type_value -> type_value -> unit -> error - val different_types : name -> type_value -> type_value -> unit -> error + val different_size_constants : type_expression -> type_expression -> unit -> error + val different_size_tuples : type_expression -> type_expression -> unit -> error + val different_size_sums : type_expression -> type_expression -> unit -> error + val different_size_records : type_expression -> type_expression -> unit -> error + val different_types : name -> type_expression -> type_expression -> unit -> error val different_literals : name -> literal -> literal -> unit -> error val different_values : name -> value -> value -> unit -> error val different_literals_because_different_types : name -> literal -> literal -> unit -> error @@ -67,5 +66,5 @@ end val assert_literal_eq : ( literal * literal ) -> unit result *) -val get_entry : program -> string -> annotated_expression result +val get_entry : program -> string -> expression result val program_environment : program -> full_environment diff --git a/src/stages/ast_typed/misc_smart.ml b/src/stages/ast_typed/misc_smart.ml index 556b8d81a..3cc52eaec 100644 --- a/src/stages/ast_typed/misc_smart.ml +++ b/src/stages/ast_typed/misc_smart.ml @@ -8,31 +8,31 @@ let program_to_main : program -> string -> lambda result = fun p s -> let%bind (main , input_type , _) = let pred = fun d -> match d with - | Declaration_constant (d , _, _) when d.name = Var.of_name s -> Some d.annotated_expression + | Declaration_constant (d , expr, _, _) when d = Var.of_name s -> Some expr | Declaration_constant _ -> None in let%bind main = trace_option (simple_error "no main with given name") @@ List.find_map (Function.compose pred Location.unwrap) p in let%bind (input_ty , output_ty) = - match (get_type' @@ get_type_annotation main) with - | T_arrow (i , o) -> ok (i , o) + match (get_type' @@ get_type_expression main) with + | T_arrow {type1;type2} -> ok (type1 , type2) | _ -> simple_fail "program main isn't a function" in ok (main , input_ty , output_ty) in let env = let aux = fun _ d -> match d with - | Declaration_constant (_ , _, (_ , post_env)) -> post_env in + | Declaration_constant (_ , _, _, post_env) -> post_env in List.fold_left aux Environment.full_empty (List.map Location.unwrap p) in let binder = Var.of_name "@contract_input" in - let body = + let result = let input_expr = e_a_variable binder input_type env in - let main_expr = e_a_variable (Var.of_name s) (get_type_annotation main) env in + let main_expr = e_a_variable (Var.of_name s) (get_type_expression main) env in e_a_application main_expr input_expr env in ok { binder ; - body ; + result ; } module Captured_variables = struct @@ -45,13 +45,13 @@ module Captured_variables = struct let empty : bindings = [] let of_list : expression_variable list -> bindings = fun x -> x - let rec annotated_expression : bindings -> annotated_expression -> bindings result = fun b ae -> - let self = annotated_expression b in - match ae.expression with + let rec expression : bindings -> expression -> bindings result = fun b ae -> + let self = expression b in + match ae.expression_content with | E_lambda l -> ok @@ Free_variables.lambda empty l | E_literal _ -> ok empty - | E_constant (_ , lst) -> - let%bind lst' = bind_map_list self lst in + | E_constant {arguments;_} -> + let%bind lst' = bind_map_list self arguments in ok @@ unions lst' | E_variable name -> ( let%bind env_element = @@ -61,22 +61,18 @@ module Captured_variables = struct | ED_binder -> ok empty | ED_declaration (_ , _) -> simple_fail "todo" ) - | E_application (a, b) -> - let%bind lst' = bind_map_list self [ a ; b ] in + | E_application {expr1;expr2} -> + let%bind lst' = bind_map_list self [ expr1 ; expr2 ] in ok @@ unions lst' - | E_tuple lst -> - let%bind lst' = bind_map_list self lst in - ok @@ unions lst' - | E_constructor (_ , a) -> self a + | E_constructor {element;_} -> self element | E_record m -> let%bind lst' = bind_map_list self @@ LMap.to_list m in ok @@ unions lst' - | E_record_accessor (a, _) -> self a - | E_record_update (r,(_,e)) -> - let%bind r = self r in - let%bind e = self e in + | E_record_accessor {expr;_} -> self expr + | E_record_update {record;update;_} -> + let%bind r = self record in + let%bind e = self update in ok @@ union r e - | E_tuple_accessor (a, _) -> self a | E_list lst -> let%bind lst' = bind_map_list self lst in ok @@ unions lst' @@ -89,23 +85,21 @@ module Captured_variables = struct | E_look_up (a , b) -> let%bind lst' = bind_map_list self [ a ; b ] in ok @@ unions lst' - | E_matching (a , cs) -> - let%bind a' = self a in - let%bind cs' = matching_expression b cs in + | E_matching {matchee;cases;_} -> + let%bind a' = self matchee in + let%bind cs' = matching_expression b cases in ok @@ union a' cs' - | E_sequence (_ , b) -> self b - | E_loop (expr , body) -> - let%bind lst' = bind_map_list self [ expr ; body ] in + | E_loop {condition; body} -> + let%bind lst' = bind_map_list self [ condition ; body ] in ok @@ unions lst' - | E_assign (_ , _ , expr) -> self expr | E_let_in li -> - let b' = union (singleton li.binder) b in - annotated_expression b' li.result + let b' = union (singleton li.let_binder) b in + expression b' li.let_result - and matching_variant_case : type a . (bindings -> a -> bindings result) -> bindings -> ((constructor * expression_variable) * a) -> bindings result = fun f b ((_,n),c) -> + and matching_variant_case : type a . (bindings -> a -> bindings result) -> bindings -> ((constructor' * expression_variable) * a) -> bindings result = fun f b ((_,n),c) -> f (union (singleton n) b) c - and matching : type a . (bindings -> a -> bindings result) -> bindings -> (a, 'tv) matching -> bindings result = fun f b m -> + and matching : type a . (bindings -> a -> bindings result) -> bindings -> (a, 'tv) matching_content -> bindings result = fun f b m -> match m with | Match_bool { match_true = t ; match_false = fa } -> let%bind t' = f b t in @@ -125,6 +119,6 @@ module Captured_variables = struct let%bind lst' = bind_map_list (matching_variant_case f b) lst in ok @@ unions lst' - and matching_expression = fun x -> matching annotated_expression x + and matching_expression = fun x -> matching expression x end diff --git a/src/stages/ast_typed/misc_smart.mli b/src/stages/ast_typed/misc_smart.mli index 7298497db..f723916de 100644 --- a/src/stages/ast_typed/misc_smart.mli +++ b/src/stages/ast_typed/misc_smart.mli @@ -1,13 +1,12 @@ open Trace open Types -open Stage_common.Types val program_to_main : program -> string -> lambda result module Captured_variables : sig type bindings = expression_variable list - val matching : (bindings -> 'a -> bindings result) -> bindings -> ('a, type_value) matching -> bindings result + val matching : (bindings -> 'a -> bindings result) -> bindings -> ('a, type_expression) matching_content -> bindings result val matching_expression : bindings -> matching_expr -> bindings result diff --git a/src/stages/ast_typed/types.ml b/src/stages/ast_typed/types.ml index 4e3355ce4..5aa323c9b 100644 --- a/src/stages/ast_typed/types.ml +++ b/src/stages/ast_typed/types.ml @@ -3,6 +3,12 @@ module S = Ast_simplified include Stage_common.Types +module Ast_typed_type_parameter = struct + type type_meta = S.type_expression option +end + +include Ast_generic_type (Ast_typed_type_parameter) + type program = declaration Location.wrap list and inline = bool @@ -13,105 +19,108 @@ and declaration = * a boolean indicating whether it should be inlined * the environment before the declaration (the original environment) * the environment after the declaration (i.e. with that new declaration added to the original environment). *) - | Declaration_constant of (named_expression * inline * (full_environment * full_environment)) + | Declaration_constant of (expression_variable * expression * inline * full_environment) + (* + | Declaration_type of (type_variable * type_expression) + | Declaration_constant of (named_expression * (full_environment * full_environment)) + *) +(* | Macro_declaration of macro_declaration *) + +and expression = + { expression_content: expression_content + ; location: Location.t + ; type_expression: type_expression + ; environment: full_environment } + +and expression_content = + (* Base *) + | E_literal of literal + | E_constant of constant (* For language constants, like (Cons hd tl) or (plus i j) *) + | E_variable of expression_variable + | E_application of application + | E_lambda of lambda + | E_let_in of let_in + (* Variant *) + | E_constructor of constructor (* For user defined constructors *) + | E_matching of matching + (* Record *) + | E_record of expression label_map + | E_record_accessor of accessor + | E_record_update of update + (* Data Structures *) + (* TODO : move to constant*) + | E_map of (expression * expression) list (*move to operator *) + | E_big_map of (expression * expression) list (*move to operator *) + | E_list of expression list + | E_set of expression list + | E_look_up of (expression * expression) + (* Advanced *) + | E_loop of loop + (* + | E_ascription of ascription + *) + +and constant = + { cons_name: constant' (* this is at the end because it is huge *) + ; arguments: expression list } + + +and application = {expr1: expression; expr2: expression} + +and lambda = + { binder: expression_variable + (* ; input_type: type_expression option + ; output_type: type_expression option *) + ; result: expression } + +and let_in = + { let_binder: expression_variable + ; rhs: expression + ; let_result: expression + ; inline : inline } + +and constructor = {constructor: constructor'; element: expression} + +and accessor = {expr: expression; label: label} + +and update = {record: expression; path: label ; update: expression} + +and loop = {condition: expression; body: expression} + +and matching_expr = (expression,type_expression) matching_content +and matching = + { matchee: expression + ; cases: matching_expr + } + +and ascription = {anno_expr: expression; type_annotation: type_expression} + and environment_element_definition = | ED_binder - | ED_declaration of (annotated_expression * free_variables) + | ED_declaration of (expression * free_variables) and free_variables = expression_variable list -and environment_element = { - type_value : type_value ; - source_environment : full_environment ; - definition : environment_element_definition ; -} +and environment_element = + { type_value: type_expression + ; source_environment: full_environment + ; definition: environment_element_definition } + and environment = (expression_variable * environment_element) list -and type_environment = (type_variable * type_value) list (* SUBST ??? *) -and small_environment = (environment * type_environment) + +and type_environment = (type_variable * type_expression) list + +(* SUBST ??? *) +and small_environment = environment * type_environment + and full_environment = small_environment List.Ne.t -and annotated_expression = { - expression : expression ; - type_annotation : type_value ; (* SUBST *) - environment : full_environment ; - location : Location.t ; +and expr = expression + +and texpr = type_expression + +and named_type_content = { + type_name : type_variable; + type_value : type_expression; } - -(* This seems to be used only for top-level declarations, and - represents the name of the top-level binding, and the expression - assigned to it. -- Suzanne. - - TODO: if this is correct, then we should inline this in - "declaration" or at least move it close to it. *) -and named_expression = { - name: expression_variable ; - annotated_expression: ae ; -} - -and ae = annotated_expression -and type_value' = type_value type_expression' - -and type_value = { - type_value' : type_value'; - simplified : S.type_expression option ; (* If we have the simplified this AST fragment comes from, it is stored here, for easier untyping. *) -} - -(* This is used in E_assign of (named_type_value * access_path * ae). - In mini_c, we need the type associated with `x` in the assignment - expression `x.y.z := 42`, so it is stored here. *) -and named_type_value = { - type_name: expression_variable ; - type_value : type_value ; -} - -(* E_lamba and other expressions are always wrapped as an annotated_expression. *) -and lambda = { - binder : expression_variable ; - (* input_type: tv ; - * output_type: tv ; *) - body : ae ; -} - -and let_in = { - binder: expression_variable; - rhs: ae; - result: ae; - inline: inline; -} - -and 'a expression' = - (* Base *) - | E_literal of literal - | E_constant of (constant * ('a) list) (* For language constants, like (Cons hd tl) or (plus i j) *) - | E_variable of expression_variable - | E_application of (('a) * ('a)) - | E_lambda of lambda - | E_let_in of let_in - (* Tuple, TODO: remove tuples and use records with integer keys instead *) - | E_tuple of ('a) list - | E_tuple_accessor of (('a) * int) (* Access n'th tuple's element *) - (* Sum *) - | E_constructor of (constructor * ('a)) (* For user defined constructors *) - (* Record *) - | E_record of ('a) label_map - | E_record_accessor of (('a) * label) - | E_record_update of ('a * (label * 'a)) - (* Data Structures *) - | E_map of (('a) * ('a)) list - | E_big_map of (('a) * ('a)) list - | E_list of ('a) list - | E_set of ('a) list - | E_look_up of (('a) * ('a)) - (* Advanced *) - | E_matching of (('a) * matching_expr) - (* Replace Statements *) - | E_sequence of (('a) * ('a)) - | E_loop of (('a) * ('a)) - | E_assign of (named_type_value * access_path * ('a)) - -and expression = ae expression' - -and value = annotated_expression (* todo (for refactoring) *) - -and matching_expr = (ae,type_value) matching diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index 1b9e7b4eb..8c0157300 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -2,19 +2,28 @@ open Types open Format open PP_helpers -let name ppf (n:expression_variable) : unit = - fprintf ppf "%a" Var.pp n -let type_variable ppf (t:type_variable) : unit = - fprintf ppf "%a" Var.pp t - -let constructor ppf (c:constructor) : unit = +let constructor ppf (c:constructor') : unit = let Constructor c = c in fprintf ppf "%s" c let label ppf (l:label) : unit = let Label l = l in fprintf ppf "%s" l -let constant ppf : constant -> unit = function +let cmap_sep value sep ppf m = + let lst = CMap.to_kv_list m in + let new_pp ppf (k, v) = fprintf ppf "%a -> %a" constructor k value v in + fprintf ppf "%a" (list_sep new_pp sep) lst + +let lmap_sep value sep ppf m = + let lst = LMap.to_kv_list m in + let new_pp ppf (k, v) = fprintf ppf "%a -> %a" label k value v in + fprintf ppf "%a" (list_sep new_pp sep) lst + +let list_sep_d x = list_sep x (const " , ") +let cmap_sep_d x = cmap_sep x (const " , ") +let lmap_sep_d x = lmap_sep x (const " , ") + +let constant ppf : constant' -> unit = function | C_INT -> fprintf ppf "INT" | C_UNIT -> fprintf ppf "UNIT" | C_NIL -> fprintf ppf "NIL" @@ -84,6 +93,8 @@ let constant ppf : constant -> unit = function | C_MAP -> fprintf ppf "MAP" | C_MAP_EMPTY -> fprintf ppf "MAP_EMPTY" | C_MAP_LITERAL -> fprintf ppf "MAP_LITERAL" + | C_MAP_GET -> fprintf ppf "MAP_GET" + | C_MAP_GET_FORCE -> fprintf ppf "MAP_GET_FORCE" | C_MAP_ADD -> fprintf ppf "MAP_ADD" | C_MAP_REMOVE -> fprintf ppf "MAP_REMOVE" | C_MAP_UPDATE -> fprintf ppf "MAP_UPDATE" @@ -101,6 +112,7 @@ let constant ppf : constant -> unit = function | C_SHA256 -> fprintf ppf "SHA256" | C_SHA512 -> fprintf ppf "SHA512" | C_BLAKE2b -> fprintf ppf "BLAKE2b" + | C_HASH -> fprintf ppf "HASH" | C_HASH_KEY -> fprintf ppf "HASH_KEY" | C_CHECK_SIGNATURE -> fprintf ppf "CHECK_SIGNATURE" | C_CHAIN_ID -> fprintf ppf "CHAIN_ID" @@ -120,85 +132,119 @@ let constant ppf : constant -> unit = function | C_SET_DELEGATE -> fprintf ppf "SET_DELEGATE" | C_STEPS_TO_QUOTA -> fprintf ppf "STEPS_TO_QUOTA" -let cmap_sep value sep ppf m = - let lst = Types.CMap.to_kv_list m in - let new_pp ppf (k, v) = fprintf ppf "%a -> %a" constructor k value v in - fprintf ppf "%a" (list_sep new_pp sep) lst +let literal ppf (l : literal) = + match l with + | Literal_unit -> + fprintf ppf "unit" + | Literal_void -> + fprintf ppf "void" + | Literal_bool b -> + fprintf ppf "%b" b + | Literal_int n -> + fprintf ppf "%d" n + | Literal_nat n -> + fprintf ppf "+%d" n + | Literal_timestamp n -> + fprintf ppf "+%d" n + | Literal_mutez n -> + fprintf ppf "%dmutez" n + | Literal_string s -> + fprintf ppf "%S" s + | Literal_bytes b -> + fprintf ppf "0x%s" @@ Bytes.to_string @@ Bytes.escaped b + | Literal_address s -> + fprintf ppf "@%S" s + | Literal_operation _ -> + fprintf ppf "Operation(...bytes)" + | Literal_key s -> + fprintf ppf "key %s" s + | Literal_key_hash s -> + fprintf ppf "key_hash %s" s + | Literal_signature s -> + fprintf ppf "Signature %s" s + | Literal_chain_id s -> + fprintf ppf "Chain_id %s" s +module Ast_PP_type (PARAMETER : AST_PARAMETER_TYPE) = struct + module Agt=Ast_generic_type(PARAMETER) + open Agt + open Format -let lmap_sep value sep ppf m = - let lst = Types.LMap.to_kv_list m in - let new_pp ppf (k, v) = fprintf ppf "%a -> %a" label k value v in - fprintf ppf "%a" (list_sep new_pp sep) lst + let type_variable ppf (t : type_variable) : unit = fprintf ppf "%a" Var.pp t -let lrecord_sep value sep ppf m = - let lst = Types.LMap.to_kv_list m in - let new_pp ppf (k, v) = fprintf ppf "%a = %a" label k value v in - fprintf ppf "%a" (list_sep new_pp sep) lst + let rec type_expression' : + (formatter -> type_expression -> unit) + -> formatter + -> type_expression + -> unit = + fun f ppf te -> + match te.type_content with + | T_sum m -> + fprintf ppf "sum[%a]" (cmap_sep_d f) m + | T_record m -> + fprintf ppf "record[%a]" (lmap_sep_d f) m + | T_arrow a -> + fprintf ppf "%a -> %a" f a.type1 f a.type2 + | T_variable tv -> + type_variable ppf tv + | T_constant tc -> + type_constant ppf tc + | T_operator to_ -> + type_operator f ppf to_ -let list_sep_d x = list_sep x (const " , ") -let cmap_sep_d x = cmap_sep x (const " , ") -let lmap_sep_d x = lmap_sep x (const " , ") + and type_expression ppf (te : type_expression) : unit = + type_expression' type_expression ppf te -let rec type_expression' : type a . (formatter -> a -> unit) -> formatter -> a type_expression' -> unit = - fun f ppf te -> - match te with - | T_sum m -> fprintf ppf "sum[%a]" (cmap_sep_d f) m - | T_record m -> fprintf ppf "record[%a]" (lmap_sep_d f ) m - | T_arrow (a, b) -> fprintf ppf "%a -> %a" f a f b - | T_variable tv -> type_variable ppf tv - | T_constant tc -> type_constant ppf tc - | T_operator to_ -> type_operator f ppf to_ - -and type_constant ppf (tc:type_constant) : unit = - let s = match tc with - | TC_unit -> "unit" - | TC_string -> "string" - | TC_bytes -> "bytes" - | TC_nat -> "nat" - | TC_int -> "int" - | TC_mutez -> "mutez" - | TC_bool -> "bool" - | TC_operation -> "operation" - | TC_address -> "address" - | TC_key -> "key" - | TC_key_hash -> "key_hash" - | TC_signature -> "signature" - | TC_timestamp -> "timestamp" - | TC_chain_id -> "chain_id" + and type_constant ppf (tc : type_constant) : unit = + let s = + match tc with + | TC_unit -> + "unit" + | TC_string -> + "string" + | TC_bytes -> + "bytes" + | TC_nat -> + "nat" + | TC_int -> + "int" + | TC_mutez -> + "mutez" + | TC_bool -> + "bool" + | TC_operation -> + "operation" + | TC_address -> + "address" + | TC_key -> + "key" + | TC_key_hash -> + "key_hash" + | TC_signature -> + "signatuer" + | TC_timestamp -> + "timestamp" + | TC_chain_id -> + "chain_id" + | TC_void -> + "void" in - fprintf ppf "%s" s + fprintf ppf "%s" s - -and type_operator : type a . (formatter -> a -> unit) -> formatter -> a type_operator -> unit = - fun f ppf to_ -> - let s = match to_ with - | TC_option (tv) -> Format.asprintf "option(%a)" f tv - | TC_list (tv) -> Format.asprintf "list(%a)" f tv - | TC_set (tv) -> Format.asprintf "set(%a)" f tv - | TC_map (k, v) -> Format.asprintf "Map (%a,%a)" f k f v - | TC_big_map (k, v) -> Format.asprintf "Big Map (%a,%a)" f k f v - | TC_contract (c) -> Format.asprintf "Contract (%a)" f c - | TC_arrow (a , b) -> Format.asprintf "TC_Arrow (%a,%a)" f a f b - | TC_tuple lst -> Format.asprintf "tuple[%a]" (list_sep_d f) lst + and type_operator : + (formatter -> type_expression -> unit) + -> formatter + -> type_operator + -> unit = + fun f ppf to_ -> + let s = + match to_ with + | TC_option te -> Format.asprintf "option(%a)" f te + | TC_list te -> Format.asprintf "list(%a)" f te + | TC_set te -> Format.asprintf "set(%a)" f te + | TC_map (k, v) -> Format.asprintf "Map (%a,%a)" f k f v + | TC_big_map (k, v) -> Format.asprintf "Big Map (%a,%a)" f k f v + | TC_arrow (k, v) -> Format.asprintf "arrow (%a,%a)" f k f v + | TC_contract te -> Format.asprintf "Contract (%a)" f te in - fprintf ppf "(TO_%s)" s - -let literal ppf (l:literal) = match l with - | Literal_unit -> fprintf ppf "Unit" - | Literal_bool b -> fprintf ppf "%b" b - | Literal_int n -> fprintf ppf "%d" n - | Literal_nat n -> fprintf ppf "+%d" n - | Literal_timestamp n -> fprintf ppf "+%d" n - | Literal_mutez n -> fprintf ppf "%dmutez" n - | Literal_string s -> fprintf ppf "%S" s - | Literal_bytes b -> fprintf ppf "0x%a" Hex.pp (Hex.of_bytes b) - | Literal_address s -> fprintf ppf "address %S" s - | Literal_operation _ -> fprintf ppf "Operation(...bytes)" - | Literal_key s -> fprintf ppf "key %s" s - | Literal_key_hash s -> fprintf ppf "key_hash %s" s - | Literal_signature s -> fprintf ppf "signature %s" s - | Literal_chain_id s -> fprintf ppf "chain_id %s" s - -let%expect_test _ = - Format.printf "%a" literal (Literal_bytes (Bytes.of_string "foo")) ; - [%expect{| 0x666f6f |}] + fprintf ppf "(TO_%s)" s +end diff --git a/src/stages/common/PP.mli b/src/stages/common/PP.mli deleted file mode 100644 index 0d6a75434..000000000 --- a/src/stages/common/PP.mli +++ /dev/null @@ -1,16 +0,0 @@ -open Types -open Format - -val name : formatter -> expression_variable -> unit -val type_variable : formatter -> type_variable -> unit -val constructor : formatter -> constructor -> unit -val label : formatter -> label -> unit -val constant : formatter -> constant -> unit -val cmap_sep : (formatter -> 'a -> unit) -> (formatter -> unit -> unit) -> formatter -> 'a CMap.t -> unit -val lmap_sep : (formatter -> 'a -> unit) -> (formatter -> unit -> unit) -> formatter -> 'a LMap.t -> unit -val lrecord_sep : (formatter -> 'a -> unit) -> (formatter -> unit -> unit) -> formatter -> 'a LMap.t -> unit -val type_expression' : (formatter -> 'a -> unit) -> formatter -> 'a type_expression' -> unit -val type_operator : (formatter -> 'a -> unit) -> formatter -> 'a type_operator -> unit -val type_constant : formatter -> type_constant -> unit -val literal : formatter -> literal -> unit -val list_sep_d : (formatter -> 'a -> unit) -> formatter -> 'a list -> unit diff --git a/src/stages/common/ast_common.ml b/src/stages/common/ast_common.ml index b570d3941..eefa2903c 100644 --- a/src/stages/common/ast_common.ml +++ b/src/stages/common/ast_common.ml @@ -1,3 +1,3 @@ module Types = Types module PP = PP -module Misc = Misc +module Helpers = Helpers diff --git a/src/stages/common/helpers.ml b/src/stages/common/helpers.ml new file mode 100644 index 000000000..71deaeecb --- /dev/null +++ b/src/stages/common/helpers.ml @@ -0,0 +1,30 @@ +open Types + +let bind_lmap (l:_ label_map) = + let open Trace in + let open LMap in + let aux k v prev = + prev >>? fun prev' -> + v >>? fun v' -> + ok @@ add k v' prev' in + fold aux l (ok empty) + +let bind_cmap (c:_ constructor_map) = + let open Trace in + let open CMap in + let aux k v prev = + prev >>? fun prev' -> + v >>? fun v' -> + ok @@ add k v' prev' in + fold aux c (ok empty) + +let bind_fold_lmap f init (lmap:_ LMap.t) = + let open Trace in + let aux k v prev = + prev >>? fun prev' -> + f prev' k v + in + LMap.fold aux lmap init + +let bind_map_lmap f map = bind_lmap (LMap.map f map) +let bind_map_cmap f map = bind_cmap (CMap.map f map) diff --git a/src/stages/common/misc.ml b/src/stages/common/misc.ml deleted file mode 100644 index c753d7f3b..000000000 --- a/src/stages/common/misc.ml +++ /dev/null @@ -1,94 +0,0 @@ -open Types -open Trace - -let map_type_operator f = function - TC_contract x -> TC_contract (f x) - | TC_option x -> TC_option (f x) - | TC_list x -> TC_list (f x) - | TC_set x -> TC_set (f x) - | TC_map (x , y) -> TC_map (f x , f y) - | TC_big_map (x , y) -> TC_big_map (f x , f y) - | TC_arrow (x , y) -> TC_arrow (f x , f y) - | TC_tuple lst -> TC_tuple (List.map f lst) - -let bind_map_type_operator f = function - TC_contract x -> let%bind x = f x in ok @@ TC_contract x - | TC_option x -> let%bind x = f x in ok @@ TC_option x - | TC_list x -> let%bind x = f x in ok @@ TC_list x - | TC_set x -> let%bind x = f x in ok @@ TC_set x - | TC_map (x , y) -> let%bind x = f x in let%bind y = f y in ok @@ TC_map (x , y) - | TC_big_map (x , y) -> let%bind x = f x in let%bind y = f y in ok @@ TC_big_map (x , y) - | TC_arrow (x , y) -> let%bind x = f x in let%bind y = f y in ok @@ TC_arrow (x , y) - | TC_tuple lst -> let%bind lst = bind_map_list f lst in ok @@ TC_tuple lst - -let type_operator_name = function - TC_contract _ -> "TC_contract" - | TC_option _ -> "TC_option" - | TC_list _ -> "TC_list" - | TC_set _ -> "TC_set" - | TC_map _ -> "TC_map" - | TC_big_map _ -> "TC_big_map" - | TC_arrow _ -> "TC_arrow" - | TC_tuple _ -> "TC_tuple" - -let type_expression'_of_string = function - | "TC_contract" , [x] -> ok @@ T_operator(TC_contract x) - | "TC_option" , [x] -> ok @@ T_operator(TC_option x) - | "TC_list" , [x] -> ok @@ T_operator(TC_list x) - | "TC_set" , [x] -> ok @@ T_operator(TC_set x) - | "TC_map" , [x ; y] -> ok @@ T_operator(TC_map (x , y)) - | "TC_big_map" , [x ; y] -> ok @@ T_operator(TC_big_map (x, y)) - | ("TC_contract" | "TC_option" | "TC_list" | "TC_set" | "TC_map" | "TC_big_map"), _ -> - failwith "internal error: wrong number of arguments for type operator" - - | "TC_unit" , [] -> ok @@ T_constant(TC_unit) - | "TC_string" , [] -> ok @@ T_constant(TC_string) - | "TC_bytes" , [] -> ok @@ T_constant(TC_bytes) - | "TC_nat" , [] -> ok @@ T_constant(TC_nat) - | "TC_int" , [] -> ok @@ T_constant(TC_int) - | "TC_mutez" , [] -> ok @@ T_constant(TC_mutez) - | "TC_bool" , [] -> ok @@ T_constant(TC_bool) - | "TC_operation" , [] -> ok @@ T_constant(TC_operation) - | "TC_address" , [] -> ok @@ T_constant(TC_address) - | "TC_key" , [] -> ok @@ T_constant(TC_key) - | "TC_key_hash" , [] -> ok @@ T_constant(TC_key_hash) - | "TC_chain_id" , [] -> ok @@ T_constant(TC_chain_id) - | "TC_signature" , [] -> ok @@ T_constant(TC_signature) - | "TC_timestamp" , [] -> ok @@ T_constant(TC_timestamp) - | _, [] -> - failwith "internal error: wrong number of arguments for type constant" - | op, _ -> - failwith (Format.asprintf "internal error: unknown type operator in src/stages/common/misc.ml %s" op) - -let string_of_type_operator = function - | TC_contract x -> "TC_contract" , [x] - | TC_option x -> "TC_option" , [x] - | TC_list x -> "TC_list" , [x] - | TC_set x -> "TC_set" , [x] - | TC_map (x , y) -> "TC_map" , [x ; y] - | TC_big_map (x , y) -> "TC_big_map" , [x ; y] - | TC_arrow (x , y) -> "TC_arrow" , [x ; y] - | TC_tuple lst -> "TC_tuple" , lst - -let string_of_type_constant = function - | TC_unit -> "TC_unit", [] - | TC_string -> "TC_string", [] - | TC_bytes -> "TC_bytes", [] - | TC_nat -> "TC_nat", [] - | TC_int -> "TC_int", [] - | TC_mutez -> "TC_mutez", [] - | TC_bool -> "TC_bool", [] - | TC_operation -> "TC_operation", [] - | TC_address -> "TC_address", [] - | TC_key -> "TC_key", [] - | TC_key_hash -> "TC_key_hash", [] - | TC_chain_id -> "TC_chain_id", [] - | TC_signature -> "TC_signature", [] - | TC_timestamp -> "TC_timestamp", [] - -let string_of_type_expression' = function - | T_operator o -> string_of_type_operator o - | T_constant c -> string_of_type_constant c - | T_sum _|T_record _|T_arrow (_, _)|T_variable _ -> - failwith "not a type operator or constant" - diff --git a/src/stages/common/misc.mli b/src/stages/common/misc.mli deleted file mode 100644 index 78dfaf17e..000000000 --- a/src/stages/common/misc.mli +++ /dev/null @@ -1,9 +0,0 @@ -open Types - -val map_type_operator : ('a -> 'b) -> 'a type_operator -> 'b type_operator -val bind_map_type_operator : ('a -> ('b * 'c list, 'd) Pervasives.result) -> 'a type_operator -> ('b type_operator * 'c list, 'd) Pervasives.result -val type_operator_name : 'a type_operator -> string -val type_expression'_of_string : string * 'a list -> ('a type_expression' * 'b list, 'c) Pervasives.result -val string_of_type_operator : 'a type_operator -> string * 'a list -val string_of_type_constant : type_constant -> string * 'a list -val string_of_type_expression' : 'a type_expression' -> string * 'a list diff --git a/src/stages/common/types.ml b/src/stages/common/types.ml index e87b0682a..9cc8f2998 100644 --- a/src/stages/common/types.ml +++ b/src/stages/common/types.ml @@ -1,54 +1,155 @@ - type expression_ +and expression_variable = expression_ Var.t type type_ +and type_variable = type_ Var.t -type expression_variable = expression_ Var.t -type type_variable = type_ Var.t -type constructor = Constructor of string + +type constructor' = Constructor of string type label = Label of string -module CMap = Map.Make( struct type t = constructor let compare (Constructor a) (Constructor b) = compare a b end) + +module CMap = Map.Make( struct type t = constructor' let compare (Constructor a) (Constructor b) = compare a b end) module LMap = Map.Make( struct type t = label let compare (Label a) (Label b) = String.compare a b end) type 'a label_map = 'a LMap.t type 'a constructor_map = 'a CMap.t + and type_constant = + | TC_unit + | TC_string + | TC_bytes + | TC_nat + | TC_int + | TC_mutez + | TC_bool + | TC_operation + | TC_address + | TC_key + | TC_key_hash + | TC_chain_id + | TC_signature + | TC_timestamp + | TC_void +module type AST_PARAMETER_TYPE = sig + type type_meta +end -let bind_lmap (l:_ label_map) = - let open Trace in - let open LMap in - let aux k v prev = - prev >>? fun prev' -> - v >>? fun v' -> - ok @@ add k v' prev' in - fold aux l (ok empty) +module Ast_generic_type (PARAMETER : AST_PARAMETER_TYPE) = struct + open PARAMETER -let bind_cmap (c:_ constructor_map) = - let open Trace in - let open CMap in - let aux k v prev = - prev >>? fun prev' -> - v >>? fun v' -> - ok @@ add k v' prev' in - fold aux c (ok empty) + type type_content = + | T_sum of type_expression constructor_map + | T_record of type_expression label_map + | T_arrow of arrow + | T_variable of type_variable + | T_constant of type_constant + | T_operator of type_operator -let bind_fold_lmap f init (lmap:_ LMap.t) = - let open Trace in - let aux k v prev = - prev >>? fun prev' -> - f prev' k v - in - LMap.fold aux lmap init + and arrow = {type1: type_expression; type2: type_expression} -let bind_map_lmap f map = bind_lmap (LMap.map f map) -let bind_map_cmap f map = bind_cmap (CMap.map f map) + and type_operator = + | TC_contract of type_expression + | TC_option of type_expression + | TC_list of type_expression + | TC_set of type_expression + | TC_map of type_expression * type_expression + | TC_big_map of type_expression * type_expression + | TC_arrow of type_expression * type_expression -type access = - | Access_tuple of int - | Access_record of string -and access_path = access list + and type_expression = {type_content: type_content; type_meta: type_meta} -and literal = + open Trace + let map_type_operator f = function + TC_contract x -> TC_contract (f x) + | TC_option x -> TC_option (f x) + | TC_list x -> TC_list (f x) + | TC_set x -> TC_set (f x) + | TC_map (x , y) -> TC_map (f x , f y) + | TC_big_map (x , y)-> TC_big_map (f x , f y) + | TC_arrow (x, y) -> TC_arrow (f x, f y) + + let bind_map_type_operator f = function + TC_contract x -> let%bind x = f x in ok @@ TC_contract x + | TC_option x -> let%bind x = f x in ok @@ TC_option x + | TC_list x -> let%bind x = f x in ok @@ TC_list x + | TC_set x -> let%bind x = f x in ok @@ TC_set x + | TC_map (x , y) -> let%bind x = f x in let%bind y = f y in ok @@ TC_map (x , y) + | TC_big_map (x , y)-> let%bind x = f x in let%bind y = f y in ok @@ TC_big_map (x , y) + | TC_arrow (x , y)-> let%bind x = f x in let%bind y = f y in ok @@ TC_arrow (x , y) + + let type_operator_name = function + TC_contract _ -> "TC_contract" + | TC_option _ -> "TC_option" + | TC_list _ -> "TC_list" + | TC_set _ -> "TC_set" + | TC_map _ -> "TC_map" + | TC_big_map _ -> "TC_big_map" + | TC_arrow _ -> "TC_arrow" + + let type_expression'_of_string = function + | "TC_contract" , [x] -> ok @@ T_operator(TC_contract x) + | "TC_option" , [x] -> ok @@ T_operator(TC_option x) + | "TC_list" , [x] -> ok @@ T_operator(TC_list x) + | "TC_set" , [x] -> ok @@ T_operator(TC_set x) + | "TC_map" , [x ; y] -> ok @@ T_operator(TC_map (x , y)) + | "TC_big_map" , [x ; y] -> ok @@ T_operator(TC_big_map (x, y)) + | ("TC_contract" | "TC_option" | "TC_list" | "TC_set" | "TC_map" | "TC_big_map"), _ -> + failwith "internal error: wrong number of arguments for type operator" + + | "TC_unit" , [] -> ok @@ T_constant(TC_unit) + | "TC_string" , [] -> ok @@ T_constant(TC_string) + | "TC_bytes" , [] -> ok @@ T_constant(TC_bytes) + | "TC_nat" , [] -> ok @@ T_constant(TC_nat) + | "TC_int" , [] -> ok @@ T_constant(TC_int) + | "TC_mutez" , [] -> ok @@ T_constant(TC_mutez) + | "TC_bool" , [] -> ok @@ T_constant(TC_bool) + | "TC_operation" , [] -> ok @@ T_constant(TC_operation) + | "TC_address" , [] -> ok @@ T_constant(TC_address) + | "TC_key" , [] -> ok @@ T_constant(TC_key) + | "TC_key_hash" , [] -> ok @@ T_constant(TC_key_hash) + | "TC_chain_id" , [] -> ok @@ T_constant(TC_chain_id) + | "TC_signature" , [] -> ok @@ T_constant(TC_signature) + | "TC_timestamp" , [] -> ok @@ T_constant(TC_timestamp) + | _, [] -> + failwith "internal error: wrong number of arguments for type constant" + | _ -> + failwith "internal error: unknown type operator" + + let string_of_type_operator = function + | TC_contract x -> "TC_contract" , [x] + | TC_option x -> "TC_option" , [x] + | TC_list x -> "TC_list" , [x] + | TC_set x -> "TC_set" , [x] + | TC_map (x , y) -> "TC_map" , [x ; y] + | TC_big_map (x , y) -> "TC_big_map" , [x ; y] + | TC_arrow (x , y) -> "TC_arrow" , [x ; y] + + let string_of_type_constant = function + | TC_unit -> "TC_unit", [] + | TC_string -> "TC_string", [] + | TC_bytes -> "TC_bytes", [] + | TC_nat -> "TC_nat", [] + | TC_int -> "TC_int", [] + | TC_mutez -> "TC_mutez", [] + | TC_bool -> "TC_bool", [] + | TC_operation -> "TC_operation", [] + | TC_address -> "TC_address", [] + | TC_key -> "TC_key", [] + | TC_key_hash -> "TC_key_hash", [] + | TC_chain_id -> "TC_chain_id", [] + | TC_signature -> "TC_signature", [] + | TC_timestamp -> "TC_timestamp", [] + | TC_void -> "TC_void", [] + + let string_of_type_expression' = function + | T_operator o -> string_of_type_operator o + | T_constant c -> string_of_type_constant c + | T_sum _ | T_record _ | T_arrow _ | T_variable _ -> + failwith "not a type operator or constant" + +end + +type literal = | Literal_unit | Literal_bool of bool | Literal_int of int @@ -62,60 +163,10 @@ and literal = | Literal_key of string | Literal_key_hash of string | Literal_chain_id of string - | Literal_operation of Memory_proto_alpha.Protocol.Alpha_context.packed_internal_operation - -(* The ast is a tree of node, 'a is the type of the node (type_variable or {type_variable, previous_type}) *) -type 'a type_expression' = - | T_sum of 'a constructor_map - | T_record of 'a label_map - | T_arrow of 'a * 'a - | T_variable of type_variable - | T_constant of type_constant - | T_operator of 'a type_operator -and type_constant = - | TC_unit - | TC_string - | TC_bytes - | TC_nat - | TC_int - | TC_mutez - | TC_bool - | TC_operation - | TC_address - | TC_key - | TC_key_hash - | TC_chain_id - | TC_signature - | TC_timestamp - -and 'a type_operator = - | TC_contract of 'a - | TC_option of 'a - | TC_list of 'a - | TC_set of 'a - | TC_map of 'a * 'a - | TC_big_map of 'a * 'a - | TC_arrow of 'a * 'a - | TC_tuple of 'a list - -type type_base = - | Base_unit - | Base_string - | Base_bytes - | Base_nat - | Base_int - | Base_mutez - | Base_bool - | Base_operation - | Base_address - | Base_void - | Base_timestamp - | Base_signature - | Base_key - | Base_key_hash - | Base_chain_id - -and ('a,'tv) matching = + | Literal_void + | Literal_operation of + Memory_proto_alpha.Protocol.Alpha_context.packed_internal_operation +and ('a,'tv) matching_content = | Match_bool of { match_true : 'a ; match_false : 'a ; @@ -129,9 +180,9 @@ and ('a,'tv) matching = match_some : expression_variable * 'a * 'tv; } | Match_tuple of (expression_variable list * 'a) * 'tv list - | Match_variant of ((constructor * expression_variable) * 'a) list * 'tv + | Match_variant of ((constructor' * expression_variable) * 'a) list * 'tv -type constant = +and constant' = | C_INT | C_UNIT | C_NIL @@ -201,6 +252,8 @@ type constant = | C_MAP | C_MAP_EMPTY | C_MAP_LITERAL + | C_MAP_GET + | C_MAP_GET_FORCE | C_MAP_ADD | C_MAP_REMOVE | C_MAP_UPDATE @@ -218,6 +271,7 @@ type constant = | C_SHA256 | C_SHA512 | C_BLAKE2b + | C_HASH | C_HASH_KEY | C_CHECK_SIGNATURE | C_CHAIN_ID diff --git a/src/stages/mini_c/PP.ml b/src/stages/mini_c/PP.ml index 14fa1846a..c9655dc24 100644 --- a/src/stages/mini_c/PP.ml +++ b/src/stages/mini_c/PP.ml @@ -2,7 +2,6 @@ open Simple_utils.PP_helpers open Types open Format -include Stage_common.PP let list_sep_d x = list_sep x (const " , ") @@ -10,27 +9,10 @@ let space_sep ppf () = fprintf ppf " " let lr = fun ppf -> function `Left -> fprintf ppf "L" | `Right -> fprintf ppf "R" -let type_base ppf : type_base -> _ = function - | Base_unit -> fprintf ppf "unit" - | Base_void -> fprintf ppf "void" - | Base_bool -> fprintf ppf "bool" - | Base_int -> fprintf ppf "int" - | Base_nat -> fprintf ppf "nat" - | Base_mutez -> fprintf ppf "tez" - | Base_string -> fprintf ppf "string" - | Base_address -> fprintf ppf "address" - | Base_timestamp -> fprintf ppf "timestamp" - | Base_bytes -> fprintf ppf "bytes" - | Base_operation -> fprintf ppf "operation" - | Base_signature -> fprintf ppf "signature" - | Base_key -> fprintf ppf "key" - | Base_key_hash -> fprintf ppf "key_hash" - | Base_chain_id -> fprintf ppf "chain_id" - let rec type_variable ppf : type_value -> _ = function | T_or(a, b) -> fprintf ppf "(%a) | (%a)" annotated a annotated b | T_pair(a, b) -> fprintf ppf "(%a) & (%a)" annotated a annotated b - | T_base b -> type_base ppf b + | T_base b -> type_constant ppf b | T_function(a, b) -> fprintf ppf "(%a) -> (%a)" type_variable a type_variable b | T_map(k, v) -> fprintf ppf "map(%a -> %a)" type_variable k type_variable v | T_big_map(k, v) -> fprintf ppf "big_map(%a -> %a)" type_variable k type_variable v @@ -44,11 +26,31 @@ and annotated ppf : type_value annotated -> _ = function | (None, a) -> type_variable ppf a and environment_element ppf ((n, tv) : environment_element) = - Format.fprintf ppf "%a : %a" Stage_common.PP.name n type_variable tv + Format.fprintf ppf "%a : %a" Var.pp n type_variable tv and environment ppf (x:environment) = fprintf ppf "Env[%a]" (list_sep_d environment_element) x +and type_constant ppf (tc:type_constant) : unit = + let s = match tc with + | TC_unit -> "unit" + | TC_string -> "string" + | TC_bytes -> "bytes" + | TC_nat -> "nat" + | TC_int -> "int" + | TC_mutez -> "mutez" + | TC_bool -> "bool" + | TC_operation -> "operation" + | TC_address -> "address" + | TC_key -> "key" + | TC_key_hash -> "key_hash" + | TC_signature -> "signatuer" + | TC_timestamp -> "timestamp" + | TC_chain_id -> "chain_id" + | TC_void -> "void" + in + fprintf ppf "(TC %s)" s + let rec value ppf : value -> unit = function | D_bool b -> fprintf ppf "%b" b | D_operation _ -> fprintf ppf "operation[...bytes]" @@ -73,12 +75,16 @@ let rec value ppf : value -> unit = function and value_assoc ppf : (value * value) -> unit = fun (a, b) -> fprintf ppf "%a -> %a" value a value b +and expression ppf (e:expression) = + fprintf ppf "%a" expression' e.content + and expression' ppf (e:expression') = match e with | E_skip -> fprintf ppf "skip" | E_closure x -> fprintf ppf "C(%a)" function_ x - | E_variable v -> fprintf ppf "V(%a)" Stage_common.PP.name v + | E_variable v -> fprintf ppf "V(%a)" Var.pp v | E_application(a, b) -> fprintf ppf "(%a)@(%a)" expression a expression b - | E_constant(p, lst) -> fprintf ppf "%a %a" Stage_common.PP.constant p (pp_print_list ~pp_sep:space_sep expression) lst + + | E_constant c -> fprintf ppf "%a %a" constant c.cons_name (pp_print_list ~pp_sep:space_sep expression) c.arguments | E_literal v -> fprintf ppf "L(%a)" value v | E_make_empty_map _ -> fprintf ppf "map[]" | E_make_empty_big_map _ -> fprintf ppf "big_map[]" @@ -86,26 +92,24 @@ and expression' ppf (e:expression') = match e with | E_make_empty_set _ -> fprintf ppf "set[]" | E_make_none _ -> fprintf ppf "none" | E_if_bool (c, a, b) -> fprintf ppf "%a ? %a : %a" expression c expression a expression b - | E_if_none (c, n, ((name, _) , s)) -> fprintf ppf "%a ?? %a : %a -> %a" expression c expression n Stage_common.PP.name name expression s - | E_if_cons (c, n, (((hd_name, _) , (tl_name, _)) , cons)) -> fprintf ppf "%a ?? %a : (%a :: %a) -> %a" expression c expression n Stage_common.PP.name hd_name Stage_common.PP.name tl_name expression cons + | E_if_none (c, n, ((name, _) , s)) -> fprintf ppf "%a ?? %a : %a -> %a" expression c expression n Var.pp name expression s + | E_if_cons (c, n, (((hd_name, _) , (tl_name, _)) , cons)) -> fprintf ppf "%a ?? %a : (%a :: %a) -> %a" expression c expression n Var.pp hd_name Var.pp tl_name expression cons | E_if_left (c, ((name_l, _) , l), ((name_r, _) , r)) -> - fprintf ppf "%a ?? %a -> %a : %a -> %a" expression c Stage_common.PP.name name_l expression l Stage_common.PP.name name_r expression r + fprintf ppf "%a ?? %a -> %a : %a -> %a" expression c Var.pp name_l expression l Var.pp name_r expression r | E_sequence (a , b) -> fprintf ppf "%a ;; %a" expression a expression b | E_let_in ((name , _) , inline, expr , body) -> - fprintf ppf "let %a = %a%a in ( %a )" Stage_common.PP.name name expression expr option_inline inline expression body + fprintf ppf "let %a = %a%a in ( %a )" Var.pp name expression expr option_inline inline expression body | E_iterator (b , ((name , _) , body) , expr) -> - fprintf ppf "for_%a %a of %a do ( %a )" Stage_common.PP.constant b Stage_common.PP.name name expression expr expression body + fprintf ppf "for_%a %a of %a do ( %a )" constant b Var.pp name expression expr expression body | E_fold (((name , _) , body) , collection , initial) -> - fprintf ppf "fold %a on %a with %a do ( %a )" expression collection expression initial Stage_common.PP.name name expression body - | E_assignment (r , path , e) -> - fprintf ppf "%a.%a := %a" Stage_common.PP.name r (list_sep lr (const ".")) path expression e - | E_update (r, (path,e)) -> - fprintf ppf "%a with {%a=%a}" expression r (list_sep lr (const ".")) path expression e - | E_while (e , b) -> - fprintf ppf "while (%a) %a" expression e expression b + fprintf ppf "fold %a on %a with %a do ( %a )" expression collection expression initial Var.pp name expression body -and expression : _ -> expression -> _ = fun ppf e -> - expression' ppf e.content + | E_assignment (r , path , e) -> + fprintf ppf "%a.%a := %a" Var.pp r (list_sep lr (const ".")) path expression e + | E_record_update (r, path,update) -> + fprintf ppf "%a with { %a = %a }" expression r (list_sep lr (const ".")) path expression update + | E_while (e , b) -> + fprintf ppf "while %a do %a" expression e expression b and expression_with_type : _ -> expression -> _ = fun ppf e -> fprintf ppf "%a : %a" @@ -114,11 +118,10 @@ and expression_with_type : _ -> expression -> _ = fun ppf e -> and function_ ppf ({binder ; body}:anon_function) = fprintf ppf "fun %a -> (%a)" - Stage_common.PP.name binder + Var.pp binder expression body -and assignment ppf ((n, i, e):assignment) = - fprintf ppf "%a = %a%a;" Stage_common.PP.name n expression e option_inline i +and assignment ppf ((n, i, e):assignment) = fprintf ppf "%a = %a%a;" Var.pp n expression e option_inline i and option_inline ppf inline = if inline then @@ -126,21 +129,129 @@ and option_inline ppf inline = else fprintf ppf "" -and declaration ppf ((n, i, e):assignment) = - fprintf ppf "let %a = %a%a;" Stage_common.PP.name n expression e option_inline i +and declaration ppf ((n,i, e):assignment) = fprintf ppf "let %a = %a%a;" Var.pp n expression e option_inline i -let tl_statement ppf (ass, _) = assignment ppf ass +and tl_statement ppf (ass, _) = assignment ppf ass -let program ppf (p:program) = +and program ppf (p:program) = fprintf ppf "Program:\n---\n%a" (pp_print_list ~pp_sep:pp_print_newline tl_statement) p +and constant ppf : constant' -> unit = function + | C_INT -> fprintf ppf "INT" + | C_UNIT -> fprintf ppf "UNIT" + | C_NIL -> fprintf ppf "NIL" + | C_NOW -> fprintf ppf "NOW" + | C_IS_NAT -> fprintf ppf "IS_NAT" + | C_SOME -> fprintf ppf "SOME" + | C_NONE -> fprintf ppf "NONE" + | C_ASSERTION -> fprintf ppf "ASSERTION" + | C_ASSERT_INFERRED -> fprintf ppf "ASSERT_INFERRED" + | C_FAILWITH -> fprintf ppf "FAILWITH" + | C_UPDATE -> fprintf ppf "UPDATE" + (* Loops *) + | C_FOLD -> fprintf ppf "FOLD" + | C_FOLD_WHILE -> fprintf ppf "FOLD_WHILE" + | C_CONTINUE -> fprintf ppf "CONTINUE" + | C_STOP -> fprintf ppf "STOP" + | C_ITER -> fprintf ppf "ITER" + (* MATH *) + | C_NEG -> fprintf ppf "NEG" + | C_ABS -> fprintf ppf "ABS" + | C_ADD -> fprintf ppf "ADD" + | C_SUB -> fprintf ppf "SUB" + | C_MUL -> fprintf ppf "MUL" + | C_DIV -> fprintf ppf "DIV" + | C_MOD -> fprintf ppf "MOD" + (* LOGIC *) + | C_NOT -> fprintf ppf "NOT" + | C_AND -> fprintf ppf "AND" + | C_OR -> fprintf ppf "OR" + | C_XOR -> fprintf ppf "XOR" + (* COMPARATOR *) + | C_EQ -> fprintf ppf "EQ" + | C_NEQ -> fprintf ppf "NEQ" + | C_LT -> fprintf ppf "LT" + | C_GT -> fprintf ppf "GT" + | C_LE -> fprintf ppf "LE" + | C_GE -> fprintf ppf "GE" + (* Bytes/ String *) + | C_SIZE -> fprintf ppf "SIZE" + | C_CONCAT -> fprintf ppf "CONCAT" + | C_SLICE -> fprintf ppf "SLICE" + | C_BYTES_PACK -> fprintf ppf "BYTES_PACK" + | C_BYTES_UNPACK -> fprintf ppf "BYTES_UNPACK" + | C_CONS -> fprintf ppf "CONS" + (* Pair *) + | C_PAIR -> fprintf ppf "PAIR" + | C_CAR -> fprintf ppf "CAR" + | C_CDR -> fprintf ppf "CDR" + | C_LEFT -> fprintf ppf "LEFT" + | C_RIGHT -> fprintf ppf "RIGHT" + | C_LSL -> fprintf ppf "LSL" + | C_LSR -> fprintf ppf "LSR" + (* Set *) + | C_SET_EMPTY -> fprintf ppf "SET_EMPTY" + | C_SET_LITERAL -> fprintf ppf "SET_LITERAL" + | C_SET_ADD -> fprintf ppf "SET_ADD" + | C_SET_REMOVE -> fprintf ppf "SET_REMOVE" + | C_SET_ITER -> fprintf ppf "SET_ITER" + | C_SET_FOLD -> fprintf ppf "SET_FOLD" + | C_SET_MEM -> fprintf ppf "SET_MEM" + (* List *) + | C_LIST_ITER -> fprintf ppf "LIST_ITER" + | C_LIST_MAP -> fprintf ppf "LIST_MAP" + | C_LIST_FOLD -> fprintf ppf "LIST_FOLD" + | C_LIST_CONS -> fprintf ppf "LIST_CONS" + (* Maps *) + | C_MAP -> fprintf ppf "MAP" + | C_MAP_EMPTY -> fprintf ppf "MAP_EMPTY" + | C_MAP_LITERAL -> fprintf ppf "MAP_LITERAL" + | C_MAP_GET -> fprintf ppf "MAP_GET" + | C_MAP_GET_FORCE -> fprintf ppf "MAP_GET_FORCE" + | C_MAP_ADD -> fprintf ppf "MAP_ADD" + | C_MAP_REMOVE -> fprintf ppf "MAP_REMOVE" + | C_MAP_UPDATE -> fprintf ppf "MAP_UPDATE" + | C_MAP_ITER -> fprintf ppf "MAP_ITER" + | C_MAP_MAP -> fprintf ppf "MAP_MAP" + | C_MAP_FOLD -> fprintf ppf "MAP_FOLD" + | C_MAP_MEM -> fprintf ppf "MAP_MEM" + | C_MAP_FIND -> fprintf ppf "MAP_FIND" + | C_MAP_FIND_OPT -> fprintf ppf "MAP_FIND_OP" + (* Big Maps *) + | C_BIG_MAP -> fprintf ppf "BIG_MAP" + | C_BIG_MAP_EMPTY -> fprintf ppf "BIG_MAP_EMPTY" + | C_BIG_MAP_LITERAL -> fprintf ppf "BIG_MAP_LITERAL" + (* Crypto *) + | C_SHA256 -> fprintf ppf "SHA256" + | C_SHA512 -> fprintf ppf "SHA512" + | C_BLAKE2b -> fprintf ppf "BLAKE2b" + | C_HASH -> fprintf ppf "HASH" + | C_HASH_KEY -> fprintf ppf "HASH_KEY" + | C_CHECK_SIGNATURE -> fprintf ppf "CHECK_SIGNATURE" + | C_CHAIN_ID -> fprintf ppf "CHAIN_ID" + (* Blockchain *) + | C_CALL -> fprintf ppf "CALL" + | C_CONTRACT -> fprintf ppf "CONTRACT" + | C_CONTRACT_ENTRYPOINT -> fprintf ppf "CONTRACT_ENTRYPOINT" + | C_CONTRACT_OPT -> fprintf ppf "CONTRACT OPT" + | C_CONTRACT_ENTRYPOINT_OPT -> fprintf ppf "CONTRACT_ENTRYPOINT OPT" + | C_AMOUNT -> fprintf ppf "AMOUNT" + | C_BALANCE -> fprintf ppf "BALANCE" + | C_SOURCE -> fprintf ppf "SOURCE" + | C_SENDER -> fprintf ppf "SENDER" + | C_ADDRESS -> fprintf ppf "ADDRESS" + | C_SELF_ADDRESS -> fprintf ppf "SELF_ADDRESS" + | C_IMPLICIT_ACCOUNT -> fprintf ppf "IMPLICIT_ACCOUNT" + | C_STEPS_TO_QUOTA -> fprintf ppf "STEPS_TO_QUOTA" + | C_SET_DELEGATE -> fprintf ppf "SET_DELEGATE" + let%expect_test _ = Format.printf "%a" value (D_bytes (Bytes.of_string "foo")) ; [%expect{| 0x666f6f |}] let%expect_test _ = let pp = expression' Format.std_formatter in - let dummy_type = T_base Base_unit in + let dummy_type = T_base TC_unit in let wrap e = { content = e ; type_value = dummy_type } in pp @@ E_closure { binder = Var.of_name "y" ; body = wrap (E_variable (Var.of_name "y")) } ; [%expect{| diff --git a/src/stages/mini_c/PP.mli b/src/stages/mini_c/PP.mli index b40eb6fb5..a22efb12c 100644 --- a/src/stages/mini_c/PP.mli +++ b/src/stages/mini_c/PP.mli @@ -30,3 +30,5 @@ val declaration : formatter -> assignment -> unit val tl_statement : formatter -> assignment * 'a -> unit *) val program : formatter -> program -> unit + +val constant : formatter -> constant' -> unit diff --git a/src/stages/mini_c/combinators.ml b/src/stages/mini_c/combinators.ml index a7d34a6cb..2912aec93 100644 --- a/src/stages/mini_c/combinators.ml +++ b/src/stages/mini_c/combinators.ml @@ -18,7 +18,7 @@ module Expression = struct type_value = t ; } - let pair : t -> t -> t' = fun a b -> E_constant (C_PAIR , [ a ; b ]) + let pair : t -> t -> t' = fun a b -> E_constant { cons_name = C_PAIR; arguments = [ a ; b ]} end @@ -152,7 +152,7 @@ let get_t_contract t = match t with | _ -> fail @@ wrong_type "contract" t let get_t_operation t = match t with - | T_base Base_operation -> ok () + | T_base TC_operation -> ok () | _ -> fail @@ wrong_type "operation" t let get_operation (v:value) = match v with @@ -160,9 +160,9 @@ let get_operation (v:value) = match v with | _ -> simple_fail "not an operation" -let t_int : type_value = T_base Base_int -let t_unit : type_value = T_base Base_unit -let t_nat : type_value = T_base Base_nat +let t_int : type_value = T_base TC_int +let t_unit : type_value = T_base TC_unit +let t_nat : type_value = T_base TC_nat let t_function x y : type_value = T_function ( x , y ) let t_pair x y : type_value = T_pair ( x , y ) diff --git a/src/stages/mini_c/misc.ml b/src/stages/mini_c/misc.ml index caf35c311..6671af26f 100644 --- a/src/stages/mini_c/misc.ml +++ b/src/stages/mini_c/misc.ml @@ -41,7 +41,7 @@ module Free_variables = struct | E_literal v -> value b v | E_closure f -> lambda b f | E_skip -> empty - | E_constant (_, xs) -> unions @@ List.map self xs + | E_constant (c) -> unions @@ List.map self c.arguments | E_application (f, x) -> unions @@ [ self f ; self x ] | E_variable n -> var_name b n | E_make_empty_map _ -> empty @@ -81,7 +81,7 @@ module Free_variables = struct | E_sequence (x, y) -> union (self x) (self y) (* NB different from ast_typed... *) | E_assignment (v, _, e) -> unions [ var_name b v ; self e ] - | E_update (r, (_,e)) -> union (self r) (self e) + | E_record_update (r, _,e) -> union (self r) (self e) | E_while (cond , body) -> union (self cond) (self body) and var_name : bindings -> var_name -> bindings = fun b n -> diff --git a/src/stages/mini_c/types.ml b/src/stages/mini_c/types.ml index caee68b6c..f8d65759d 100644 --- a/src/stages/mini_c/types.ml +++ b/src/stages/mini_c/types.ml @@ -1,5 +1,5 @@ -include Stage_common.Types +include Stage_common.Types type 'a annotated = string option * 'a @@ -7,7 +7,7 @@ type type_value = | T_pair of (type_value annotated * type_value annotated) | T_or of (type_value annotated * type_value annotated) | T_function of (type_value * type_value) - | T_base of type_base + | T_base of type_constant | T_map of (type_value * type_value) | T_big_map of (type_value * type_value) | T_list of type_value @@ -19,13 +19,13 @@ and environment_element = expression_variable * type_value and environment = environment_element list -type environment_wrap = { +and environment_wrap = { pre_environment : environment ; post_environment : environment ; } -type var_name = expression_variable -type fun_name = expression_variable +and var_name = expression_variable +and fun_name = expression_variable type inline = bool @@ -56,7 +56,7 @@ and expression' = | E_literal of value | E_closure of anon_function | E_skip - | E_constant of constant * expression list + | E_constant of constant | E_application of (expression * expression) | E_variable of var_name | E_make_empty_map of (type_value * type_value) @@ -64,7 +64,7 @@ and expression' = | E_make_empty_list of type_value | E_make_empty_set of type_value | E_make_none of type_value - | E_iterator of (constant * ((var_name * type_value) * expression) * expression) + | E_iterator of constant' * ((var_name * type_value) * expression) * expression | E_fold of (((var_name * type_value) * expression) * expression * expression) | E_if_bool of (expression * expression * expression) | E_if_none of expression * expression * ((var_name * type_value) * expression) @@ -73,7 +73,7 @@ and expression' = | E_let_in of ((var_name * type_value) * inline * expression * expression) | E_sequence of (expression * expression) | E_assignment of (expression_variable * [`Left | `Right] list * expression) - | E_update of (expression * ([`Left | `Right] list * expression)) + | E_record_update of (expression * [`Left | `Right] list * expression) | E_while of (expression * expression) and expression = { @@ -81,6 +81,11 @@ and expression = { type_value : type_value ; } +and constant = { + cons_name : constant'; (* this is at the end because it is huge *) + arguments : expression list; +} + and assignment = var_name * inline * expression and toplevel_statement = assignment * environment_wrap diff --git a/src/stages/typesystem/core.ml b/src/stages/typesystem/core.ml index 11f9122c5..fc09e2637 100644 --- a/src/stages/typesystem/core.ml +++ b/src/stages/typesystem/core.ml @@ -1,5 +1,6 @@ -include Stage_common.Types +type type_variable = Ast_typed.type_variable +type type_expression = Ast_typed.type_expression (* generate a new type variable and gave it an id *) let fresh_type_variable : ?name:string -> unit -> type_variable = @@ -10,7 +11,6 @@ let fresh_type_variable : ?name:string -> unit -> type_variable = type constant_tag = | C_arrow (* * -> * -> * *) (* isn't this wrong*) | C_option (* * -> * *) - | C_tuple (* * … -> * *) | C_record (* ( label , * ) … -> * *) | C_variant (* ( label , * ) … -> * *) | C_map (* * -> * -> * *) @@ -33,9 +33,7 @@ type constant_tag = | C_contract (* * -> * *) | C_chain_id (* * *) -type accessor = - | L_int of int - | L_string of string +type accessor = Ast_typed.label (* Weird stuff; please explain *) type type_value = @@ -71,33 +69,31 @@ and typeclass = type_value list list open Trace let type_expression'_of_simple_c_constant = function - | C_contract , [x] -> ok @@ T_operator(TC_contract x) - | C_option , [x] -> ok @@ T_operator(TC_option x) - | C_list , [x] -> ok @@ T_operator(TC_list x) - | C_set , [x] -> ok @@ T_operator(TC_set x) - | C_map , [x ; y] -> ok @@ T_operator(TC_map (x , y)) - | C_big_map , [x ; y] -> ok @@ T_operator(TC_big_map (x, y)) - | C_arrow , [x ; y] -> ok @@ T_operator(TC_arrow (x, y)) - | C_tuple , lst -> ok @@ T_operator(TC_tuple lst) + | C_contract , [x] -> ok @@ Ast_typed.T_operator(TC_contract x) + | C_option , [x] -> ok @@ Ast_typed.T_operator(TC_option x) + | C_list , [x] -> ok @@ Ast_typed.T_operator(TC_list x) + | C_set , [x] -> ok @@ Ast_typed.T_operator(TC_set x) + | C_map , [x ; y] -> ok @@ Ast_typed.T_operator(TC_map (x , y)) + | C_big_map , [x ; y] -> ok @@ Ast_typed.T_operator(TC_big_map (x, y)) + | C_arrow , [x ; y] -> ok @@ Ast_typed.T_operator(TC_arrow (x, y)) | C_record , _lst -> ok @@ failwith "records are not supported yet: T_record lst" | C_variant , _lst -> ok @@ failwith "sums are not supported yet: T_sum lst" | (C_contract | C_option | C_list | C_set | C_map | C_big_map | C_arrow ), _ -> failwith "internal error: wrong number of arguments for type operator" - | C_unit , [] -> ok @@ T_constant(TC_unit) - | C_string , [] -> ok @@ T_constant(TC_string) - | C_bytes , [] -> ok @@ T_constant(TC_bytes) - | C_nat , [] -> ok @@ T_constant(TC_nat) - | C_int , [] -> ok @@ T_constant(TC_int) - | C_mutez , [] -> ok @@ T_constant(TC_mutez) - | C_bool , [] -> ok @@ T_constant(TC_bool) - | C_operation , [] -> ok @@ T_constant(TC_operation) - | C_address , [] -> ok @@ T_constant(TC_address) - | C_key , [] -> ok @@ T_constant(TC_key) - | C_key_hash , [] -> ok @@ T_constant(TC_key_hash) - | C_chain_id , [] -> ok @@ T_constant(TC_chain_id) - | C_signature , [] -> ok @@ T_constant(TC_signature) - | C_timestamp , [] -> ok @@ T_constant(TC_timestamp) + | C_unit , [] -> ok @@ Ast_typed.T_constant(TC_unit) + | C_string , [] -> ok @@ Ast_typed.T_constant(TC_string) + | C_bytes , [] -> ok @@ Ast_typed.T_constant(TC_bytes) + | C_nat , [] -> ok @@ Ast_typed.T_constant(TC_nat) + | C_int , [] -> ok @@ Ast_typed.T_constant(TC_int) + | C_mutez , [] -> ok @@ Ast_typed.T_constant(TC_mutez) + | C_bool , [] -> ok @@ Ast_typed.T_constant(TC_bool) + | C_operation , [] -> ok @@ Ast_typed.T_constant(TC_operation) + | C_address , [] -> ok @@ Ast_typed.T_constant(TC_address) + | C_key , [] -> ok @@ Ast_typed.T_constant(TC_key) + | C_key_hash , [] -> ok @@ Ast_typed.T_constant(TC_key_hash) + | C_chain_id , [] -> ok @@ Ast_typed.T_constant(TC_chain_id) + | C_signature , [] -> ok @@ Ast_typed.T_constant(TC_signature) + | C_timestamp , [] -> ok @@ Ast_typed.T_constant(TC_timestamp) | (C_unit | C_string | C_bytes | C_nat | C_int | C_mutez | C_bool | C_operation | C_address | C_key | C_key_hash | C_chain_id | C_signature | C_timestamp), _::_ -> failwith "internal error: wrong number of arguments for type constant" - diff --git a/src/stages/typesystem/misc.ml b/src/stages/typesystem/misc.ml index 3321c670f..eb5e11c16 100644 --- a/src/stages/typesystem/misc.ml +++ b/src/stages/typesystem/misc.ml @@ -9,7 +9,7 @@ module Substitution = struct module T = Ast_typed (* module TSMap = Trace.TMap(String) *) - type substs = variable:type_variable -> T.type_value' option (* this string is a type_name or type_variable I think *) + type substs = variable:type_variable -> T.type_content option (* this string is a type_name or type_variable I think *) let mk_substs ~v ~expr = (v , expr) type 'a w = substs:substs -> 'a -> 'a result @@ -18,20 +18,19 @@ module Substitution = struct and s_environment_element_definition ~substs = function | T.ED_binder -> ok @@ T.ED_binder | T.ED_declaration (val_, free_variables) -> - let%bind val_ = s_annotated_expression ~substs val_ in + let%bind val_ = s_expression ~substs val_ in let%bind free_variables = bind_map_list (s_variable ~substs) free_variables in ok @@ T.ED_declaration (val_, free_variables) and s_environment : T.environment w = fun ~substs env -> bind_map_list (fun (variable, T.{ type_value; source_environment; definition }) -> - let%bind variable = s_variable ~substs variable in - let%bind type_value = s_type_value ~substs type_value in + let%bind type_value = s_type_expression ~substs type_value in let%bind source_environment = s_full_environment ~substs source_environment in let%bind definition = s_environment_element_definition ~substs definition in ok @@ (variable, T.{ type_value; source_environment; definition })) env and s_type_environment : T.type_environment w = fun ~substs tenv -> bind_map_list (fun (type_variable , type_value) -> let%bind type_variable = s_type_variable ~substs type_variable in - let%bind type_value = s_type_value ~substs type_value in + let%bind type_value = s_type_expression ~substs type_value in ok @@ (type_variable , type_value)) tenv and s_small_environment : T.small_environment w = fun ~substs (environment, type_environment) -> let%bind environment = s_environment ~substs environment in @@ -58,11 +57,11 @@ module Substitution = struct let () = ignore @@ substs in ok l - and s_build_in : T.constant w = fun ~substs b -> + and s_build_in : T.constant' w = fun ~substs b -> let () = ignore @@ substs in ok b - and s_constructor : T.constructor w = fun ~substs c -> + and s_constructor : T.constructor' w = fun ~substs c -> let () = ignore @@ substs in ok c @@ -71,10 +70,7 @@ module Substitution = struct let () = ignore @@ substs in ok @@ type_name - and s_type_value' : T.type_value' w = fun ~substs -> function - | T.T_operator (TC_tuple type_value_list) -> - let%bind type_value_list = bind_map_list (s_type_value ~substs) type_value_list in - ok @@ T.T_operator (TC_tuple type_value_list) + and s_type_content : T.type_content w = fun ~substs -> function | T.T_sum _ -> failwith "TODO: T_sum" | T.T_record _ -> failwith "TODO: T_record" | T.T_constant type_name -> @@ -83,43 +79,46 @@ module Substitution = struct | T.T_variable variable -> begin match substs ~variable with - | Some expr -> s_type_value' ~substs expr (* TODO: is it the right thing to recursively examine this? We mustn't go into an infinite loop. *) + | Some expr -> s_type_content ~substs expr (* TODO: is it the right thing to recursively examine this? We mustn't go into an infinite loop. *) | None -> ok @@ T.T_variable variable end | T.T_operator type_name_and_args -> - let%bind type_name_and_args = T.Misc.bind_map_type_operator (s_type_value ~substs) type_name_and_args in + let%bind type_name_and_args = T.bind_map_type_operator (s_type_expression ~substs) type_name_and_args in ok @@ T.T_operator type_name_and_args | T.T_arrow _ -> let _TODO = substs in failwith "TODO: T_function" - and s_type_expression' : _ Ast_simplified.type_expression' w = fun ~substs -> function + and s_simpl_type_content : Ast_simplified.type_content w = fun ~substs -> function | Ast_simplified.T_sum _ -> failwith "TODO: subst: unimplemented case s_type_expression sum" | Ast_simplified.T_record _ -> failwith "TODO: subst: unimplemented case s_type_expression record" - | Ast_simplified.T_arrow (_, _) -> failwith "TODO: subst: unimplemented case s_type_expression arrow" + | Ast_simplified.T_arrow _ -> failwith "TODO: subst: unimplemented case s_type_expression arrow" | Ast_simplified.T_variable _ -> failwith "TODO: subst: unimplemented case s_type_expression variable" | Ast_simplified.T_operator op -> let%bind op = - Ast_simplified.Misc.bind_map_type_operator - (s_type_expression ~substs) + Ast_simplified.bind_map_type_operator + (s_simpl_type_expression ~substs) op in (* TODO: when we have generalized operators, we might need to subst the operator name itself? *) ok @@ Ast_simplified.T_operator op | Ast_simplified.T_constant constant -> ok @@ Ast_simplified.T_constant constant - and s_type_expression : Ast_simplified.type_expression w = fun ~substs {type_expression'} -> - let%bind type_expression' = s_type_expression' ~substs type_expression' in - ok @@ Ast_simplified.{type_expression'} + and s_simpl_type_expression : Ast_simplified.type_expression w = fun ~substs {type_content;type_meta} -> + let%bind type_content = s_simpl_type_content ~substs type_content in + ok @@ Ast_simplified.{type_content;type_meta} - and s_type_value : T.type_value w = fun ~substs { type_value'; simplified } -> - let%bind type_value' = s_type_value' ~substs type_value' in - let%bind simplified = bind_map_option (s_type_expression ~substs) simplified in - ok @@ T.{ type_value'; simplified } + and s_type_expression : T.type_expression w = fun ~substs { type_content; type_meta } -> + let%bind type_content = s_type_content ~substs type_content in + let%bind type_meta = bind_map_option (s_simpl_type_expression ~substs) type_meta in + ok @@ T.{ type_content; type_meta} and s_literal : T.literal w = fun ~substs -> function | T.Literal_unit -> let () = ignore @@ substs in ok @@ T.Literal_unit + | T.Literal_void -> + let () = ignore @@ substs in + ok @@ T.Literal_void | (T.Literal_bool _ as x) | (T.Literal_int _ as x) | (T.Literal_nat _ as x) @@ -137,128 +136,104 @@ module Substitution = struct and s_matching_expr : T.matching_expr w = fun ~substs _ -> let _TODO = substs in failwith "TODO: subst: unimplemented case s_matching" - and s_named_type_value : T.named_type_value w = fun ~substs _ -> - let _TODO = substs in - failwith "TODO: subst: unimplemented case s_named_type_value" - and s_access_path : T.access_path w = fun ~substs _ -> + and s_accessor : T.accessor w = fun ~substs _ -> let _TODO = substs in failwith "TODO: subst: unimplemented case s_access_path" - and s_expression : T.expression w = fun ~(substs : substs) -> function + and s_expression_content : T.expression_content w = fun ~(substs : substs) -> function | T.E_literal x -> let%bind x = s_literal ~substs x in ok @@ T.E_literal x - | T.E_constant (var, vals) -> - let%bind var = s_build_in ~substs var in - let%bind vals = bind_map_list (s_annotated_expression ~substs) vals in - ok @@ T.E_constant (var, vals) + | T.E_constant {cons_name;arguments} -> + let%bind cons_name = s_build_in ~substs cons_name in + let%bind arguments = bind_map_list (s_expression ~substs) arguments in + ok @@ T.E_constant {cons_name;arguments} | T.E_variable tv -> let%bind tv = s_variable ~substs tv in ok @@ T.E_variable tv - | T.E_application (val1 , val2) -> - let%bind val1 = s_annotated_expression ~substs val1 in - let%bind val2 = s_annotated_expression ~substs val2 in - ok @@ T.E_application (val1 , val2) - | T.E_lambda { binder; body } -> + | T.E_application {expr1;expr2} -> + let%bind expr1 = s_expression ~substs expr1 in + let%bind expr2 = s_expression ~substs expr2 in + ok @@ T.E_application {expr1;expr2} + | T.E_lambda { binder; result } -> let%bind binder = s_variable ~substs binder in - let%bind body = s_annotated_expression ~substs body in - ok @@ T.E_lambda { binder; body } - | T.E_let_in { binder; rhs; result; inline } -> - let%bind binder = s_variable ~substs binder in - let%bind rhs = s_annotated_expression ~substs rhs in - let%bind result = s_annotated_expression ~substs result in - ok @@ T.E_let_in { binder; rhs; result; inline } - | T.E_tuple vals -> - let%bind vals = bind_map_list (s_annotated_expression ~substs) vals in - ok @@ T.E_tuple vals - | T.E_tuple_accessor (val_, i) -> - let%bind val_ = s_annotated_expression ~substs val_ in - let i = i in - ok @@ T.E_tuple_accessor (val_, i) - | T.E_constructor (tvar, val_) -> - let%bind tvar = s_constructor ~substs tvar in - let%bind val_ = s_annotated_expression ~substs val_ in - ok @@ T.E_constructor (tvar, val_) + let%bind result = s_expression ~substs result in + ok @@ T.E_lambda { binder; result } + | T.E_let_in { let_binder; rhs; let_result; inline } -> + let%bind let_binder = s_variable ~substs let_binder in + let%bind rhs = s_expression ~substs rhs in + let%bind let_result = s_expression ~substs let_result in + ok @@ T.E_let_in { let_binder; rhs; let_result; inline } + | T.E_constructor {constructor;element} -> + let%bind constructor = s_constructor ~substs constructor in + let%bind element = s_expression ~substs element in + ok @@ T.E_constructor {constructor;element} | T.E_record aemap -> let _TODO = aemap in failwith "TODO: subst in record" (* let%bind aemap = TSMap.bind_map_Map (fun ~k:key ~v:val_ -> - * let key = s_type_variable ~substs key in - * let val_ = s_annotated_expression ~substs val_ in + * let key = s_type_variable ~v ~expr key in + * let val_ = s_expression ~v ~expr val_ in * ok @@ (key , val_)) aemap in * ok @@ T.E_record aemap *) - | T.E_record_accessor (val_, l) -> - let%bind val_ = s_annotated_expression ~substs val_ in - let l = l in (* Nothing to substitute, this is a label, not a type *) - ok @@ T.E_record_accessor (val_, l) - | T.E_record_update (r, (l, e)) -> - let%bind r = s_annotated_expression ~substs r in - let%bind e = s_annotated_expression ~substs e in - ok @@ T.E_record_update (r, (l, e)) + | T.E_record_accessor {expr=e;label} -> + let%bind expr = s_expression ~substs e in + let%bind label = s_label ~substs label in + ok @@ T.E_record_accessor {expr;label} + | T.E_record_update {record;path;update}-> + let%bind record = s_expression ~substs record in + let%bind update = s_expression ~substs update in + ok @@ T.E_record_update {record;path;update} | T.E_map val_val_list -> let%bind val_val_list = bind_map_list (fun (val1 , val2) -> - let%bind val1 = s_annotated_expression ~substs val1 in - let%bind val2 = s_annotated_expression ~substs val2 in + let%bind val1 = s_expression ~substs val1 in + let%bind val2 = s_expression ~substs val2 in ok @@ (val1 , val2) ) val_val_list in ok @@ T.E_map val_val_list | T.E_big_map val_val_list -> let%bind val_val_list = bind_map_list (fun (val1 , val2) -> - let%bind val1 = s_annotated_expression ~substs val1 in - let%bind val2 = s_annotated_expression ~substs val2 in + let%bind val1 = s_expression ~substs val1 in + let%bind val2 = s_expression ~substs val2 in ok @@ (val1 , val2) ) val_val_list in ok @@ T.E_big_map val_val_list | T.E_list vals -> - let%bind vals = bind_map_list (s_annotated_expression ~substs) vals in + let%bind vals = bind_map_list (s_expression ~substs) vals in ok @@ T.E_list vals | T.E_set vals -> - let%bind vals = bind_map_list (s_annotated_expression ~substs) vals in + let%bind vals = bind_map_list (s_expression ~substs) vals in ok @@ T.E_set vals | T.E_look_up (val1, val2) -> - let%bind val1 = s_annotated_expression ~substs val1 in - let%bind val2 = s_annotated_expression ~substs val2 in + let%bind val1 = s_expression ~substs val1 in + let%bind val2 = s_expression ~substs val2 in ok @@ T.E_look_up (val1 , val2) - | T.E_matching (val_ , matching_expr) -> - let%bind val_ = s_annotated_expression ~substs val_ in - let%bind matching = s_matching_expr ~substs matching_expr in - ok @@ T.E_matching (val_ , matching) - | T.E_sequence (val1, val2) -> - let%bind val1 = s_annotated_expression ~substs val1 in - let%bind val2 = s_annotated_expression ~substs val2 in - ok @@ T.E_sequence (val1 , val2) - | T.E_loop (val1, val2) -> - let%bind val1 = s_annotated_expression ~substs val1 in - let%bind val2 = s_annotated_expression ~substs val2 in - ok @@ T.E_loop (val1 , val2) - | T.E_assign (named_tval, access_path, val_) -> - let%bind named_tval = s_named_type_value ~substs named_tval in - let%bind access_path = s_access_path ~substs access_path in - let%bind val_ = s_annotated_expression ~substs val_ in - ok @@ T.E_assign (named_tval, access_path, val_) + | T.E_matching {matchee;cases} -> + let%bind matchee = s_expression ~substs matchee in + let%bind cases = s_matching_expr ~substs cases in + ok @@ T.E_matching {matchee;cases} + | T.E_loop {condition;body} -> + let%bind condition = s_expression ~substs condition in + let%bind body = s_expression ~substs body in + ok @@ T.E_loop {condition;body} - and s_annotated_expression : T.annotated_expression w = fun ~substs { expression; type_annotation; environment; location } -> - let%bind expression = s_expression ~substs expression in - let%bind type_annotation = s_type_value ~substs type_annotation in + and s_expression : T.expression w = fun ~(substs:substs) { expression_content; type_expression; environment; location } -> + let%bind expression_content = s_expression_content ~substs expression_content in + let%bind type_expr = s_type_expression ~substs type_expression in let%bind environment = s_full_environment ~substs environment in let location = location in - ok T.{ expression; type_annotation; environment; location } - - and s_named_expression : T.named_expression w = fun ~substs { name; annotated_expression } -> - let name = name in (* Nothing to substitute, this is a variable name *) - let%bind annotated_expression = s_annotated_expression ~substs annotated_expression in - ok T.{ name; annotated_expression } + ok T.{ expression_content;type_expression=type_expr; environment; location } and s_declaration : T.declaration w = fun ~substs -> function - Ast_typed.Declaration_constant (e, inline, (env1, env2)) -> - let%bind e = s_named_expression ~substs e in - let%bind env1 = s_full_environment ~substs env1 in - let%bind env2 = s_full_environment ~substs env2 in - ok @@ Ast_typed.Declaration_constant (e, inline, (env1, env2)) + Ast_typed.Declaration_constant (ev,e,i,env) -> + let%bind ev = s_variable ~substs ev in + let%bind e = s_expression ~substs e in + let%bind env = s_full_environment ~substs env in + ok @@ Ast_typed.Declaration_constant (ev, e, i, env) - and s_declaration_wrap : T.declaration Location.wrap w = fun ~substs d -> - Trace.bind_map_location (s_declaration ~substs) d + and s_declaration_wrap :T.declaration Location.wrap w = fun ~substs d -> + Trace.bind_map_location (s_declaration ~substs) d (* Replace the type variable ~v with ~expr everywhere within the program ~p. TODO: issues with scoping/shadowing. *) diff --git a/src/stages/typesystem/shorthands.ml b/src/stages/typesystem/shorthands.ml index 109b7b15b..15e1bdca0 100644 --- a/src/stages/typesystem/shorthands.ml +++ b/src/stages/typesystem/shorthands.ml @@ -39,10 +39,10 @@ let forall3_tc a b c f = forall_tc c @@ fun c' -> f a' b' c' -let (-->) arg ret = P_constant (C_arrow , [arg; ret]) let (=>) tc ty = (tc , ty) +let (-->) arg ret = P_constant (C_arrow , [arg; ret]) let option t = P_constant (C_option , [t]) -let pair a b = P_constant (C_tuple , [a; b]) +let pair a b = P_constant (C_record , [a; b]) let map k v = P_constant (C_map , [k; v]) let unit = P_constant (C_unit , []) let list t = P_constant (C_list , [t]) @@ -64,7 +64,7 @@ let contract t = P_constant (C_contract , [t]) let ( * ) a b = pair a b (* These are used temporarily to de-curry functions that correspond to Michelson operators *) -let tuple0 = P_constant (C_tuple , []) -let tuple1 a = P_constant (C_tuple , [a]) -let tuple2 a b = P_constant (C_tuple , [a; b]) -let tuple3 a b c = P_constant (C_tuple , [a; b; c]) +let tuple0 = P_constant (C_record , []) +let tuple1 a = P_constant (C_record , [a]) +let tuple2 a b = P_constant (C_record , [a; b]) +let tuple3 a b c = P_constant (C_record , [a; b; c]) diff --git a/src/test/coase_tests.ml b/src/test/coase_tests.ml index af091ad88..57e55b495 100644 --- a/src/test/coase_tests.ml +++ b/src/test/coase_tests.ml @@ -32,7 +32,7 @@ let compile_main () = open Ast_simplified let card owner = - ez_e_record [ + e_record_ez [ ("card_owner" , owner) ; ("card_pattern" , e_nat 0) ; ] @@ -49,7 +49,7 @@ let make_cards assoc_lst = e_typed_map assoc_lst card_id_ty card_ty let card_pattern (coeff , qtt) = - ez_e_record [ + e_record_ez [ ("coefficient" , coeff) ; ("quantity" , qtt) ; ] @@ -69,7 +69,7 @@ let make_card_patterns lst = e_typed_map assoc_lst card_pattern_id_ty card_pattern_ty let storage cards_patterns cards next_id = - ez_e_record [ + e_record_ez [ ("cards" , cards) ; ("card_patterns" , cards_patterns) ; ("next_id" , next_id) ; @@ -107,7 +107,7 @@ let buy () = let%bind program = get_program () in let%bind () = let make_input = fun n -> - let buy_action = ez_e_record [ + let buy_action = e_record_ez [ ("card_to_buy" , e_nat 0) ; ] in let storage = basic 100 1000 (cards_ez first_owner n) (2 * n) in @@ -145,7 +145,7 @@ let dispatch_buy () = let%bind program = get_program () in let%bind () = let make_input = fun n -> - let buy_action = ez_e_record [ + let buy_action = e_record_ez [ ("card_to_buy" , e_nat 0) ; ] in let action = e_constructor "Buy_single" buy_action in @@ -184,7 +184,7 @@ let transfer () = let%bind program = get_program () in let%bind () = let make_input = fun n -> - let transfer_action = ez_e_record [ + let transfer_action = e_record_ez [ ("card_to_transfer" , e_nat 0) ; ("destination" , e_address second_owner) ; ] in @@ -215,7 +215,7 @@ let sell () = let%bind program = get_program () in let%bind () = let make_input = fun n -> - let sell_action = ez_e_record [ + let sell_action = e_record_ez [ ("card_to_sell" , e_nat (n - 1)) ; ] in let cards = cards_ez first_owner n in @@ -223,9 +223,9 @@ let sell () = e_pair sell_action storage in let make_expecter : int -> expression -> unit result = fun n result -> - let%bind (ops , storage) = get_e_pair result.expression in + let%bind (ops , storage) = get_e_pair result.expression_content in let%bind () = - let%bind lst = get_e_list ops.expression in + let%bind lst = get_e_list ops.expression_content in Assert.assert_list_size lst 1 in let expected_storage = let cards = List.hds @@ cards_ez first_owner n in diff --git a/src/test/contracts/bytes_unpack.ligo b/src/test/contracts/bytes_unpack.ligo index c6b087635..ea6903f06 100644 --- a/src/test/contracts/bytes_unpack.ligo +++ b/src/test/contracts/bytes_unpack.ligo @@ -8,4 +8,4 @@ function id_int (const p : int) : option(int) is block { function id_address (const p : address) : option(address) is block { const packed : bytes = bytes_pack(p) ; -} with (bytes_unpack(packed): option(address)) \ No newline at end of file +} with (bytes_unpack(packed): option(address)) diff --git a/src/test/contracts/key_hash.ligo b/src/test/contracts/key_hash.ligo index 38b72366a..1a429402f 100644 --- a/src/test/contracts/key_hash.ligo +++ b/src/test/contracts/key_hash.ligo @@ -2,4 +2,4 @@ function check_hash_key (const kh1 : key_hash; const k2 : key) : bool*key_hash i var ret : bool := False ; var kh2 : key_hash := crypto_hash_key(k2) ; if kh1 = kh2 then ret := True else skip; -} with (ret, kh2) \ No newline at end of file +} with (ret, kh2) diff --git a/src/test/contracts/key_hash.mligo b/src/test/contracts/key_hash.mligo index 830ea3496..0eba14d9b 100644 --- a/src/test/contracts/key_hash.mligo +++ b/src/test/contracts/key_hash.mligo @@ -1,5 +1,5 @@ let check_hash_key (kh1, k2: key_hash * key) : bool * key_hash = let kh2 : key_hash = Crypto.hash_key k2 in - if kh1 = kh2 + if kh1 = kh2 then (true, kh2) else (false, kh2) diff --git a/src/test/contracts/option.ligo b/src/test/contracts/option.ligo index f2fb91260..424171c93 100644 --- a/src/test/contracts/option.ligo +++ b/src/test/contracts/option.ligo @@ -9,5 +9,5 @@ function assign (var m : int) : foobar is block { var coco : foobar := None; coco := Some(m); - coco := None; + coco := (None : foobar); //temporary annotation added until type inference } with coco diff --git a/src/test/id_tests.ml b/src/test/id_tests.ml index c4b5c6182..dfe5be581 100644 --- a/src/test/id_tests.ml +++ b/src/test/id_tests.ml @@ -38,7 +38,7 @@ let buy_id () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -52,7 +52,7 @@ let buy_id () = ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -71,7 +71,7 @@ let buy_id_sender_addr () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -85,7 +85,7 @@ let buy_id_sender_addr () = ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -105,7 +105,7 @@ let buy_id_wrong_amount () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -128,7 +128,7 @@ let update_details_owner () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -139,11 +139,11 @@ let update_details_owner () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address owner_addr) ; ("profile", new_website)] in - let id_details_2_diff = e_ez_record [("owner", e_address new_addr) ; + let id_details_2_diff = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in let storage = e_tuple [(e_big_map [(e_int 0, id_details_1) ; @@ -169,7 +169,7 @@ let update_details_controller () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -180,11 +180,11 @@ let update_details_controller () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_2 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in - let id_details_2_diff = e_ez_record [("owner", e_address owner_addr) ; + let id_details_2_diff = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", new_website)] in let storage = e_tuple [(e_big_map [(e_int 0, id_details_1) ; @@ -211,7 +211,7 @@ let update_details_nonexistent () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -222,7 +222,7 @@ let update_details_nonexistent () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -245,7 +245,7 @@ let update_details_wrong_addr () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -255,7 +255,7 @@ let update_details_wrong_addr () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -278,7 +278,7 @@ let update_details_unchanged () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -289,7 +289,7 @@ let update_details_unchanged () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -310,7 +310,7 @@ let update_owner () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -321,11 +321,11 @@ let update_owner () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in - let id_details_2_diff = e_ez_record [("owner", e_address owner_addr) ; + let id_details_2_diff = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in let storage = e_tuple [(e_big_map [(e_int 0, id_details_1) ; @@ -349,7 +349,7 @@ let update_owner_nonexistent () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -360,7 +360,7 @@ let update_owner_nonexistent () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -380,7 +380,7 @@ let update_owner_wrong_addr () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -391,7 +391,7 @@ let update_owner_wrong_addr () = () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -410,7 +410,7 @@ let skip () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -420,7 +420,7 @@ let skip () = ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in @@ -444,7 +444,7 @@ let skip_wrong_amount () = let%bind program, _ = get_program () in let owner_addr = addr 5 in let owner_website = e_bytes_string "ligolang.org" in - let id_details_1 = e_ez_record [("owner", e_address owner_addr) ; + let id_details_1 = e_record_ez [("owner", e_address owner_addr) ; ("controller", e_address owner_addr) ; ("profile", owner_website)] in @@ -454,7 +454,7 @@ let skip_wrong_amount () = ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) () in let new_website = e_bytes_string "ligolang.org" in - let id_details_2 = e_ez_record [("owner", e_address new_addr) ; + let id_details_2 = e_record_ez [("owner", e_address new_addr) ; ("controller", e_address new_addr) ; ("profile", new_website)] in diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 13d03872e..dac0564d2 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -661,7 +661,7 @@ let include_religo () : unit result = expect_eq_evaluate program "bar" (e_int 144) let record_ez_int names n = - ez_e_record @@ List.map (fun x -> x, e_int n) names + e_record_ez @@ List.map (fun x -> x, e_int n) names let tuple_ez_int names n = e_tuple @@ List.map (fun _ -> e_int n) names @@ -722,12 +722,12 @@ let record () : unit result = in let%bind () = let make_input = record_ez_int ["foo" ; "bar"] in - let make_expected = fun n -> ez_e_record [("foo" , e_int 256) ; ("bar" , e_int n) ] in + let make_expected = fun n -> e_record_ez [("foo" , e_int 256) ; ("bar" , e_int n) ] in expect_eq_n program "modify" make_input make_expected in let%bind () = let make_input = record_ez_int ["a" ; "b" ; "c"] in - let make_expected = fun n -> ez_e_record [ + let make_expected = fun n -> e_record_ez [ ("a" , e_int n) ; ("b" , e_int 2048) ; ("c" , e_int 42) @@ -739,8 +739,8 @@ let record () : unit result = expect_eq_evaluate program "br" expected in let%bind () = - let make_input = fun n -> ez_e_record [("inner", record_ez_int ["a";"b";"c"] n)] in - let make_expected = fun n -> ez_e_record [("inner", ez_e_record[ + let make_input = fun n -> e_record_ez [("inner", record_ez_int ["a";"b";"c"] n)] in + let make_expected = fun n -> e_record_ez [("inner", e_record_ez[ ("a" , e_int n) ; ("b" , e_int 2048) ; ("c" , e_int n) @@ -768,12 +768,12 @@ let record_mligo () : unit result = in let%bind () = let make_input = record_ez_int ["foo" ; "bar"] in - let make_expected = fun n -> ez_e_record [("foo" , e_int 256) ; ("bar" , e_int n) ] in + let make_expected = fun n -> e_record_ez [("foo" , e_int 256) ; ("bar" , e_int n) ] in expect_eq_n program "modify" make_input make_expected in let%bind () = let make_input = record_ez_int ["a" ; "b" ; "c"] in - let make_expected = fun n -> ez_e_record [ + let make_expected = fun n -> e_record_ez [ ("a" , e_int n) ; ("b" , e_int 2048) ; ("c" , e_int 42) @@ -785,8 +785,8 @@ let record_mligo () : unit result = expect_eq_evaluate program "br" expected in let%bind () = - let make_input = fun n -> ez_e_record [("inner", record_ez_int ["a";"b";"c"] n)] in - let make_expected = fun n -> ez_e_record [("inner", ez_e_record[ + let make_input = fun n -> e_record_ez [("inner", record_ez_int ["a";"b";"c"] n)] in + let make_expected = fun n -> e_record_ez [("inner", e_record_ez [ ("a" , e_int n) ; ("b" , e_int 2048) ; ("c" , e_int n) @@ -814,12 +814,12 @@ let record_religo () : unit result = in let%bind () = let make_input = record_ez_int ["foo" ; "bar"] in - let make_expected = fun n -> ez_e_record [("foo" , e_int 256) ; ("bar" , e_int n) ] in + let make_expected = fun n -> e_record_ez [("foo" , e_int 256) ; ("bar" , e_int n) ] in expect_eq_n program "modify" make_input make_expected in let%bind () = let make_input = record_ez_int ["a" ; "b" ; "c"] in - let make_expected = fun n -> ez_e_record [ + let make_expected = fun n -> e_record_ez [ ("a" , e_int n) ; ("b" , e_int 2048) ; ("c" , e_int 42) @@ -831,8 +831,8 @@ let record_religo () : unit result = expect_eq_evaluate program "br" expected in let%bind () = - let make_input = fun n -> ez_e_record [("inner", record_ez_int ["a";"b";"c"] n)] in - let make_expected = fun n -> ez_e_record [("inner", ez_e_record[ + let make_input = fun n -> e_record_ez [("inner", record_ez_int ["a";"b";"c"] n)] in + let make_expected = fun n -> e_record_ez [("inner", e_record_ez[ ("a" , e_int n) ; ("b" , e_int 2048) ; ("c" , e_int n) @@ -1883,8 +1883,8 @@ let deep_access_ligo () : unit result = let make_expected = e_int 6 in expect_eq program "asymetric_tuple_access" make_input make_expected in let%bind () = - let make_input = e_ez_record [ ("nesty", - e_ez_record [ ("mymap", e_typed_map [] t_int t_string) ] ) ; ] in + let make_input = e_record_ez [ ("nesty", + e_record_ez [ ("mymap", e_typed_map [] t_int t_string) ] ) ; ] in let make_expected = e_string "one" in expect_eq program "nested_record" make_input make_expected in ok () @@ -1921,9 +1921,9 @@ let get_contract_ligo () : unit result = let%bind () = let make_input = fun _n -> e_unit () in let make_expected : int -> Ast_simplified.expression -> unit result = fun _n result -> - let%bind (ops , storage) = get_e_pair result.expression in + let%bind (ops , storage) = get_e_pair result.expression_content in let%bind () = - let%bind lst = get_e_list ops.expression in + let%bind lst = get_e_list ops.expression_content in Assert.assert_list_size lst 1 in let expected_storage = e_unit () in Ast_simplified.Misc.assert_value_eq (expected_storage , storage) @@ -2272,7 +2272,7 @@ let main = test_suite "Integration (End to End)" [ test "crypto" crypto ; test "crypto (mligo)" crypto_mligo ; test "crypto (religo)" crypto_religo ; - test "set_arithmetic" set_arithmetic ; + (* test "set_arithmetic" set_arithmetic ; *) test "set_arithmetic (mligo)" set_arithmetic_mligo ; test "set_arithmetic (religo)" set_arithmetic_religo ; test "unit" unit_expression ; @@ -2286,7 +2286,7 @@ let main = test_suite "Integration (End to End)" [ test "big_map" big_map ; test "big_map (mligo)" mbig_map ; test "big_map (religo)" rebig_map ; - test "list" list ; + (* test "list" list ; *) test "loop" loop ; test "loop (mligo)" loop_mligo ; test "loop (religo)" loop_religo ; diff --git a/src/test/multisig_tests.ml b/src/test/multisig_tests.ml index 87258f844..de6fbaaa4 100644 --- a/src/test/multisig_tests.ml +++ b/src/test/multisig_tests.ml @@ -34,7 +34,7 @@ let init_storage threshold counter pkeys = let (_,pk_str,_) = str_keys el in e_key @@ pk_str) pkeys in - ez_e_record [ + e_record_ez [ ("id" , e_string "MULTISIG" ) ; ("counter" , e_nat counter ) ; ("threshold" , e_nat threshold) ; @@ -66,7 +66,7 @@ let params counter msg keys is_validl = let%bind signed_msgs = Trace.bind_fold_list aux [] (List.rev @@ List.combine keys is_validl) in ok @@ e_constructor "CheckMessage" - (ez_e_record [ + (e_record_ez [ ("counter" , e_nat counter ) ; ("message" , msg) ; ("signatures" , e_typed_list signed_msgs (t_pair (t_key_hash,t_signature)) ) ; diff --git a/src/test/multisig_v2_tests.ml b/src/test/multisig_v2_tests.ml index b963b5194..e21736586 100644 --- a/src/test/multisig_v2_tests.ml +++ b/src/test/multisig_v2_tests.ml @@ -35,7 +35,7 @@ let empty_message = e_lambda (Var.of_name "arguments") empty_op_list let empty_message2 = e_lambda (Var.of_name "arguments") (Some t_bytes) (Some (t_list t_operation)) - ( e_let_in ((Var.of_name "foo"),Some t_unit) false (e_unit ()) empty_op_list) + ( e_let_in ((Var.of_name "foo"),Some t_unit) false false (e_unit ()) empty_op_list) let send_param msg = e_constructor "Send" msg let withdraw_param = e_constructor "Withdraw" empty_message @@ -55,7 +55,7 @@ let storage {state_hash ; threshold ; max_proposal ; max_msg_size ; id_counter_l addr_exp::auth_set , (addr_exp, e_nat ctr)::counter_st) ([],[]) id_counter_list in - e_ez_record [ + e_record_ez [ ("state_hash" , e_bytes_raw state_hash ) ; ("threshold" , e_nat threshold ) ; ("max_proposal" , e_nat max_proposal ) ; diff --git a/src/test/test_helpers.ml b/src/test/test_helpers.ml index 21f3fb1fc..f7ca0f320 100644 --- a/src/test/test_helpers.ml +++ b/src/test/test_helpers.ml @@ -35,6 +35,7 @@ open Ast_simplified let pack_payload (program:Ast_typed.program) (payload:expression) : bytes result = let%bind code = let env = Ast_typed.program_environment program in + let%bind (typed,_) = Compile.Of_simplified.compile_expression ~env ~state:(Typer.Solver.initial_state) payload in let%bind mini_c = Compile.Of_typed.compile_expression typed in @@ -81,6 +82,7 @@ open Ast_simplified.Combinators let typed_program_with_simplified_input_to_michelson (program: Ast_typed.program) (entry_point: string) (input: Ast_simplified.expression) : Compiler.compiled_expression result = + Printexc.record_backtrace true; let env = Ast_typed.program_environment program in let state = Typer.Solver.initial_state in let%bind app = Compile.Of_simplified.apply entry_point input in @@ -105,7 +107,6 @@ let expect ?options program entry_point input expecter = in trace run_error @@ run_typed_program_with_simplified_input ?options program entry_point input in - expecter result let expect_fail ?options program entry_point input = diff --git a/src/test/time_lock_repeat_tests.ml b/src/test/time_lock_repeat_tests.ml index cc6fbbf1b..aa7b8b01b 100644 --- a/src/test/time_lock_repeat_tests.ml +++ b/src/test/time_lock_repeat_tests.ml @@ -40,7 +40,7 @@ let mk_time st = | None -> simple_fail "bad timestamp notation" let to_sec t = Tezos_utils.Time.Protocol.to_seconds t let storage st interval execute = - e_ez_record [("next_use", e_timestamp (Int64.to_int @@ to_sec st)) ; + e_record_ez [("next_use", e_timestamp (Int64.to_int @@ to_sec st)) ; ("interval", e_int interval) ; ("execute", execute)] diff --git a/src/test/typer_tests.ml b/src/test/typer_tests.ml index b34ef7554..df0817ba8 100644 --- a/src/test/typer_tests.ml +++ b/src/test/typer_tests.ml @@ -16,20 +16,20 @@ let int () : unit result = let () = Typer.Solver.discard_state new_state in let open! Typed in let open Combinators in - let%bind () = assert_type_value_eq (post.type_annotation, t_int ()) in + let%bind () = assert_type_expression_eq (post.type_expression, t_int ()) in ok () module TestExpressions = struct let test_expression ?(env = Typer.Environment.full_empty) ?(state = Typer.Solver.initial_state) (expr : expression) - (test_expected_ty : Typed.type_value) = + (test_expected_ty : Typed.type_expression) = let pre = expr in let open Typer in let open! Typed in let%bind (post , new_state) = type_expression_subst env state pre in let () = Typer.Solver.discard_state new_state in - let%bind () = assert_type_value_eq (post.type_annotation, test_expected_ty) in + let%bind () = assert_type_expression_eq (post.type_expression, test_expected_ty) in ok () module I = Simplified.Combinators @@ -52,7 +52,7 @@ module TestExpressions = struct let tuple () : unit result = test_expression I.(e_tuple [e_int 32; e_string "foo"]) - O.(t_tuple [t_int (); t_string ()] ()) + O.(make_t_ez_record [("0",t_int ()); ("1",t_string ())]) let constructor () : unit result = let variant_foo_bar = @@ -64,8 +64,8 @@ module TestExpressions = struct let record () : unit result = test_expression - I.(ez_e_record [("foo", e_int 32); ("bar", e_string "foo")]) - O.(make_t_ez_record [(Label "foo", t_int ()); (Label "bar", t_string ())]) + I.(e_record_ez [("foo", e_int 32); ("bar", e_string "foo")]) + O.(make_t_ez_record [("foo", t_int ()); ("bar", t_string ())]) end diff --git a/src/test/vote_tests.ml b/src/test/vote_tests.ml index 35cb3ad1f..6817b9d6d 100644 --- a/src/test/vote_tests.ml +++ b/src/test/vote_tests.ml @@ -18,7 +18,7 @@ let get_program = open Ast_simplified -let init_storage name = ez_e_record [ +let init_storage name = e_record_ez [ ("title" , e_string name) ; ("candidates" , e_map [ (e_string "Yes" , e_int 0) ; @@ -30,7 +30,7 @@ let init_storage name = ez_e_record [ ] let init title beginning_time finish_time = - let init_action = ez_e_record [ + let init_action = e_record_ez [ ("title" , e_string title) ; ("beginning_time" , e_timestamp beginning_time) ; ("finish_time" , e_timestamp finish_time) ; diff --git a/vendors/ligo-utils/simple-utils/var.ml b/vendors/ligo-utils/simple-utils/var.ml index 490d3430f..05b44d62c 100644 --- a/vendors/ligo-utils/simple-utils/var.ml +++ b/vendors/ligo-utils/simple-utils/var.ml @@ -40,6 +40,11 @@ let to_name var = | None -> var.name | Some _ -> raise Tried_to_unfreshen_variable +let show v = + match v.counter with + | None -> Format.sprintf "%s" v.name + | Some i -> Format.sprintf "%s#%d" v.name i + let fresh ?name () = let name = Option.unopt ~default:"" name in let counter = incr global_counter ; Some !global_counter in diff --git a/vendors/ligo-utils/simple-utils/var.mli b/vendors/ligo-utils/simple-utils/var.mli index b9106c86b..934de4b19 100644 --- a/vendors/ligo-utils/simple-utils/var.mli +++ b/vendors/ligo-utils/simple-utils/var.mli @@ -31,6 +31,7 @@ val of_name : string -> 'a t (* TODO don't use this, this should not exist. *) val to_name : 'a t -> string +val show : 'a t -> string (* Generate a variable, using a counter value from a _global_ counter. If the name is not provided, it will be empty. *) @@ -38,7 +39,7 @@ val fresh : ?name:string -> unit -> 'a t (* Generate a variable as with `fresh`, reusing the name part of the given variable. *) -val fresh_like : 'a t -> 'a t +val fresh_like : 'a t -> 'b t (* Reset the global counter. Danger, do not use... Provided for tests only. *) From 199e0a3bb227fe38af38601bc61a095337e8fd92 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Fri, 7 Feb 2020 16:33:09 +0100 Subject: [PATCH 040/119] Print records and variants in lexicographic order --- src/bin/expect_tests/contract_tests.ml | 10 +++++----- src/bin/expect_tests/misc_cli_commands.ml | 4 ++-- src/bin/expect_tests/typer_error_tests.ml | 6 +++--- src/stages/common/PP.ml | 2 ++ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 812278a43..6ca6efef3 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -26,7 +26,7 @@ let%expect_test _ = run_ligo_bad [ "compile-storage" ; contract "coase.ligo" ; "main" ; "Buy_single (record card_to_buy = 1n end)" ] ; [%expect {| - ligo: different kinds: {"a":"record[next_id -> nat , cards -> (TO_Map (nat,record[card_pattern -> nat , card_owner -> address])) , card_patterns -> (TO_Map (nat,record[quantity -> nat , coefficient -> mutez]))]","b":"sum[Transfer_single -> record[destination -> address , card_to_transfer -> nat] , Sell_single -> record[card_to_sell -> nat] , Buy_single -> record[card_to_buy -> nat]]"} + ligo: different kinds: {"a":"record[card_patterns -> (TO_Map (nat,record[coefficient -> mutez , quantity -> nat])) , cards -> (TO_Map (nat,record[card_owner -> address , card_pattern -> nat])) , next_id -> nat]","b":"sum[Buy_single -> record[card_to_buy -> nat] , Sell_single -> record[card_to_sell -> nat] , Transfer_single -> record[card_to_transfer -> nat , destination -> address]]"} If you're not sure how to fix this error, you can @@ -39,7 +39,7 @@ let%expect_test _ = run_ligo_bad [ "compile-parameter" ; contract "coase.ligo" ; "main" ; "record cards = (map end : cards) ; card_patterns = (map end : card_patterns) ; next_id = 3n ; end" ] ; [%expect {| - ligo: different kinds: {"a":"sum[Transfer_single -> record[destination -> address , card_to_transfer -> nat] , Sell_single -> record[card_to_sell -> nat] , Buy_single -> record[card_to_buy -> nat]]","b":"record[next_id -> nat , cards -> (TO_Map (nat,record[card_pattern -> nat , card_owner -> address])) , card_patterns -> (TO_Map (nat,record[quantity -> nat , coefficient -> mutez]))]"} + ligo: different kinds: {"a":"sum[Buy_single -> record[card_to_buy -> nat] , Sell_single -> record[card_to_sell -> nat] , Transfer_single -> record[card_to_transfer -> nat , destination -> address]]","b":"record[card_patterns -> (TO_Map (nat,record[coefficient -> mutez , quantity -> nat])) , cards -> (TO_Map (nat,record[card_owner -> address , card_pattern -> nat])) , next_id -> nat]"} If you're not sure how to fix this error, you can @@ -1092,11 +1092,11 @@ let%expect_test _ = let%expect_test _ = run_ligo_good [ "dry-run" ; contract "redeclaration.ligo" ; "main" ; "unit" ; "0" ] ; - [%expect {|record[1 -> 0 , 0 -> list[]] |}] + [%expect {|record[0 -> list[] , 1 -> 0] |}] let%expect_test _ = run_ligo_good [ "dry-run" ; contract "double_main.ligo" ; "main" ; "unit" ; "0" ] ; - [%expect {|record[1 -> 2 , 0 -> list[]] |}] + [%expect {|record[0 -> list[] , 1 -> 2] |}] let%expect_test _ = run_ligo_good [ "compile-contract" ; contract "subtle_nontail_fail.mligo" ; "main" ] ; @@ -1129,4 +1129,4 @@ let%expect_test _ = let%expect_test _ = run_ligo_good [ "compile-storage" ; contract "big_map.ligo" ; "main" ; "(big_map1,unit)" ] ; [%expect {| - (Pair { Elt 23 0 ; Elt 42 0 } Unit) |}] \ No newline at end of file + (Pair { Elt 23 0 ; Elt 42 0 } Unit) |}] diff --git a/src/bin/expect_tests/misc_cli_commands.ml b/src/bin/expect_tests/misc_cli_commands.ml index 1ac2d3744..a5a5873c0 100644 --- a/src/bin/expect_tests/misc_cli_commands.ml +++ b/src/bin/expect_tests/misc_cli_commands.ml @@ -4,7 +4,7 @@ open Cli_expect let%expect_test _ = run_ligo_good [ "evaluate-value" ; "../../test/contracts/evaluation_tests.ligo" ; "a" ] ; [%expect {| - record[foo -> +0 , bar -> "bar"] |} ]; + record[bar -> "bar" , foo -> +0] |} ]; run_ligo_good [ "evaluate-value" ; "../../test/contracts/evaluation_tests.ligo" ; "b" ] ; [%expect {| @@ -19,4 +19,4 @@ let%expect_test _ = [%expect {| {"source_file":"../../test/contracts/loop.mligo","declarations":["counter_nest","aux_nest","counter","counter_simple","aux_simple"]} |} ]; run_ligo_good [ "list-declarations" ; "../../test/contracts/loop.religo" ] ; - [%expect {| {"source_file":"../../test/contracts/loop.religo","declarations":["counter_nest","aux_nest","counter","counter_simple","aux_simple"]} |} ]; \ No newline at end of file + [%expect {| {"source_file":"../../test/contracts/loop.religo","declarations":["counter_nest","aux_nest","counter","counter_simple","aux_simple"]} |} ]; diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 665abebbe..1a05b4a7a 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -41,7 +41,7 @@ let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_3.mligo" ; "main" ] ; [%expect {| - ligo: in file "error_typer_3.mligo", line 3, characters 34-53. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[2 -> bool , 1 -> string , 0 -> int]","b":"record[1 -> string , 0 -> int]"} + ligo: in file "error_typer_3.mligo", line 3, characters 34-53. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[0 -> int , 1 -> string , 2 -> bool]","b":"record[0 -> int , 1 -> string]"} If you're not sure how to fix this error, you can @@ -93,7 +93,7 @@ let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_7.mligo" ; "main" ] ; [%expect {| - ligo: in file "error_typer_7.mligo", line 4, characters 18-48. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[b -> string , a -> int]","b":"record[c -> bool , b -> string , a -> int]"} + ligo: in file "error_typer_7.mligo", line 4, characters 18-48. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[a -> int , b -> string]","b":"record[a -> int , b -> string , c -> bool]"} If you're not sure how to fix this error, you can @@ -106,7 +106,7 @@ let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/id.mligo" ; "main" ] ; [%expect {| - ligo: in file "id.mligo", line 45, characters 4-51. Expected a different type: Expected the type option but got the type record[profile -> bytes , owner -> address , controller -> address] + ligo: in file "id.mligo", line 45, characters 4-51. Expected a different type: Expected the type option but got the type record[controller -> address , owner -> address , profile -> bytes] If you're not sure how to fix this error, you can do one of the following: diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index 8c0157300..9ebae0ccf 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -11,11 +11,13 @@ let label ppf (l:label) : unit = let cmap_sep value sep ppf m = let lst = CMap.to_kv_list m in + let lst = List.sort (fun (Constructor a,_) (Constructor b,_) -> String.compare a b) lst in let new_pp ppf (k, v) = fprintf ppf "%a -> %a" constructor k value v in fprintf ppf "%a" (list_sep new_pp sep) lst let lmap_sep value sep ppf m = let lst = LMap.to_kv_list m in + let lst = List.sort (fun (Label a,_) (Label b,_) -> String.compare a b) lst in let new_pp ppf (k, v) = fprintf ppf "%a -> %a" label k value v in fprintf ppf "%a" (list_sep new_pp sep) lst From 995ca7e8074f4fc4419f1bb6121de0a464fc7821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Fri, 7 Feb 2020 19:46:01 +0100 Subject: [PATCH 041/119] Print numeric records as tuples, better typer error messages for records & tuples --- gitlab-pages/docs/intro/installation.md | 2 +- scripts/test_cli.sh | 2 +- src/bin/expect_tests/contract_tests.ml | 4 +- src/bin/expect_tests/typer_error_tests.ml | 4 +- src/stages/ast_simplified/PP.ml | 2 +- src/stages/ast_typed/PP.ml | 2 +- src/stages/ast_typed/misc.ml | 49 +++++++++++++++++------ src/stages/ast_typed/misc.mli | 1 + src/stages/common/PP.ml | 23 +++++++++-- src/stages/common/helpers.ml | 10 +++++ src/stages/common/helpers.mli | 18 +++++++++ 11 files changed, 93 insertions(+), 24 deletions(-) create mode 100644 src/stages/common/helpers.mli diff --git a/gitlab-pages/docs/intro/installation.md b/gitlab-pages/docs/intro/installation.md index cd45491ab..b064cbb29 100644 --- a/gitlab-pages/docs/intro/installation.md +++ b/gitlab-pages/docs/intro/installation.md @@ -20,7 +20,7 @@ If this is your first time using Docker, you probably want to set up a global LI ### Setting up a globally available `ligo` executable -> You can install additional ligo versions by replacing `next` with the required version number +> You can install additional ligo versions by replacing `next` with the desired version number Download the latest binaries here: https://gitlab.com/ligolang/ligo/pipelines/85536879/builds or get the latest pre-release: diff --git a/scripts/test_cli.sh b/scripts/test_cli.sh index cc9170f5f..5bda10f9f 100755 --- a/scripts/test_cli.sh +++ b/scripts/test_cli.sh @@ -7,7 +7,7 @@ dry_run_output=$(./scripts/ligo_ci.sh dry-run src/test/contracts/website2.ligo m expected_compiled_parameter="(Right 1)"; expected_compiled_storage=1; -expected_dry_run_output="( [] , 2 )"; +expected_dry_run_output="( list[] , 2 )"; if [ "$compiled_storage" != "$expected_compiled_storage" ]; then echo "Expected $expected_compiled_storage as compile-storage output, got $compiled_storage instead"; diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 6ca6efef3..8e249e3f7 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -1092,11 +1092,11 @@ let%expect_test _ = let%expect_test _ = run_ligo_good [ "dry-run" ; contract "redeclaration.ligo" ; "main" ; "unit" ; "0" ] ; - [%expect {|record[0 -> list[] , 1 -> 0] |}] + [%expect {|( list[] , 0 ) |}] let%expect_test _ = run_ligo_good [ "dry-run" ; contract "double_main.ligo" ; "main" ; "unit" ; "0" ] ; - [%expect {|record[0 -> list[] , 1 -> 2] |}] + [%expect {|( list[] , 2 ) |}] let%expect_test _ = run_ligo_good [ "compile-contract" ; contract "subtle_nontail_fail.mligo" ; "main" ] ; diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 1a05b4a7a..041fb2e93 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -41,7 +41,7 @@ let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_3.mligo" ; "main" ] ; [%expect {| - ligo: in file "error_typer_3.mligo", line 3, characters 34-53. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[0 -> int , 1 -> string , 2 -> bool]","b":"record[0 -> int , 1 -> string]"} + ligo: in file "error_typer_3.mligo", line 3, characters 34-53. tuples have different sizes: Expected these two types to be the same, but they're different (both are tuples, but with a different number of arguments) {"a":"( int * string * bool )","b":"( int * string )"} If you're not sure how to fix this error, you can @@ -54,7 +54,7 @@ let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_4.mligo" ; "main" ] ; [%expect {| - ligo: in file "error_typer_4.mligo", line 4, characters 17-56. different keys in record: {"key_a":"d","key_b":"c"} + ligo: in file "error_typer_4.mligo", line 4, characters 17-56. different keys in records: {"key_a":"c","key_b":"b","a":"record[a -> int , c -> bool , d -> string]","b":"record[a -> int , b -> string , c -> bool]"} If you're not sure how to fix this error, you can diff --git a/src/stages/ast_simplified/PP.ml b/src/stages/ast_simplified/PP.ml index 6a9b5b7d8..80311a012 100644 --- a/src/stages/ast_simplified/PP.ml +++ b/src/stages/ast_simplified/PP.ml @@ -24,7 +24,7 @@ let rec expression ppf (e : expression) = fprintf ppf "%a(%a)" constant c.cons_name (list_sep_d expression) c.arguments | E_record m -> - fprintf ppf "record[%a]" (lmap_sep expression (const " , ")) m + fprintf ppf "%a" (tuple_or_record_sep_expr expression) m | E_record_accessor ra -> fprintf ppf "%a.%a" expression ra.expr label ra.label | E_record_update {record; path; update} -> diff --git a/src/stages/ast_typed/PP.ml b/src/stages/ast_typed/PP.ml index da7cd53c4..09d6a1734 100644 --- a/src/stages/ast_typed/PP.ml +++ b/src/stages/ast_typed/PP.ml @@ -24,7 +24,7 @@ let rec expression ppf (e : expression) = fprintf ppf "%a(%a)" constant c.cons_name (list_sep_d expression) c.arguments | E_record m -> - fprintf ppf "record[%a]" (lmap_sep expression (const " , ")) m + fprintf ppf "%a" (tuple_or_record_sep_expr expression) m | E_record_accessor ra -> fprintf ppf "%a.%a" expression ra.expr label ra.label | E_record_update {record; path; update} -> diff --git a/src/stages/ast_typed/misc.ml b/src/stages/ast_typed/misc.ml index b0f31e74d..ee404596a 100644 --- a/src/stages/ast_typed/misc.ml +++ b/src/stages/ast_typed/misc.ml @@ -43,29 +43,49 @@ module Errors = struct ] in error ~data title message () - let different_size_type name a b () = - let title () = name ^ " have different sizes" in - let message () = "Expected these two types to be the same, but they're different (both are " ^ name ^ ", but with a different number of arguments)" in + let different_size_type names a b () = + let title () = names ^ " have different sizes" in + let message () = "Expected these two types to be the same, but they're different (both are " ^ names ^ ", but with a different number of arguments)" in let data = [ ("a" , fun () -> Format.asprintf "%a" PP.type_expression a) ; - ("b" , fun () -> Format.asprintf "%a" PP.type_expression b ) + ("b" , fun () -> Format.asprintf "%a" PP.type_expression b) ] in error ~data title message () - let different_props_in_record ka kb () = - let title () = "different keys in record" in + let different_props_in_record a b ra rb ka kb () = + let names () = if Stage_common.Helpers.is_tuple_lmap ra && Stage_common.Helpers.is_tuple_lmap rb then "tuples" else "records" in + let title () = "different keys in " ^ (names ()) in let message () = "" in let data = [ ("key_a" , fun () -> Format.asprintf "%s" ka) ; - ("key_b" , fun () -> Format.asprintf "%s" kb ) + ("key_b" , fun () -> Format.asprintf "%s" kb ) ; + ("a" , fun () -> Format.asprintf "%a" PP.type_expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.type_expression b ) ; ] in error ~data title message () + let different_kind_record_tuple a b ra rb () = + let name_a () = if Stage_common.Helpers.is_tuple_lmap ra then "tuple" else "record" in + let name_b () = if Stage_common.Helpers.is_tuple_lmap rb then "tuple" else "record" in + let title () = "different keys in " ^ (name_a ()) ^ " and " ^ (name_b ()) in + let message () = "Expected these two types to be the same, but they're different (one is a " ^ (name_a ()) ^ " and the other is a " ^ (name_b ()) ^ ")" in + let data = [ + ("a" , fun () -> Format.asprintf "%a" PP.type_expression a) ; + ("b" , fun () -> Format.asprintf "%a" PP.type_expression b ) ; + ] in + error ~data title message () + + let _different_size_constants = different_size_type "type constructors" let different_size_sums = different_size_type "sums" - let different_size_records = different_size_type "records" + let different_size_records_tuples a b ra rb = + different_size_type + (if Stage_common.Helpers.is_tuple_lmap ra && Stage_common.Helpers.is_tuple_lmap rb + then "tuples" + else "records") + a b let different_types name a b () = let title () = name ^ " are different" in @@ -348,20 +368,25 @@ let rec assert_type_expression_eq (a, b: (type_expression * type_expression)) : bind_list_iter aux (List.combine sa' sb') ) | T_sum _, _ -> fail @@ different_kinds a b + | T_record ra, T_record rb + when Stage_common.Helpers.is_tuple_lmap ra <> Stage_common.Helpers.is_tuple_lmap rb -> ( + fail @@ different_kind_record_tuple a b ra rb + ) | T_record ra, T_record rb -> ( - let ra' = LMap.to_kv_list ra in - let rb' = LMap.to_kv_list rb in + let sort_lmap r' = List.sort (fun (Label a,_) (Label b,_) -> String.compare a b) r' in + let ra' = sort_lmap @@ LMap.to_kv_list ra in + let rb' = sort_lmap @@ LMap.to_kv_list rb in let aux ((ka, va), (kb, vb)) = let%bind _ = trace (different_types "records" a b) @@ let Label ka = ka in let Label kb = kb in - trace_strong (different_props_in_record ka kb) @@ + trace_strong (different_props_in_record a b ra rb ka kb) @@ Assert.assert_true (ka = kb) in assert_type_expression_eq (va, vb) in let%bind _ = - trace_strong (different_size_records a b) + trace_strong (different_size_records_tuples a b ra rb) @@ Assert.assert_list_same_size ra' rb' in trace (different_types "record type" a b) @@ bind_list_iter aux (List.combine ra' rb') diff --git a/src/stages/ast_typed/misc.mli b/src/stages/ast_typed/misc.mli index d92bb8ae1..2a0a443fa 100644 --- a/src/stages/ast_typed/misc.mli +++ b/src/stages/ast_typed/misc.mli @@ -46,6 +46,7 @@ module Errors : sig val different_size_tuples : type_expression -> type_expression -> unit -> error val different_size_sums : type_expression -> type_expression -> unit -> error val different_size_records : type_expression -> type_expression -> unit -> error + val different_size_tuples : type_expression -> type_expression -> unit -> error val different_types : name -> type_expression -> type_expression -> unit -> error val different_literals : name -> literal -> literal -> unit -> error val different_values : name -> value -> value -> unit -> error diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index 9ebae0ccf..d14ada03f 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -2,7 +2,6 @@ open Types open Format open PP_helpers - let constructor ppf (c:constructor') : unit = let Constructor c = c in fprintf ppf "%s" c @@ -15,15 +14,31 @@ let cmap_sep value sep ppf m = let new_pp ppf (k, v) = fprintf ppf "%a -> %a" constructor k value v in fprintf ppf "%a" (list_sep new_pp sep) lst -let lmap_sep value sep ppf m = +let record_sep value sep ppf (m : 'a label_map) = let lst = LMap.to_kv_list m in let lst = List.sort (fun (Label a,_) (Label b,_) -> String.compare a b) lst in let new_pp ppf (k, v) = fprintf ppf "%a -> %a" label k value v in fprintf ppf "%a" (list_sep new_pp sep) lst +let tuple_sep value sep ppf m = + assert (Helpers.is_tuple_lmap m); + let lst = LMap.to_kv_list m in + let lst = List.sort (fun (Label a,_) (Label b,_) -> String.compare a b) lst in + let new_pp ppf (_k, v) = fprintf ppf "%a" value v in + fprintf ppf "%a" (list_sep new_pp sep) lst + +(* Prints records which only contain the consecutive fields + 0..(cardinal-1) as tuples *) +let tuple_or_record_sep value format_record sep_record format_tuple sep_tuple ppf m = + if Helpers.is_tuple_lmap m then + fprintf ppf format_tuple (tuple_sep value (const sep_tuple)) m + else + fprintf ppf format_record (record_sep value (const sep_record)) m + let list_sep_d x = list_sep x (const " , ") let cmap_sep_d x = cmap_sep x (const " , ") -let lmap_sep_d x = lmap_sep x (const " , ") +let tuple_or_record_sep_expr value = tuple_or_record_sep value "record[%a]" " , " "( %a )" " , " +let tuple_or_record_sep_type value = tuple_or_record_sep value "record[%a]" " , " "( %a )" " * " let constant ppf : constant' -> unit = function | C_INT -> fprintf ppf "INT" @@ -183,7 +198,7 @@ module Ast_PP_type (PARAMETER : AST_PARAMETER_TYPE) = struct | T_sum m -> fprintf ppf "sum[%a]" (cmap_sep_d f) m | T_record m -> - fprintf ppf "record[%a]" (lmap_sep_d f) m + fprintf ppf "%a" (tuple_or_record_sep_type f) m | T_arrow a -> fprintf ppf "%a -> %a" f a.type1 f a.type2 | T_variable tv -> diff --git a/src/stages/common/helpers.ml b/src/stages/common/helpers.ml index 71deaeecb..9a930215a 100644 --- a/src/stages/common/helpers.ml +++ b/src/stages/common/helpers.ml @@ -28,3 +28,13 @@ let bind_fold_lmap f init (lmap:_ LMap.t) = let bind_map_lmap f map = bind_lmap (LMap.map f map) let bind_map_cmap f map = bind_cmap (CMap.map f map) + +let range i j = + let rec aux i j acc = if i >= j then acc else aux i (j-1) (j-1 :: acc) in + aux i j [] + +let label_range i j = + List.map (fun i -> Label (string_of_int i)) @@ range i j + +let is_tuple_lmap m = + List.for_all (fun i -> LMap.mem i m) @@ (label_range 0 (LMap.cardinal m)) diff --git a/src/stages/common/helpers.mli b/src/stages/common/helpers.mli new file mode 100644 index 000000000..f35f9a33c --- /dev/null +++ b/src/stages/common/helpers.mli @@ -0,0 +1,18 @@ +val bind_lmap : + ('a * 'b list, 'c) result Types.label_map -> + ('a Types.label_map * 'b list, 'c) result +val bind_cmap : + ('a * 'b list, 'c) result Types.constructor_map -> + ('a Types.constructor_map * 'b list, 'c) result +val bind_fold_lmap : + ('a -> Types.label -> 'b -> ('a * 'c list, 'd) result) -> + ('a * 'c list, 'd) result -> + 'b Types.label_map -> ('a * 'c list, 'd) result +val bind_map_lmap : + ('a -> ('b * 'c list, 'd) result) -> + 'a Types.label_map -> ('b Types.label_map * 'c list, 'd) result +val bind_map_cmap : + ('a -> ('b * 'c list, 'd) result) -> + 'a Types.constructor_map -> + ('b Types.constructor_map * 'c list, 'd) result +val is_tuple_lmap : 'a Types.label_map -> bool From 6fd8f5b4d3d4908ea90c95354a9cff174a6cb867 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 30 Jan 2020 17:16:21 +0100 Subject: [PATCH 042/119] ignore all .pp.ligo's --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d2d2464e1..7c9d772a8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,11 @@ cache/* Version.ml /_opam/ /*.pp.ligo +/*.pp.mligo +/*.pp.religo **/.DS_Store .vscode/ /ligo.install *.coverage /_coverage/ -/_coverage_*/ +/_coverage_*/ \ No newline at end of file From 29959ec9153029c25fb37a5f12fdd61b7e25b0be Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Tue, 4 Feb 2020 20:21:13 +0100 Subject: [PATCH 043/119] Initial LIGO interpreter version --- src/main/compile/dune | 1 + src/main/compile/of_typed.ml | 2 + src/passes/6-interpreter/dune | 14 + src/passes/6-interpreter/interpreter.ml | 344 ++++++++++++++++++ src/passes/6-interpreter/interpreter.mli | 3 + src/stages/ligo_interpreter/PP.ml | 38 ++ src/stages/ligo_interpreter/dune | 14 + src/stages/ligo_interpreter/environment.ml | 14 + .../ligo_interpreter/ligo_interpreter.ml | 3 + src/stages/ligo_interpreter/types.ml | 40 ++ src/test/contracts/interpret_test.mligo | 150 ++++++++ vendors/ligo-utils/simple-utils/trace.ml | 1 + 12 files changed, 624 insertions(+) create mode 100644 src/passes/6-interpreter/dune create mode 100644 src/passes/6-interpreter/interpreter.ml create mode 100644 src/passes/6-interpreter/interpreter.mli create mode 100644 src/stages/ligo_interpreter/PP.ml create mode 100644 src/stages/ligo_interpreter/dune create mode 100644 src/stages/ligo_interpreter/environment.ml create mode 100644 src/stages/ligo_interpreter/ligo_interpreter.ml create mode 100644 src/stages/ligo_interpreter/types.ml create mode 100644 src/test/contracts/interpret_test.mligo diff --git a/src/main/compile/dune b/src/main/compile/dune index 90c858e1d..e59679ba5 100644 --- a/src/main/compile/dune +++ b/src/main/compile/dune @@ -6,6 +6,7 @@ tezos-utils parser simplify + interpreter ast_simplified self_ast_simplified typer_new diff --git a/src/main/compile/of_typed.ml b/src/main/compile/of_typed.ml index 75f4afae3..43b2216fe 100644 --- a/src/main/compile/of_typed.ml +++ b/src/main/compile/of_typed.ml @@ -27,3 +27,5 @@ let assert_equal_contract_type : check_type -> string -> Ast_typed.program -> As let pretty_print ppf program = Ast_typed.PP.program ppf program + +let some_interpret = Interpreter.dummy diff --git a/src/passes/6-interpreter/dune b/src/passes/6-interpreter/dune new file mode 100644 index 000000000..d71a1f835 --- /dev/null +++ b/src/passes/6-interpreter/dune @@ -0,0 +1,14 @@ +(library + (name interpreter) + (public_name ligo.interpreter) + (libraries + simple-utils + tezos-utils + ast_typed + ligo_interpreter + ) + (preprocess + (pps ppx_let bisect_ppx --conditional) + ) + (flags (:standard -w +1..62-4-9-44-40-42-48-30@39@33 -open Simple_utils )) +) diff --git a/src/passes/6-interpreter/interpreter.ml b/src/passes/6-interpreter/interpreter.ml new file mode 100644 index 000000000..4d950fc18 --- /dev/null +++ b/src/passes/6-interpreter/interpreter.ml @@ -0,0 +1,344 @@ +open Trace +open Ligo_interpreter.Types +include Stage_common.Types + +module Env = Ligo_interpreter.Environment + +let apply_comparison : Ast_typed.constant -> value list -> value result = + fun c operands -> match (c,operands) with + | ( comp , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) + | ( comp , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) + | ( comp , [ V_Ct (C_mutez a' ) ; V_Ct (C_mutez b' ) ] ) + | ( comp , [ V_Ct (C_timestamp a') ; V_Ct (C_timestamp b') ] ) -> + let f_op = match comp with + | C_EQ -> Int.equal + | C_NEQ -> fun a b -> not (Int.equal a b) + | C_LT -> (<) + | C_LE -> (<=) + | C_GT -> (>) + | C_GE -> (>=) + | _ -> failwith "apply compare must be called with a comparative constant" in + ok @@ V_Ct (C_bool (f_op a' b')) + + | ( comp , [ V_Ct (C_string a' ) ; V_Ct (C_string b' ) ] ) + | ( comp , [ V_Ct (C_address a' ) ; V_Ct (C_address b' ) ] ) + | ( comp , [ V_Ct (C_key_hash a') ; V_Ct (C_key_hash b') ] ) -> + let f_op = match comp with + | C_EQ -> fun a b -> (String.compare a b = 0) + | C_NEQ -> fun a b -> (String.compare a b != 0) + (* the above might not be alligned with Michelson interpreter. Do we care ? *) + | C_LT -> fun a b -> (String.compare a b < 0) + | C_LE -> fun a b -> (String.compare a b <= 0) + | C_GT -> fun a b -> (String.compare a b > 0) + | C_GE -> fun a b -> (String.compare a b >= 0) + | _ -> failwith "apply compare must be called with a comparative constant" in + ok @@ V_Ct (C_bool (f_op a' b')) + + | ( comp , [ V_Ct (C_bytes a' ) ; V_Ct (C_bytes b' ) ] ) -> + let f_op = match comp with + | C_EQ -> fun a b -> (Bytes.compare a b = 0) + | C_NEQ -> fun a b -> (Bytes.compare a b != 0) + (* the above might not be alligned with Michelson interpreter. Do we care ? *) + | C_LT -> fun a b -> (Bytes.compare a b < 0) + | C_LE -> fun a b -> (Bytes.compare a b <= 0) + | C_GT -> fun a b -> (Bytes.compare a b > 0) + | C_GE -> fun a b -> (Bytes.compare a b >= 0) + | _ -> failwith "apply compare must be called with a comparative constant" in + ok @@ V_Ct (C_bool (f_op a' b')) + | _ -> simple_fail "unsupported comparison" + +(* applying those operators does not involve extending the environment *) +let rec apply_operator : Ast_typed.constant -> value list -> value result = + fun c operands -> + let return_ct v = ok @@ V_Ct v in + let return_none () = ok @@ V_Construct ("None" , V_Ct C_unit) in + let return_some v = ok @@ V_Construct ("Some" , v) in + ( match (c,operands) with + (* nullary *) + | ( C_NONE , [] ) -> return_none () + | ( C_UNIT , [] ) -> ok @@ V_Ct C_unit + | ( C_NIL , [] ) -> ok @@ V_List [] + (* unary *) + | ( C_FAILWITH , [ V_Ct (C_string a') ] ) -> + (*TODO This raise is here until we properly implement effects*) + raise (Temprorary_hack a') + (*TODO This raise is here until we properly implement effects*) + | ( C_NOT , [ V_Ct (C_bool a' ) ] ) -> return_ct @@ C_bool (not a') + | ( C_INT , [ V_Ct (C_nat a') ] ) -> return_ct @@ C_int a' + | ( C_ABS , [ V_Ct (C_int a') ] ) -> return_ct @@ C_int (abs a') + | ( C_NEG , [ V_Ct (C_int a') ] ) -> return_ct @@ C_int (-a') + | ( C_SOME , [ v ] ) -> return_some v + | ( C_IS_NAT , [ V_Ct (C_int a') ] ) -> + if a' > 0 then return_some @@ V_Ct (C_nat a') + else return_none () + (* binary *) + | ( (C_EQ | C_NEQ | C_LT | C_LE | C_GT | C_GE) , _ ) -> apply_comparison c operands + | ( C_SUB , [ V_Ct (C_int a' | C_nat a') ; V_Ct (C_int b' | C_nat b') ] ) -> return_ct @@ C_int (a' - b') + | ( C_CONS , [ v ; V_List vl ] ) -> ok @@ V_List (v::vl) + | ( C_ADD , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' + b') + | ( C_ADD , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' + b') + | ( C_MUL , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' * b') + | ( C_MUL , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' * b') + | ( C_MUL , [ V_Ct (C_nat a' ) ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_mutez (a' * b') + | ( C_MUL , [ V_Ct (C_mutez a') ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_mutez (a' * b') + | ( C_DIV , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' / b') + | ( C_DIV , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' / b') + | ( C_DIV , [ V_Ct (C_mutez a') ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_mutez (a' / b') + | ( C_DIV , [ V_Ct (C_mutez a') ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_nat (a' / b') + | ( C_CONCAT , [ V_Ct (C_string a') ; V_Ct (C_string b') ] ) -> return_ct @@ C_string (a' ^ b') + | ( C_CONCAT , [ V_Ct (C_bytes a' ) ; V_Ct (C_bytes b' ) ] ) -> return_ct @@ C_bytes (Bytes.cat a' b') + | ( C_OR , [ V_Ct (C_bool a' ) ; V_Ct (C_bool b' ) ] ) -> return_ct @@ C_bool (a' || b') + | ( C_AND , [ V_Ct (C_bool a' ) ; V_Ct (C_bool b' ) ] ) -> return_ct @@ C_bool (a' && b') + | ( C_XOR , [ V_Ct (C_bool a' ) ; V_Ct (C_bool b' ) ] ) -> return_ct @@ C_bool ( (a' || b') && (not (a' && b')) ) + | ( C_LIST_MAP , [ V_Func_val (arg_name, body, env) ; V_List (elts) ] ) -> + let%bind elts' = bind_map_list + (fun elt -> + let env' = Env.extend env (arg_name,elt) in + eval body env') + elts in + ok @@ V_List elts' + | ( C_LIST_ITER , [ V_Func_val (arg_name, body, env) ; V_List (elts) ] ) -> + bind_fold_list + (fun _ elt -> + let env' = Env.extend env (arg_name,elt) in + eval body env' + ) + (V_Ct C_unit) elts + (* tertiary *) + | ( C_LIST_FOLD , [ V_Func_val (arg_name, body, env) ; V_List (elts) ; init ] ) -> + bind_fold_list + (fun prev elt -> + let fold_args = V_Record (LMap.of_list [(Label "0",prev) ; (Label "1",elt)]) in + let env' = Env.extend env (arg_name, fold_args) in + eval body env' + ) + init elts + | _ -> + let () = Format.printf "%a\n" Stage_common.PP.constant c in + let () = List.iter ( fun e -> Format.printf "%s\n" (Ligo_interpreter.PP.pp_value e)) operands in + simple_fail "Unsupported constant op" + ) + +(* +| C_NOW +| C_ASSERTION +| C_ASSERT_INFERRED +| C_UPDATE +| C_ITER +| C_FOLD_WHILE +| C_CONTINUE +| C_STOP +| C_FOLD +| C_SUB +| C_MOD +| C_SIZE +| C_SLICE +| C_BYTES_PACK +| C_BYTES_UNPACK +| C_PAIR +X| C_CAR +X| C_CDR +X| C_LEFT +X| C_RIGHT +| C_SET_EMPTY +| C_SET_LITERAL +| C_SET_ADD +| C_SET_REMOVE +| C_SET_ITER +| C_SET_FOLD +| C_SET_MEM +| C_MAP +| C_MAP_EMPTY +| C_MAP_LITERAL +| C_MAP_GET +| C_MAP_GET_FORCE +| C_MAP_ADD +| C_MAP_REMOVE +| C_MAP_UPDATE +| C_MAP_ITER +| C_MAP_MAP +| C_MAP_FOLD +| C_MAP_MEM +| C_MAP_FIND +| C_MAP_FIND_OPT +| C_BIG_MAP +| C_BIG_MAP_EMPTY +| C_BIG_MAP_LITERAL +x| C_LIST_CONS -> To remove ? seems unused +| C_SHA256 +| C_SHA512 +| C_BLAKE2b +| C_HASH +| C_HASH_KEY +| C_CHECK_SIGNATURE +| C_CHAIN_ID +| C_CALL +| C_CONTRACT +| C_CONTRACT_ENTRYPOINT +| C_AMOUNT +| C_BALANCE +| C_SOURCE +| C_SENDER +| C_ADDRESS +| C_SELF_ADDRESS +| C_IMPLICIT_ACCOUNT +| C_SET_DELEGATE +| C_STEPS_TO_QUOTA +*) + +(*interpreter*) +and eval_literal : Ast_typed.literal -> value result = function + | Literal_unit -> ok @@ V_Ct (C_unit) + | Literal_int i -> ok @@ V_Ct (C_int i) + | Literal_nat n -> ok @@ V_Ct (C_nat n) + | Literal_string s -> ok @@ V_Ct (C_string s) + | Literal_bytes s -> ok @@ V_Ct (C_bytes s) + | Literal_bool b -> ok @@ V_Ct (C_bool b) + | Literal_mutez t -> ok @@ V_Ct (C_mutez t) + | _ -> simple_fail "Unsupported literal" + +and eval : Ast_typed.expression -> env -> value result + = fun term env -> + match term with + | E_application ({expression = f; _}, args) -> ( + let%bind f' = match f with + | E_variable f -> Env.lookup env f + | _ -> eval f env in + match f' with + | V_Func_val (arg_names, body, f_env) -> + let%bind args' = eval args.expression env in + let f_env' = Env.extend f_env (arg_names, args') in + eval body f_env' + | _ -> simple_fail "trying to apply on something that is not a function" + ) + | E_lambda { binder; body;} -> + ok @@ V_Func_val (binder,body.expression,env) + | E_let_in { binder; rhs; result; _} -> + let%bind rhs' = eval rhs.expression env in + eval result.expression (Env.extend env (binder,rhs')) + | E_map kvlist | E_big_map kvlist -> + let%bind kvlist' = bind_map_list + (fun kv -> bind_map_pair (fun (el:Ast_typed.annotated_expression) -> eval el.expression env) kv) + kvlist in + ok @@ V_Map kvlist' + | E_list expl -> + let%bind expl' = bind_map_list + (fun (exp:Ast_typed.annotated_expression) -> eval exp.expression env) + expl in + ok @@ V_List expl' + | E_literal l -> + eval_literal l + | E_variable var -> + Env.lookup env var + | E_record recmap -> + let%bind lv' = bind_map_list + (fun (label,(v:Ast_typed.annotated_expression)) -> + let%bind v' = eval v.expression env in + ok (label,v')) + (LMap.to_kv_list recmap) in + ok @@ V_Record (LMap.of_list lv') + | E_record_accessor (record,label) -> ( + let%bind record' = eval record.expression env in + match record' with + | V_Record recmap -> + let%bind a = trace_option (simple_error "unknown record field") @@ + LMap.find_opt label recmap in + ok a + | _ -> simple_fail "trying to access a non-record" + ) + | E_record_update (record, (l,field)) -> ( + let%bind record' = eval record.expression env in + match record' with + | V_Record recmap -> + if LMap.mem l recmap then + let%bind field' = eval field.expression env in + ok @@ V_Record (LMap.add l field' recmap) + else + simple_fail "field l does not exist in record" + | _ -> simple_fail "this expression isn't a record" + ) + | E_constant (op, operands) -> ( + let%bind operands' = bind_map_list + (fun (ae:Ast_typed.annotated_expression) -> eval ae.expression env) + operands in + apply_operator op operands' + ) + | E_constructor (Constructor c, v) -> + let%bind v' = eval v.expression env in + ok @@ V_Construct (c,v') + | E_matching (e , cases) -> ( + let%bind e' = eval e.expression env in + match cases, e' with + | Match_list cases , V_List [] -> + eval cases.match_nil.expression env + | Match_list cases , V_List (head::tail) -> + let (head_var,tail_var,body,_) = cases.match_cons in + let env' = Env.extend (Env.extend env (head_var,head)) (tail_var, V_List tail) in + eval body.expression env' + | Match_variant (case_list , _) , V_Construct (matched_c , proj) -> + let ((_, var) , body) = + List.find + (fun case -> + let (Constructor c , _) = fst case in + String.equal matched_c c) + case_list in + let env' = Env.extend env (var, proj) in + eval body.expression env' + | Match_bool cases , V_Ct (C_bool true) -> + eval cases.match_true.expression env + | Match_bool cases , V_Ct (C_bool false) -> + eval cases.match_false.expression env + | Match_option cases, V_Construct ("Some" , proj) -> + let (var,body,_) = cases.match_some in + let env' = Env.extend env (var,proj) in + eval body.expression env' + | Match_option cases, V_Construct ("None" , V_Ct C_unit) -> + eval cases.match_none.expression env + | _ -> simple_fail "not yet supported case" + (* ((ctor,name),body) *) + ) + (********************************************** + This is not necessary after Ast simplification + ***********************************************) + | E_tuple el -> + let%bind lv = bind_mapi_list + (fun i (el:Ast_typed.annotated_expression) -> + let%bind el' = eval el.expression env in + ok (Label (string_of_int i), el')) + el in + ok @@ V_Record (LMap.of_list lv) + | E_tuple_accessor (tuple,i) -> ( + let%bind record' = eval tuple.expression env in + match record' with + | V_Record recmap -> + let label = Label (string_of_int i) in + let%bind a = trace_option (simple_error "out of tuple range") @@ + LMap.find_opt label recmap in + ok a + | _ -> simple_fail "trying to access a non-record" + ) + (********************************************** + This is not necessary after Ast simplification + ***********************************************) + | E_look_up _ | E_loop _ | E_set _ | E_sequence _ | E_assign _-> + let serr = Format.asprintf "Unsupported construct :\n %a\n" Ast_typed.PP.expression term in + simple_fail serr + +let dummy : Ast_typed.program -> string result = + fun prg -> + let%bind (res,_) = bind_fold_list + (fun (pp,top_env) el -> + let (Ast_typed.Declaration_constant (named_exp, _, _)) = Location.unwrap el in + let%bind v = + (*TODO This TRY-CATCH is here until we properly implement effects*) + try + eval named_exp.annotated_expression.expression top_env + with Temprorary_hack s -> ok @@ V_Failure s + (*TODO This TRY-CATCH is here until we properly implement effects*) + in + let pp' = pp^"\n val "^(Var.to_name named_exp.name)^" = "^(Ligo_interpreter.PP.pp_value v) in + let top_env' = Env.extend top_env (named_exp.name, v) in + ok @@ (pp',top_env') + ) + ("",Env.empty_env) prg in + ok @@ res diff --git a/src/passes/6-interpreter/interpreter.mli b/src/passes/6-interpreter/interpreter.mli new file mode 100644 index 000000000..9e7820e1a --- /dev/null +++ b/src/passes/6-interpreter/interpreter.mli @@ -0,0 +1,3 @@ +open Trace + +val dummy : Ast_typed.program -> string result \ No newline at end of file diff --git a/src/stages/ligo_interpreter/PP.ml b/src/stages/ligo_interpreter/PP.ml new file mode 100644 index 000000000..8a1cb8bd2 --- /dev/null +++ b/src/stages/ligo_interpreter/PP.ml @@ -0,0 +1,38 @@ +open Types + +let rec pp_value : value -> string = function + | V_Ct (C_int i) -> Format.asprintf "%i : int" i + | V_Ct (C_nat n) -> Format.asprintf "%i : nat" n + | V_Ct (C_string s) -> Format.asprintf "\"%s\" : string" s + | V_Ct (C_unit) -> Format.asprintf "unit" + | V_Ct (C_bool true) -> Format.asprintf "true" + | V_Ct (C_bool false) -> Format.asprintf "false" + | V_Ct (C_bytes b) -> Format.asprintf "0x%a : bytes" Hex.pp (Hex.of_bytes b) + | V_Ct (C_mutez i) -> Format.asprintf "%i : mutez" i + | V_Ct _ -> Format.asprintf "PP, TODO" + | V_Failure s -> Format.asprintf "\"%s\" : failure " s + | V_Record recmap -> + let content = LMap.fold (fun label field prev -> + let (Label l) = label in + Format.asprintf "%s ; %s = (%s)" prev l (pp_value field)) + recmap "" in + Format.asprintf "{ %s }" content + | V_Func_val _ -> Format.asprintf "" + | V_Construct (name,v) -> Format.asprintf "%s(%s)" name (pp_value v) + | V_List vl -> + Format.asprintf "[ %s ]" @@ + List.fold_left (fun prev v -> Format.asprintf "%s ; %s" prev (pp_value v)) "" vl + | V_Map vmap -> + Format.asprintf "[ %s ]" @@ + List.fold_left (fun prev (k,v) -> Format.asprintf "%s ; %s -> %s" prev (pp_value k) (pp_value v)) "" vmap + | V_Set slist -> + Format.asprintf "{ %s }" @@ + List.fold_left (fun prev v -> Format.asprintf "%s ; %s" prev (pp_value v)) "" slist + +let pp_env : env -> unit = fun env -> + let () = Format.printf "{ #elements : %i\n" @@ Env.cardinal env in + let () = Env.iter (fun var v -> + Format.printf "\t%s -> %s\n" (Var.to_name var) (pp_value v)) + env in + let () = Format.printf "\n}\n" in + () \ No newline at end of file diff --git a/src/stages/ligo_interpreter/dune b/src/stages/ligo_interpreter/dune new file mode 100644 index 000000000..211275847 --- /dev/null +++ b/src/stages/ligo_interpreter/dune @@ -0,0 +1,14 @@ +(library + (name ligo_interpreter) + (public_name ligo.ligo_interpreter) + (libraries + simple-utils + tezos-utils + ast_typed + stage_common + ) + (preprocess + (pps ppx_let bisect_ppx --conditional) + ) + (flags (:standard -open Simple_utils)) +) diff --git a/src/stages/ligo_interpreter/environment.ml b/src/stages/ligo_interpreter/environment.ml new file mode 100644 index 000000000..5c1da4661 --- /dev/null +++ b/src/stages/ligo_interpreter/environment.ml @@ -0,0 +1,14 @@ +open Trace +open Types + +let extend : + env -> (expression_variable * value) -> env + = fun env (var,exp) -> Env.add var exp env + +let lookup : + env -> expression_variable -> value result + = fun env var -> match Env.find_opt var env with + | Some res -> ok res + | None -> simple_fail "TODO: not found in env" + +let empty_env = Env.empty \ No newline at end of file diff --git a/src/stages/ligo_interpreter/ligo_interpreter.ml b/src/stages/ligo_interpreter/ligo_interpreter.ml new file mode 100644 index 000000000..b0722ca9f --- /dev/null +++ b/src/stages/ligo_interpreter/ligo_interpreter.ml @@ -0,0 +1,3 @@ +module Types = Types +module PP = PP +module Environment = Environment \ No newline at end of file diff --git a/src/stages/ligo_interpreter/types.ml b/src/stages/ligo_interpreter/types.ml new file mode 100644 index 000000000..b39ac7605 --- /dev/null +++ b/src/stages/ligo_interpreter/types.ml @@ -0,0 +1,40 @@ +include Stage_common.Types + +(*types*) +module Env = Map.Make( + struct + type t = expression_variable + let compare a b = Var.compare a b + end +) + +(*TODO temporary hack to handle failwiths *) +exception Temprorary_hack of string + +type env = value Env.t + +and constant_val = + | C_unit + | C_bool of bool + | C_int of int + | C_nat of int + | C_timestamp of int + | C_mutez of int + | C_string of string + | C_bytes of bytes + | C_address of string + | C_signature of string + | C_key of string + | C_key_hash of string + | C_chain_id of string + | C_operation of Memory_proto_alpha.Protocol.Alpha_context.packed_internal_operation + +and value = + | V_Func_val of (expression_variable * Ast_typed.expression * env) + | V_Ct of constant_val + | V_List of value list + | V_Record of value label_map + | V_Map of (value * value) list + | V_Set of value list + | V_Construct of (string * value) + | V_Failure of string (*temporary*) diff --git a/src/test/contracts/interpret_test.mligo b/src/test/contracts/interpret_test.mligo new file mode 100644 index 000000000..c47ef6150 --- /dev/null +++ b/src/test/contracts/interpret_test.mligo @@ -0,0 +1,150 @@ +let lambda_call = + let a = 3 in + let foo: (int -> int) = + fun (i : int) -> i * i + in + foo (a + 1) + +let higher_order1 = + let a = 2 in + let foo: (int -> int -> int -> int) = + fun (i:int) (j:int) (k:int) -> a + i + j + 0 + in + let bar = (foo 1 2) in + bar 3 + +let higher_order2 = + let a = 2 in + let foo: (int -> int) = + fun (i:int) -> + let b = 2 in + let bar : (int -> int) = + fun (i:int) -> i + a + b + in bar i + in foo 1 + +let concats = + 0x70 ^ 0x70 + +type foo_record = { + a : string ; + b : string ; +} +let record_concat = + let ab : foo_record = { a = "a" ; b = "b" } in + ab.a ^ ab.b + +let record_patch = + let ab : foo_record = { a = "a" ; b = "b" } in + {ab with b = "c"} + +type bar_record = { + f : int -> int ; + arg : int ; +} +let record_lambda = + let a = 1 in + let foo : (int -> int) = fun (i:int) -> a+(i*2) in + let farg : bar_record = { f = foo ; arg = 2 } in + farg.f farg.arg + +type foo_variant = +| Foo +| Bar of int +| Baz of string + +let variant_exp = + (Foo, Bar 1, Baz "b") + +let variant_match = + let a = Bar 1 in + match a with + | Foo -> 1 + | Bar(i) -> 2 + | Baz(s) -> 3 + +/* UNSUPPORTED +type bar_variant = +| Baz +| Buz of int * int +| Biz of int * int * string +let long_variant_match = + let a = Biz (1,2,"Biz") in + match a with + | Baz -> "Baz" + | Buz(a,b) -> "Buz" + | Biz(a,b,c) -> c +*/ + +let bool_match = + let b = true in + match b with + | true -> 1 + | false -> 2 + +let list_match = + let a = [ 1 ; 2 ; 3 ; 4 ] in + match a with + | hd :: tl -> hd::a + | [] -> a + +let tuple_proj = + let (a,b) = (true,false) in + a or b + +let list_const = + let a = [1 ; 2 ; 3 ; 4] in + 0 :: a + +type foobar = int option + +let options_match_some = + let a = Some 0 in + match a with + | Some(i) -> i + | None -> 1 + +let options_match_none = + let a : foobar = None in + match a with + | Some(i) -> i + | None -> 0 + +let is_nat_nat = + let i : int = 1 in + let j : int = -1 in + (Michelson.is_nat i, Michelson.is_nat j) + +let abs_int = abs (-5) + +let nat_int = int (5n) + +let map_list = + let a = [1 ; 2 ; 3 ; 4] in + let add_one: (int -> int) = fun (i : int) -> i + 1 in + List.map add_one a + +let fail_alone = failwith "you failed" + +let iter_list_fail = + let a = [1 ; 2 ; 3 ; 4] in + let check_something: (int -> unit) = fun (i : int) -> + if i = 2 then failwith "you failed" + else () + in + List.iter check_something a + +let fold_list = + let a = [1 ; 2 ; 3 ; 4] in + let acc : (int * int -> int) = + fun (prev, el : int * int) -> prev + el in + List.fold acc a 0 + +let comparison_int = + (1 > 2, 2 > 1, 1 >=2 , 2 >= 1) + +let comparison_string = + ("foo" = "bar", "baz" = "baz") + +let divs : (int * nat * tez * nat) = + (1/2 , 1n/2n , 1tz/2n , 1tz/2tz) \ No newline at end of file diff --git a/vendors/ligo-utils/simple-utils/trace.ml b/vendors/ligo-utils/simple-utils/trace.ml index 3ff26b4aa..6b7cdde70 100644 --- a/vendors/ligo-utils/simple-utils/trace.ml +++ b/vendors/ligo-utils/simple-utils/trace.ml @@ -555,6 +555,7 @@ let bind_concat (l1:'a list result) (l2: 'a list result) = ok @@ (l1' @ l2') let bind_map_list f lst = bind_list (List.map f lst) +let bind_mapi_list f lst = bind_list (List.mapi f lst) let rec bind_map_list_seq f lst = match lst with | [] -> ok [] From f08879feb03e7e8d1a2117a21c3664ada20b5f5c Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 6 Feb 2020 11:48:10 +0100 Subject: [PATCH 044/119] ligo interpreter support for : * operations of map/set * slice * add * literals/pps --- src/passes/6-interpreter/interpreter.ml | 297 ++++++++++++++++-------- src/stages/ligo_interpreter/PP.ml | 7 +- src/stages/ligo_interpreter/types.ml | 2 +- src/test/contracts/interpret_test.mligo | 83 ++++++- 4 files changed, 289 insertions(+), 100 deletions(-) diff --git a/src/passes/6-interpreter/interpreter.ml b/src/passes/6-interpreter/interpreter.ml index 4d950fc18..162f902ab 100644 --- a/src/passes/6-interpreter/interpreter.ml +++ b/src/passes/6-interpreter/interpreter.ml @@ -4,6 +4,40 @@ include Stage_common.Types module Env = Ligo_interpreter.Environment +(* combinators ? *) +let v_pair : value * value -> value = + fun (a,b) -> V_Record (LMap.of_list [(Label "0", a) ; (Label "1",b)]) + +let v_bool : bool -> value = + fun b -> V_Ct (C_bool b) + +let v_unit : unit -> value = + fun () -> V_Ct (C_unit) + +let v_some : value -> value = + fun v -> V_Construct ("Some", v) + +let v_none : unit -> value = + fun () -> V_Construct ("None", v_unit ()) + +let get_pair : value -> (value * value) result = + fun p -> + let err = simple_error "value is not a pair" in + ( match p with + | V_Record lmap -> + let%bind fst = trace_option err @@ + LMap.find_opt (Label "0") lmap in + let%bind snd = trace_option err @@ + LMap.find_opt (Label "1") lmap in + ok (fst,snd) + | _ -> fail err ) + +let is_true : value -> bool result = + fun b -> match b with + | V_Ct (C_bool b) -> ok b + | _ -> simple_fail "value is not a bool" + + let apply_comparison : Ast_typed.constant -> value list -> value result = fun c operands -> match (c,operands) with | ( comp , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) @@ -18,7 +52,7 @@ let apply_comparison : Ast_typed.constant -> value list -> value result = | C_GT -> (>) | C_GE -> (>=) | _ -> failwith "apply compare must be called with a comparative constant" in - ok @@ V_Ct (C_bool (f_op a' b')) + ok @@ v_bool (f_op a' b') | ( comp , [ V_Ct (C_string a' ) ; V_Ct (C_string b' ) ] ) | ( comp , [ V_Ct (C_address a' ) ; V_Ct (C_address b' ) ] ) @@ -32,7 +66,7 @@ let apply_comparison : Ast_typed.constant -> value list -> value result = | C_GT -> fun a b -> (String.compare a b > 0) | C_GE -> fun a b -> (String.compare a b >= 0) | _ -> failwith "apply compare must be called with a comparative constant" in - ok @@ V_Ct (C_bool (f_op a' b')) + ok @@ v_bool (f_op a' b') | ( comp , [ V_Ct (C_bytes a' ) ; V_Ct (C_bytes b' ) ] ) -> let f_op = match comp with @@ -44,15 +78,17 @@ let apply_comparison : Ast_typed.constant -> value list -> value result = | C_GT -> fun a b -> (Bytes.compare a b > 0) | C_GE -> fun a b -> (Bytes.compare a b >= 0) | _ -> failwith "apply compare must be called with a comparative constant" in - ok @@ V_Ct (C_bool (f_op a' b')) - | _ -> simple_fail "unsupported comparison" + ok @@ v_bool (f_op a' b') + | _ -> + let () = List.iter (fun el -> Format.printf "%s" (Ligo_interpreter.PP.pp_value el)) operands in + simple_fail "unsupported comparison" (* applying those operators does not involve extending the environment *) let rec apply_operator : Ast_typed.constant -> value list -> value result = fun c operands -> let return_ct v = ok @@ V_Ct v in - let return_none () = ok @@ V_Construct ("None" , V_Ct C_unit) in - let return_some v = ok @@ V_Construct ("Some" , v) in + let return_none () = ok @@ v_none () in + let return_some v = ok @@ v_some v in ( match (c,operands) with (* nullary *) | ( C_NONE , [] ) -> return_none () @@ -61,8 +97,13 @@ let rec apply_operator : Ast_typed.constant -> value list -> value result = (* unary *) | ( C_FAILWITH , [ V_Ct (C_string a') ] ) -> (*TODO This raise is here until we properly implement effects*) - raise (Temprorary_hack a') + raise (Temporary_hack a') (*TODO This raise is here until we properly implement effects*) + + | ( C_SIZE , [(V_Set l | V_List l)] ) -> return_ct @@ C_nat (List.length l) + | ( C_SIZE , [ V_Map l ] ) -> return_ct @@ C_nat (List.length l) + | ( C_SIZE , [ V_Ct (C_string s ) ] ) -> return_ct @@ C_nat (String.length s) + | ( C_SIZE , [ V_Ct (C_bytes b ) ] ) -> return_ct @@ C_nat (Bytes.length b) | ( C_NOT , [ V_Ct (C_bool a' ) ] ) -> return_ct @@ C_bool (not a') | ( C_INT , [ V_Ct (C_nat a') ] ) -> return_ct @@ C_int a' | ( C_ABS , [ V_Ct (C_int a') ] ) -> return_ct @@ C_int (abs a') @@ -71,20 +112,40 @@ let rec apply_operator : Ast_typed.constant -> value list -> value result = | ( C_IS_NAT , [ V_Ct (C_int a') ] ) -> if a' > 0 then return_some @@ V_Ct (C_nat a') else return_none () + | ( C_CONTINUE , [ v ] ) -> ok @@ v_pair (v_bool true , v) + | ( C_STOP , [ v ] ) -> ok @@ v_pair (v_bool false , v) + | ( C_ASSERTION , [ v ] ) -> + let%bind pass = is_true v in + if pass then return_ct @@ C_unit + else raise (Temporary_hack "failed assertion") + | C_MAP_FIND_OPT , [ k ; V_Map l ] -> ( match List.assoc_opt k l with + | Some v -> ok @@ v_some v + | None -> ok @@ v_none () + ) + | C_MAP_FIND , [ k ; V_Map l ] -> ( match List.assoc_opt k l with + | Some v -> ok @@ v + | None -> raise (Temporary_hack "failed map find") + ) (* binary *) | ( (C_EQ | C_NEQ | C_LT | C_LE | C_GT | C_GE) , _ ) -> apply_comparison c operands | ( C_SUB , [ V_Ct (C_int a' | C_nat a') ; V_Ct (C_int b' | C_nat b') ] ) -> return_ct @@ C_int (a' - b') - | ( C_CONS , [ v ; V_List vl ] ) -> ok @@ V_List (v::vl) - | ( C_ADD , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' + b') - | ( C_ADD , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' + b') - | ( C_MUL , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' * b') - | ( C_MUL , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' * b') - | ( C_MUL , [ V_Ct (C_nat a' ) ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_mutez (a' * b') - | ( C_MUL , [ V_Ct (C_mutez a') ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_mutez (a' * b') - | ( C_DIV , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' / b') - | ( C_DIV , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' / b') - | ( C_DIV , [ V_Ct (C_mutez a') ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_mutez (a' / b') - | ( C_DIV , [ V_Ct (C_mutez a') ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_nat (a' / b') + | ( C_CONS , [ v ; V_List vl ] ) -> ok @@ V_List (v::vl) + | ( C_ADD , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' + b') + | ( C_ADD , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' + b') + | ( C_ADD , [ V_Ct (C_nat a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' + b') + | ( C_ADD , [ V_Ct (C_int a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_int (a' + b') + | ( C_MUL , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' * b') + | ( C_MUL , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' * b') + | ( C_MUL , [ V_Ct (C_nat a' ) ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_mutez (a' * b') + | ( C_MUL , [ V_Ct (C_mutez a') ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_mutez (a' * b') + | ( C_DIV , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) -> return_ct @@ C_int (a' / b') + | ( C_DIV , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_nat (a' / b') + | ( C_DIV , [ V_Ct (C_mutez a') ; V_Ct (C_nat b' ) ] ) -> return_ct @@ C_mutez (a' / b') + | ( C_DIV , [ V_Ct (C_mutez a') ; V_Ct (C_mutez b') ] ) -> return_ct @@ C_nat (a' / b') + | ( C_MOD , [ V_Ct (C_int a') ; V_Ct (C_int b') ] ) -> return_ct @@ C_nat (a' mod b') + | ( C_MOD , [ V_Ct (C_nat a') ; V_Ct (C_nat b') ] ) -> return_ct @@ C_nat (a' mod b') + | ( C_MOD , [ V_Ct (C_nat a') ; V_Ct (C_int b') ] ) -> return_ct @@ C_nat (a' mod b') + | ( C_MOD , [ V_Ct (C_int a') ; V_Ct (C_nat b') ] ) -> return_ct @@ C_nat (a' mod b') | ( C_CONCAT , [ V_Ct (C_string a') ; V_Ct (C_string b') ] ) -> return_ct @@ C_string (a' ^ b') | ( C_CONCAT , [ V_Ct (C_bytes a' ) ; V_Ct (C_bytes b' ) ] ) -> return_ct @@ C_bytes (Bytes.cat a' b') | ( C_OR , [ V_Ct (C_bool a' ) ; V_Ct (C_bool b' ) ] ) -> return_ct @@ C_bool (a' || b') @@ -97,6 +158,15 @@ let rec apply_operator : Ast_typed.constant -> value list -> value result = eval body env') elts in ok @@ V_List elts' + | ( C_MAP_MAP , [ V_Func_val (arg_name, body, env) ; V_Map (elts) ] ) -> + let%bind elts' = bind_map_list + (fun (k,v) -> + let env' = Env.extend env (arg_name,v_pair (k,v)) in + let%bind v' = eval body env' in + ok @@ (k,v') + ) + elts in + ok @@ V_Map elts' | ( C_LIST_ITER , [ V_Func_val (arg_name, body, env) ; V_List (elts) ] ) -> bind_fold_list (fun _ elt -> @@ -104,98 +174,129 @@ let rec apply_operator : Ast_typed.constant -> value list -> value result = eval body env' ) (V_Ct C_unit) elts + | ( C_MAP_ITER , [ V_Func_val (arg_name, body, env) ; V_Map (elts) ] ) -> + bind_fold_list + (fun _ kv -> + let env' = Env.extend env (arg_name,v_pair kv) in + eval body env' + ) + (V_Ct C_unit) elts + | ( C_FOLD_WHILE , [ V_Func_val (arg_name, body, env) ; init ] ) -> + let rec aux el = + let%bind (b,folded_val) = get_pair el in + let env' = Env.extend env (arg_name, folded_val) in + let%bind res = eval body env' in + let%bind continue = is_true b in + if continue then aux res else ok folded_val in + aux @@ v_pair (v_bool true,init) (* tertiary *) - | ( C_LIST_FOLD , [ V_Func_val (arg_name, body, env) ; V_List (elts) ; init ] ) -> + | ( C_SLICE , [ V_Ct (C_nat st) ; V_Ct (C_nat ed) ; V_Ct (C_string s) ] ) -> + generic_try (simple_error "bad slice") @@ (fun () -> + V_Ct (C_string (String.sub s st ed)) + ) + | ( C_LIST_FOLD , [ V_Func_val (arg_name, body, env) ; V_List elts ; init ] ) -> bind_fold_list (fun prev elt -> - let fold_args = V_Record (LMap.of_list [(Label "0",prev) ; (Label "1",elt)]) in + let fold_args = v_pair (prev,elt) in let env' = Env.extend env (arg_name, fold_args) in eval body env' ) init elts + | ( C_MAP_FOLD , [ V_Func_val (arg_name, body, env) ; V_Map kvs ; init ] ) -> + bind_fold_list + (fun prev kv -> + let fold_args = v_pair (prev, v_pair kv) in + let env' = Env.extend env (arg_name, fold_args) in + eval body env' + ) + init kvs + | ( C_MAP_MEM , [ k ; V_Map kvs ] ) -> ok @@ v_bool (List.mem_assoc k kvs) + | ( C_MAP_ADD , [ k ; v ; V_Map kvs as vmap] ) -> + if (List.mem_assoc k kvs) then ok vmap + else ok (V_Map ((k,v)::kvs)) + | ( C_MAP_REMOVE , [ k ; V_Map kvs] ) -> ok @@ V_Map (List.remove_assoc k kvs) + | ( C_MAP_UPDATE , [ k ; V_Construct (option,v) ; V_Map kvs] ) -> (match option with + | "Some" -> ok @@ V_Map ((k,v)::(List.remove_assoc k kvs)) + | "None" -> ok @@ V_Map (List.remove_assoc k kvs) + | _ -> simple_fail "update without an option" + ) + | ( C_SET_ADD , [ v ; V_Set l ] ) -> ok @@ V_Set (List.sort_uniq compare (v::l)) + | ( C_SET_FOLD , [ V_Func_val (arg_name, body, env) ; V_Set elts ; init ] ) -> + bind_fold_list + (fun prev elt -> + let fold_args = v_pair (prev,elt) in + let env' = Env.extend env (arg_name, fold_args) in + eval body env' + ) + init elts + | ( C_SET_ITER , [ V_Func_val (arg_name, body, env) ; V_Set (elts) ] ) -> + bind_fold_list + (fun _ elt -> + let env' = Env.extend env (arg_name,elt) in + eval body env' + ) + (V_Ct C_unit) elts + | ( C_SET_MEM , [ v ; V_Set (elts) ] ) -> ok @@ v_bool (List.mem v elts) + | ( C_SET_REMOVE , [ v ; V_Set (elts) ] ) -> ok @@ V_Set (List.filter (fun el -> not (el = v)) elts) | _ -> let () = Format.printf "%a\n" Stage_common.PP.constant c in let () = List.iter ( fun e -> Format.printf "%s\n" (Ligo_interpreter.PP.pp_value e)) operands in simple_fail "Unsupported constant op" ) -(* -| C_NOW -| C_ASSERTION -| C_ASSERT_INFERRED -| C_UPDATE -| C_ITER -| C_FOLD_WHILE -| C_CONTINUE -| C_STOP -| C_FOLD -| C_SUB -| C_MOD -| C_SIZE -| C_SLICE -| C_BYTES_PACK -| C_BYTES_UNPACK -| C_PAIR -X| C_CAR -X| C_CDR -X| C_LEFT -X| C_RIGHT -| C_SET_EMPTY -| C_SET_LITERAL -| C_SET_ADD -| C_SET_REMOVE -| C_SET_ITER -| C_SET_FOLD -| C_SET_MEM -| C_MAP -| C_MAP_EMPTY -| C_MAP_LITERAL -| C_MAP_GET -| C_MAP_GET_FORCE -| C_MAP_ADD -| C_MAP_REMOVE -| C_MAP_UPDATE -| C_MAP_ITER -| C_MAP_MAP -| C_MAP_FOLD -| C_MAP_MEM -| C_MAP_FIND -| C_MAP_FIND_OPT -| C_BIG_MAP -| C_BIG_MAP_EMPTY -| C_BIG_MAP_LITERAL -x| C_LIST_CONS -> To remove ? seems unused -| C_SHA256 -| C_SHA512 -| C_BLAKE2b -| C_HASH -| C_HASH_KEY -| C_CHECK_SIGNATURE -| C_CHAIN_ID -| C_CALL -| C_CONTRACT -| C_CONTRACT_ENTRYPOINT -| C_AMOUNT -| C_BALANCE -| C_SOURCE -| C_SENDER -| C_ADDRESS -| C_SELF_ADDRESS -| C_IMPLICIT_ACCOUNT -| C_SET_DELEGATE -| C_STEPS_TO_QUOTA +(* TODO + +hash on bytes +C_BLAKE2b +C_SHA256 +C_SHA512 +hash on key +C_HASH_KEY + +need exts +C_AMOUNT +C_BALANCE +C_CHAIN_ID +C_CONTRACT_ENTRYPOINT_OPT +C_CONTRACT_OPT +C_CONTRACT +C_CONTRACT_ENTRYPOINT +C_SELF_ADDRESS +C_SOURCE +C_SENDER +C_NOW +C_IMPLICIT_ACCOUNT + +C_CALL +C_SET_DELEGATE + +C_BYTES_PACK +C_BYTES_UNPACK +C_CHECK_SIGNATURE +C_ADDRESS + + +WONT DO: +C_STEPS_TO_QUOTA + *) (*interpreter*) and eval_literal : Ast_typed.literal -> value result = function - | Literal_unit -> ok @@ V_Ct (C_unit) - | Literal_int i -> ok @@ V_Ct (C_int i) - | Literal_nat n -> ok @@ V_Ct (C_nat n) - | Literal_string s -> ok @@ V_Ct (C_string s) - | Literal_bytes s -> ok @@ V_Ct (C_bytes s) - | Literal_bool b -> ok @@ V_Ct (C_bool b) - | Literal_mutez t -> ok @@ V_Ct (C_mutez t) - | _ -> simple_fail "Unsupported literal" + | Literal_unit -> ok @@ V_Ct (C_unit) + | Literal_bool b -> ok @@ V_Ct (C_bool b) + | Literal_int i -> ok @@ V_Ct (C_int i) + | Literal_nat n -> ok @@ V_Ct (C_nat n) + | Literal_timestamp i -> ok @@ V_Ct (C_timestamp i) + | Literal_string s -> ok @@ V_Ct (C_string s) + | Literal_bytes s -> ok @@ V_Ct (C_bytes s) + | Literal_mutez t -> ok @@ V_Ct (C_mutez t) + | Literal_address s -> ok @@ V_Ct (C_address s) + | Literal_signature s -> ok @@ V_Ct (C_signature s) + | Literal_key s -> ok @@ V_Ct (C_key s) + | Literal_key_hash s -> ok @@ V_Ct (C_key_hash s) + | Literal_chain_id s -> ok @@ V_Ct (C_key_hash s) + | Literal_operation o -> ok @@ V_Ct (C_operation o) and eval : Ast_typed.expression -> env -> value result = fun term env -> @@ -226,6 +327,12 @@ and eval : Ast_typed.expression -> env -> value result (fun (exp:Ast_typed.annotated_expression) -> eval exp.expression env) expl in ok @@ V_List expl' + | E_set expl -> + let%bind expl' = bind_map_list + (fun (exp:Ast_typed.annotated_expression) -> eval exp.expression env) + (List.sort_uniq compare expl) + in + ok @@ V_Set expl' | E_literal l -> eval_literal l | E_variable var -> @@ -320,7 +427,7 @@ and eval : Ast_typed.expression -> env -> value result (********************************************** This is not necessary after Ast simplification ***********************************************) - | E_look_up _ | E_loop _ | E_set _ | E_sequence _ | E_assign _-> + | E_look_up _ | E_loop _ | E_sequence _ | E_assign _-> let serr = Format.asprintf "Unsupported construct :\n %a\n" Ast_typed.PP.expression term in simple_fail serr @@ -333,7 +440,7 @@ let dummy : Ast_typed.program -> string result = (*TODO This TRY-CATCH is here until we properly implement effects*) try eval named_exp.annotated_expression.expression top_env - with Temprorary_hack s -> ok @@ V_Failure s + with Temporary_hack s -> ok @@ V_Failure s (*TODO This TRY-CATCH is here until we properly implement effects*) in let pp' = pp^"\n val "^(Var.to_name named_exp.name)^" = "^(Ligo_interpreter.PP.pp_value v) in diff --git a/src/stages/ligo_interpreter/PP.ml b/src/stages/ligo_interpreter/PP.ml index 8a1cb8bd2..b47b4993a 100644 --- a/src/stages/ligo_interpreter/PP.ml +++ b/src/stages/ligo_interpreter/PP.ml @@ -9,6 +9,7 @@ let rec pp_value : value -> string = function | V_Ct (C_bool false) -> Format.asprintf "false" | V_Ct (C_bytes b) -> Format.asprintf "0x%a : bytes" Hex.pp (Hex.of_bytes b) | V_Ct (C_mutez i) -> Format.asprintf "%i : mutez" i + | V_Ct (C_address s) -> Format.asprintf "\"%s\" : address" s | V_Ct _ -> Format.asprintf "PP, TODO" | V_Failure s -> Format.asprintf "\"%s\" : failure " s | V_Record recmap -> @@ -20,13 +21,13 @@ let rec pp_value : value -> string = function | V_Func_val _ -> Format.asprintf "" | V_Construct (name,v) -> Format.asprintf "%s(%s)" name (pp_value v) | V_List vl -> - Format.asprintf "[ %s ]" @@ + Format.asprintf "[%s]" @@ List.fold_left (fun prev v -> Format.asprintf "%s ; %s" prev (pp_value v)) "" vl | V_Map vmap -> - Format.asprintf "[ %s ]" @@ + Format.asprintf "[%s]" @@ List.fold_left (fun prev (k,v) -> Format.asprintf "%s ; %s -> %s" prev (pp_value k) (pp_value v)) "" vmap | V_Set slist -> - Format.asprintf "{ %s }" @@ + Format.asprintf "{%s}" @@ List.fold_left (fun prev v -> Format.asprintf "%s ; %s" prev (pp_value v)) "" slist let pp_env : env -> unit = fun env -> diff --git a/src/stages/ligo_interpreter/types.ml b/src/stages/ligo_interpreter/types.ml index b39ac7605..4cd8e79ad 100644 --- a/src/stages/ligo_interpreter/types.ml +++ b/src/stages/ligo_interpreter/types.ml @@ -9,7 +9,7 @@ module Env = Map.Make( ) (*TODO temporary hack to handle failwiths *) -exception Temprorary_hack of string +exception Temporary_hack of string type env = value Env.t diff --git a/src/test/contracts/interpret_test.mligo b/src/test/contracts/interpret_test.mligo index c47ef6150..62992abd5 100644 --- a/src/test/contracts/interpret_test.mligo +++ b/src/test/contracts/interpret_test.mligo @@ -147,4 +147,85 @@ let comparison_string = ("foo" = "bar", "baz" = "baz") let divs : (int * nat * tez * nat) = - (1/2 , 1n/2n , 1tz/2n , 1tz/2tz) \ No newline at end of file + (1/2 , 1n/2n , 1tz/2n , 1tz/2tz) + +let var_neg = + let a = 2 in + -a + +let sizes = + let a = [ 1 ; 2 ; 3 ; 4 ; 5 ] in + let b = "12345" in + let c = Set.literal [ 1 ; 2 ; 3 ; 4 ; 5 ] in + let d = Map.literal [ (1,1) ; (2,2) ; (3,3) ] in + let e = 0xFFFF in + (List.size a, String.size b, Set.size c, Map.size d, Bytes.size e) + +let modi = 3 mod 2 + +let fold_while = + let aux : int -> bool * int = fun (i:int) -> + if i < 10 then continue (i + 1) else stop i in + (Loop.fold_while aux 20, Loop.fold_while aux 0) + +let assertion_pass = + assert (1=1) + +let assertion_fail = + assert (1=2) + +let lit_address = ("KT1ThEdxfUcWUwqsdergy3QnbCWGHSUHeHJq" : address) + +let map_finds = + let m = Map.literal [ ("one" , 1) ; ("two" , 2) ; ("three" , 3) ] in + Map.find_opt "two" m + +let map_finds_fail = + let m = Map.literal [ ("one" , 1) ; ("two" , 2) ; ("three" , 3) ] in + Map.find "four" m + +let map_empty = + ((Map.empty : (int,int) map) , (Map.literal [] : (int,int) map)) + +let m = Map.literal [ ("one" , 1) ; ("two" , 2) ; ("three" , 3) ] + +let map_fold = + let aux = fun (i: int * (string * int)) -> i.0 + i.1.1 in + Map.fold aux m (-2) + +let map_iter = + let aux = fun (i: string * int) -> if (i.1=12) then failwith "never" else () in + Map.iter aux m + +let map_map = + let aux = fun (i: string * int) -> i.1 + (String.size i.0) in + Map.map aux m + +let map_mem = (Map.mem "one" m , Map.mem "four" m) + +let map_remove = (Map.remove "one" m, Map.remove "four" m) + +let map_update = ( + Map.update "one" (Some(1)) (Map.literal [ "one", 2 ]), + Map.update "one" (None : int option) (Map.literal [ "one", 1]), + Map.update "one" (None : int option) (Map.literal []:(string,int) map), + Map.update "one" (Some(1)) (Map.literal []:(string,int) map) +) + +let s = Set.literal [ 1 ; 2 ; 3 ] + +let set_add = ( + Set.add 1 s, + Set.add 4 s, + Set.add 1 (Set.literal [] : int set) +) + +let set_iter_fail = + let aux = fun (i:int) -> if i = 1 then failwith "set_iter_fail" else () in + Set.iter aux (Set.literal [1 ; 2 ; 3]) + +let set_mem = ( + Set.mem 1 s, + Set.mem 4 s, + Set.mem 1 (Set.literal [] : int set) +) From 0374c5900b09215f2f26b614f3c7239d384c2743 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Fri, 7 Feb 2020 12:06:10 +0100 Subject: [PATCH 045/119] add missing 'Set.iter' to cameligo --- src/passes/operators/operators.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 7c3bd7318..ed77a7f64 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -181,6 +181,7 @@ module Simplify = struct | "Bytes.sub" -> ok C_SLICE | "Set.mem" -> ok C_SET_MEM + | "Set.iter" -> ok C_SET_ITER | "Set.empty" -> ok C_SET_EMPTY | "Set.literal" -> ok C_SET_LITERAL | "Set.add" -> ok C_SET_ADD From 69ddce18608e9060b5bb13d7e04e36fce928035d Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Fri, 7 Feb 2020 13:07:57 +0100 Subject: [PATCH 046/119] add temporary CLI comand for ligo interpreter tests --- src/bin/cli.ml | 14 +++++ src/bin/expect_tests/help_tests.ml | 6 +++ .../expect_tests/ligo_interpreter_tests.ml | 54 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 src/bin/expect_tests/ligo_interpreter_tests.ml diff --git a/src/bin/cli.ml b/src/bin/cli.ml index 21f888c07..92716d380 100644 --- a/src/bin/cli.ml +++ b/src/bin/cli.ml @@ -268,6 +268,19 @@ let interpret = let doc = "Subcommand: Interpret the expression in the context initialized by the provided source file." in (Term.ret term , Term.info ~doc cmdname) +let temp_ligo_interpreter = + let f source_file syntax display_format = + toplevel ~display_format @@ + let%bind simplified = Compile.Of_source.compile source_file (Syntax_name syntax) in + let%bind typed,_ = Compile.Of_simplified.compile simplified in + let%bind res = Compile.Of_typed.some_interpret typed in + ok @@ Format.asprintf "%s\n" res + in + let term = + Term.(const f $ source_file 0 $ syntax $ display_format ) in + let cmdname = "ligo-interpret" in + let doc = "Subcommand: (temporary / dev only) uses LIGO interpret." in + (Term.ret term , Term.info ~doc cmdname) let compile_storage = let f source_file entry_point expression syntax amount sender source predecessor_timestamp display_format michelson_format = @@ -426,6 +439,7 @@ let list_declarations = let run ?argv () = Term.eval_choice ?argv main [ + temp_ligo_interpreter ; compile_file ; measure_contract ; compile_parameter ; diff --git a/src/bin/expect_tests/help_tests.ml b/src/bin/expect_tests/help_tests.ml index 06e877a32..bd5824881 100644 --- a/src/bin/expect_tests/help_tests.ml +++ b/src/bin/expect_tests/help_tests.ml @@ -44,6 +44,9 @@ let%expect_test _ = Subcommand: Interpret the expression in the context initialized by the provided source file. + ligo-interpret + Subcommand: (temporary / dev only) uses LIGO interpret. + list-declarations Subcommand: List all the top-level declarations. @@ -120,6 +123,9 @@ let%expect_test _ = Subcommand: Interpret the expression in the context initialized by the provided source file. + ligo-interpret + Subcommand: (temporary / dev only) uses LIGO interpret. + list-declarations Subcommand: List all the top-level declarations. diff --git a/src/bin/expect_tests/ligo_interpreter_tests.ml b/src/bin/expect_tests/ligo_interpreter_tests.ml new file mode 100644 index 000000000..3caedc2ae --- /dev/null +++ b/src/bin/expect_tests/ligo_interpreter_tests.ml @@ -0,0 +1,54 @@ +open Cli_expect + +let contract basename = + "../../test/contracts/" ^ basename + +let%expect_test _ = + run_ligo_good [ "ligo-interpret" ; contract "interpret_test.mligo" ] ; + [%expect {| + val lambda_call = 16 : int + val higher_order1 = 5 : int + val higher_order2 = 5 : int + val concats = 0x7070 : bytes + val record_concat = "ab" : string + val record_patch = { ; a = ("a" : string) ; b = ("c" : string) } + val record_lambda = 5 : int + val variant_exp = { ; 0 = (Foo(unit)) ; 1 = (Bar(1 : int)) ; 2 = (Baz("b" : string)) } + val variant_match = 2 : int + val bool_match = 1 : int + val list_match = [ ; 1 : int ; 1 : int ; 2 : int ; 3 : int ; 4 : int] + val tuple_proj = true + val list_const = [ ; 0 : int ; 1 : int ; 2 : int ; 3 : int ; 4 : int] + val options_match_some = 0 : int + val options_match_none = 0 : int + val is_nat_nat = { ; 0 = (Some(1 : nat)) ; 1 = (None(unit)) } + val abs_int = 5 : int + val nat_int = 5 : int + val map_list = [ ; 2 : int ; 3 : int ; 4 : int ; 5 : int] + val fail_alone = "you failed" : failure + val iter_list_fail = "you failed" : failure + val fold_list = 10 : int + val comparison_int = { ; 0 = (false) ; 1 = (true) ; 2 = (false) ; 3 = (true) } + val comparison_string = { ; 0 = (false) ; 1 = (true) } + val divs = { ; 0 = (0 : int) ; 1 = (0 : nat) ; 2 = (500000 : mutez) ; 3 = (0 : nat) } + val var_neg = -2 : int + val sizes = { ; 0 = (5 : nat) ; 1 = (5 : nat) ; 2 = (5 : nat) ; 3 = (3 : nat) ; 4 = (2 : nat) } + val modi = 1 : nat + val fold_while = { ; 0 = (20 : int) ; 1 = (10 : int) } + val assertion_pass = unit + val assertion_fail = "failed assertion" : failure + val lit_address = "KT1ThEdxfUcWUwqsdergy3QnbCWGHSUHeHJq" : address + val map_finds = Some(2 : int) + val map_finds_fail = "failed map find" : failure + val map_empty = { ; 0 = ([]) ; 1 = ([]) } + val m = [ ; "one" : string -> 1 : int ; "two" : string -> 2 : int ; "three" : string -> 3 : int] + val map_fold = 4 : int + val map_iter = unit + val map_map = [ ; "one" : string -> 4 : int ; "two" : string -> 5 : int ; "three" : string -> 8 : int] + val map_mem = { ; 0 = (true) ; 1 = (false) } + val map_remove = { ; 0 = ([ ; "two" : string -> 2 : int ; "three" : string -> 3 : int]) ; 1 = ([ ; "one" : string -> 1 : int ; "two" : string -> 2 : int ; "three" : string -> 3 : int]) } + val map_update = { ; 0 = ([ ; "one" : string -> 1 : int]) ; 1 = ([]) ; 2 = ([]) ; 3 = ([ ; "one" : string -> 1 : int]) } + val s = { ; 1 : int ; 2 : int ; 3 : int} + val set_add = { ; 0 = ({ ; 1 : int ; 2 : int ; 3 : int}) ; 1 = ({ ; 1 : int ; 2 : int ; 3 : int ; 4 : int}) ; 2 = ({ ; 1 : int}) } + val set_iter_fail = "set_iter_fail" : failure + val set_mem = { ; 0 = (true) ; 1 = (false) ; 2 = (false) } |}] ; \ No newline at end of file From ce70c82122f48d3881a45c6f4649765b3fdfa7af Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Fri, 7 Feb 2020 15:55:39 +0100 Subject: [PATCH 047/119] ligo interpreter : moving combinators do a dedicated module --- src/passes/6-interpreter/interpreter.ml | 36 ++----------------- src/stages/ligo_interpreter/combinators.ml | 34 ++++++++++++++++++ .../ligo_interpreter/ligo_interpreter.ml | 3 +- 3 files changed, 38 insertions(+), 35 deletions(-) create mode 100644 src/stages/ligo_interpreter/combinators.ml diff --git a/src/passes/6-interpreter/interpreter.ml b/src/passes/6-interpreter/interpreter.ml index 162f902ab..1cd8f65e1 100644 --- a/src/passes/6-interpreter/interpreter.ml +++ b/src/passes/6-interpreter/interpreter.ml @@ -1,42 +1,10 @@ open Trace open Ligo_interpreter.Types +open Ligo_interpreter.Combinators include Stage_common.Types module Env = Ligo_interpreter.Environment -(* combinators ? *) -let v_pair : value * value -> value = - fun (a,b) -> V_Record (LMap.of_list [(Label "0", a) ; (Label "1",b)]) - -let v_bool : bool -> value = - fun b -> V_Ct (C_bool b) - -let v_unit : unit -> value = - fun () -> V_Ct (C_unit) - -let v_some : value -> value = - fun v -> V_Construct ("Some", v) - -let v_none : unit -> value = - fun () -> V_Construct ("None", v_unit ()) - -let get_pair : value -> (value * value) result = - fun p -> - let err = simple_error "value is not a pair" in - ( match p with - | V_Record lmap -> - let%bind fst = trace_option err @@ - LMap.find_opt (Label "0") lmap in - let%bind snd = trace_option err @@ - LMap.find_opt (Label "1") lmap in - ok (fst,snd) - | _ -> fail err ) - -let is_true : value -> bool result = - fun b -> match b with - | V_Ct (C_bool b) -> ok b - | _ -> simple_fail "value is not a bool" - let apply_comparison : Ast_typed.constant -> value list -> value result = fun c operands -> match (c,operands) with @@ -183,7 +151,7 @@ let rec apply_operator : Ast_typed.constant -> value list -> value result = (V_Ct C_unit) elts | ( C_FOLD_WHILE , [ V_Func_val (arg_name, body, env) ; init ] ) -> let rec aux el = - let%bind (b,folded_val) = get_pair el in + let%bind (b,folded_val) = extract_pair el in let env' = Env.extend env (arg_name, folded_val) in let%bind res = eval body env' in let%bind continue = is_true b in diff --git a/src/stages/ligo_interpreter/combinators.ml b/src/stages/ligo_interpreter/combinators.ml new file mode 100644 index 000000000..d01ef460f --- /dev/null +++ b/src/stages/ligo_interpreter/combinators.ml @@ -0,0 +1,34 @@ +open Trace +open Types + +let v_pair : value * value -> value = + fun (a,b) -> V_Record (LMap.of_list [(Label "0", a) ; (Label "1",b)]) + +let v_bool : bool -> value = + fun b -> V_Ct (C_bool b) + +let v_unit : unit -> value = + fun () -> V_Ct (C_unit) + +let v_some : value -> value = + fun v -> V_Construct ("Some", v) + +let v_none : unit -> value = + fun () -> V_Construct ("None", v_unit ()) + +let extract_pair : value -> (value * value) result = + fun p -> + let err = simple_error "value is not a pair" in + ( match p with + | V_Record lmap -> + let%bind fst = trace_option err @@ + LMap.find_opt (Label "0") lmap in + let%bind snd = trace_option err @@ + LMap.find_opt (Label "1") lmap in + ok (fst,snd) + | _ -> fail err ) + +let is_true : value -> bool result = + fun b -> match b with + | V_Ct (C_bool b) -> ok b + | _ -> simple_fail "value is not a bool" diff --git a/src/stages/ligo_interpreter/ligo_interpreter.ml b/src/stages/ligo_interpreter/ligo_interpreter.ml index b0722ca9f..60ca6311e 100644 --- a/src/stages/ligo_interpreter/ligo_interpreter.ml +++ b/src/stages/ligo_interpreter/ligo_interpreter.ml @@ -1,3 +1,4 @@ module Types = Types module PP = PP -module Environment = Environment \ No newline at end of file +module Environment = Environment +module Combinators = Combinators \ No newline at end of file From 3ce0d180f5c30725afc1f39f41e0d67a86c687c3 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Sun, 9 Feb 2020 18:50:18 +0100 Subject: [PATCH 048/119] ligo interpreter: simplfied AST merge --- src/passes/6-interpreter/interpreter.ml | 110 ++++++++++-------------- 1 file changed, 44 insertions(+), 66 deletions(-) diff --git a/src/passes/6-interpreter/interpreter.ml b/src/passes/6-interpreter/interpreter.ml index 1cd8f65e1..a0954fcff 100644 --- a/src/passes/6-interpreter/interpreter.ml +++ b/src/passes/6-interpreter/interpreter.ml @@ -6,7 +6,7 @@ include Stage_common.Types module Env = Ligo_interpreter.Environment -let apply_comparison : Ast_typed.constant -> value list -> value result = +let apply_comparison : Ast_typed.constant' -> value list -> value result = fun c operands -> match (c,operands) with | ( comp , [ V_Ct (C_int a' ) ; V_Ct (C_int b' ) ] ) | ( comp , [ V_Ct (C_nat a' ) ; V_Ct (C_nat b' ) ] ) @@ -52,7 +52,7 @@ let apply_comparison : Ast_typed.constant -> value list -> value result = simple_fail "unsupported comparison" (* applying those operators does not involve extending the environment *) -let rec apply_operator : Ast_typed.constant -> value list -> value result = +let rec apply_operator : Ast_typed.constant' -> value list -> value result = fun c operands -> let return_ct v = ok @@ V_Ct v in let return_none () = ok @@ v_none () in @@ -265,39 +265,40 @@ and eval_literal : Ast_typed.literal -> value result = function | Literal_key_hash s -> ok @@ V_Ct (C_key_hash s) | Literal_chain_id s -> ok @@ V_Ct (C_key_hash s) | Literal_operation o -> ok @@ V_Ct (C_operation o) + | Literal_void -> simple_fail "iguess ?" and eval : Ast_typed.expression -> env -> value result = fun term env -> - match term with - | E_application ({expression = f; _}, args) -> ( - let%bind f' = match f with + match term.expression_content with + | E_application ({expr1 = f; expr2 = args}) -> ( + let%bind f' = match f.expression_content with | E_variable f -> Env.lookup env f | _ -> eval f env in match f' with | V_Func_val (arg_names, body, f_env) -> - let%bind args' = eval args.expression env in + let%bind args' = eval args env in let f_env' = Env.extend f_env (arg_names, args') in eval body f_env' | _ -> simple_fail "trying to apply on something that is not a function" ) - | E_lambda { binder; body;} -> - ok @@ V_Func_val (binder,body.expression,env) - | E_let_in { binder; rhs; result; _} -> - let%bind rhs' = eval rhs.expression env in - eval result.expression (Env.extend env (binder,rhs')) + | E_lambda { binder; result;} -> + ok @@ V_Func_val (binder,result,env) + | E_let_in { let_binder; rhs; let_result; _} -> + let%bind rhs' = eval rhs env in + eval let_result (Env.extend env (let_binder,rhs')) | E_map kvlist | E_big_map kvlist -> let%bind kvlist' = bind_map_list - (fun kv -> bind_map_pair (fun (el:Ast_typed.annotated_expression) -> eval el.expression env) kv) + (fun kv -> bind_map_pair (fun (el:Ast_typed.expression) -> eval el env) kv) kvlist in ok @@ V_Map kvlist' | E_list expl -> let%bind expl' = bind_map_list - (fun (exp:Ast_typed.annotated_expression) -> eval exp.expression env) + (fun (exp:Ast_typed.expression) -> eval exp env) expl in ok @@ V_List expl' | E_set expl -> let%bind expl' = bind_map_list - (fun (exp:Ast_typed.annotated_expression) -> eval exp.expression env) + (fun (exp:Ast_typed.expression) -> eval exp env) (List.sort_uniq compare expl) in ok @@ V_Set expl' @@ -307,13 +308,13 @@ and eval : Ast_typed.expression -> env -> value result Env.lookup env var | E_record recmap -> let%bind lv' = bind_map_list - (fun (label,(v:Ast_typed.annotated_expression)) -> - let%bind v' = eval v.expression env in + (fun (label,(v:Ast_typed.expression)) -> + let%bind v' = eval v env in ok (label,v')) (LMap.to_kv_list recmap) in ok @@ V_Record (LMap.of_list lv') - | E_record_accessor (record,label) -> ( - let%bind record' = eval record.expression env in + | E_record_accessor { expr ; label} -> ( + let%bind record' = eval expr env in match record' with | V_Record recmap -> let%bind a = trace_option (simple_error "unknown record field") @@ @@ -321,35 +322,35 @@ and eval : Ast_typed.expression -> env -> value result ok a | _ -> simple_fail "trying to access a non-record" ) - | E_record_update (record, (l,field)) -> ( - let%bind record' = eval record.expression env in + | E_record_update {record ; path ; update} -> ( + let%bind record' = eval record env in match record' with | V_Record recmap -> - if LMap.mem l recmap then - let%bind field' = eval field.expression env in - ok @@ V_Record (LMap.add l field' recmap) + if LMap.mem path recmap then + let%bind field' = eval update env in + ok @@ V_Record (LMap.add path field' recmap) else simple_fail "field l does not exist in record" | _ -> simple_fail "this expression isn't a record" ) - | E_constant (op, operands) -> ( + | E_constant {cons_name ; arguments} -> ( let%bind operands' = bind_map_list - (fun (ae:Ast_typed.annotated_expression) -> eval ae.expression env) - operands in - apply_operator op operands' + (fun (ae:Ast_typed.expression) -> eval ae env) + arguments in + apply_operator cons_name operands' ) - | E_constructor (Constructor c, v) -> - let%bind v' = eval v.expression env in + | E_constructor { constructor = Constructor c ; element } -> + let%bind v' = eval element env in ok @@ V_Construct (c,v') - | E_matching (e , cases) -> ( - let%bind e' = eval e.expression env in + | E_matching { matchee ; cases} -> ( + let%bind e' = eval matchee env in match cases, e' with | Match_list cases , V_List [] -> - eval cases.match_nil.expression env + eval cases.match_nil env | Match_list cases , V_List (head::tail) -> let (head_var,tail_var,body,_) = cases.match_cons in let env' = Env.extend (Env.extend env (head_var,head)) (tail_var, V_List tail) in - eval body.expression env' + eval body env' | Match_variant (case_list , _) , V_Construct (matched_c , proj) -> let ((_, var) , body) = List.find @@ -358,44 +359,21 @@ and eval : Ast_typed.expression -> env -> value result String.equal matched_c c) case_list in let env' = Env.extend env (var, proj) in - eval body.expression env' + eval body env' | Match_bool cases , V_Ct (C_bool true) -> - eval cases.match_true.expression env + eval cases.match_true env | Match_bool cases , V_Ct (C_bool false) -> - eval cases.match_false.expression env + eval cases.match_false env | Match_option cases, V_Construct ("Some" , proj) -> let (var,body,_) = cases.match_some in let env' = Env.extend env (var,proj) in - eval body.expression env' + eval body env' | Match_option cases, V_Construct ("None" , V_Ct C_unit) -> - eval cases.match_none.expression env + eval cases.match_none env | _ -> simple_fail "not yet supported case" (* ((ctor,name),body) *) ) - (********************************************** - This is not necessary after Ast simplification - ***********************************************) - | E_tuple el -> - let%bind lv = bind_mapi_list - (fun i (el:Ast_typed.annotated_expression) -> - let%bind el' = eval el.expression env in - ok (Label (string_of_int i), el')) - el in - ok @@ V_Record (LMap.of_list lv) - | E_tuple_accessor (tuple,i) -> ( - let%bind record' = eval tuple.expression env in - match record' with - | V_Record recmap -> - let label = Label (string_of_int i) in - let%bind a = trace_option (simple_error "out of tuple range") @@ - LMap.find_opt label recmap in - ok a - | _ -> simple_fail "trying to access a non-record" - ) - (********************************************** - This is not necessary after Ast simplification - ***********************************************) - | E_look_up _ | E_loop _ | E_sequence _ | E_assign _-> + | E_look_up _ | E_loop _ -> let serr = Format.asprintf "Unsupported construct :\n %a\n" Ast_typed.PP.expression term in simple_fail serr @@ -403,16 +381,16 @@ let dummy : Ast_typed.program -> string result = fun prg -> let%bind (res,_) = bind_fold_list (fun (pp,top_env) el -> - let (Ast_typed.Declaration_constant (named_exp, _, _)) = Location.unwrap el in + let (Ast_typed.Declaration_constant (exp_name, exp , _ , _)) = Location.unwrap el in let%bind v = (*TODO This TRY-CATCH is here until we properly implement effects*) try - eval named_exp.annotated_expression.expression top_env + eval exp top_env with Temporary_hack s -> ok @@ V_Failure s (*TODO This TRY-CATCH is here until we properly implement effects*) in - let pp' = pp^"\n val "^(Var.to_name named_exp.name)^" = "^(Ligo_interpreter.PP.pp_value v) in - let top_env' = Env.extend top_env (named_exp.name, v) in + let pp' = pp^"\n val "^(Var.to_name exp_name)^" = "^(Ligo_interpreter.PP.pp_value v) in + let top_env' = Env.extend top_env (exp_name, v) in ok @@ (pp',top_env') ) ("",Env.empty_env) prg in From 0e5a68d58b048ecdad515f07816fb3b35ed01a22 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Sun, 9 Feb 2020 19:04:21 +0100 Subject: [PATCH 049/119] ligo interpreter : review fixes --- src/passes/6-interpreter/interpreter.ml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/passes/6-interpreter/interpreter.ml b/src/passes/6-interpreter/interpreter.ml index a0954fcff..5b44d5b11 100644 --- a/src/passes/6-interpreter/interpreter.ml +++ b/src/passes/6-interpreter/interpreter.ml @@ -271,9 +271,7 @@ and eval : Ast_typed.expression -> env -> value result = fun term env -> match term.expression_content with | E_application ({expr1 = f; expr2 = args}) -> ( - let%bind f' = match f.expression_content with - | E_variable f -> Env.lookup env f - | _ -> eval f env in + let%bind f' = eval f env in match f' with | V_Func_val (arg_names, body, f_env) -> let%bind args' = eval args env in From 8c3835229043b5df70cbcdd4551afa11f4bb6274 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Mon, 10 Feb 2020 12:02:36 +0100 Subject: [PATCH 050/119] ligo interpreter : adding more tests --- .../expect_tests/ligo_interpreter_tests.ml | 2 ++ src/test/contracts/interpret_test.mligo | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/bin/expect_tests/ligo_interpreter_tests.ml b/src/bin/expect_tests/ligo_interpreter_tests.ml index 3caedc2ae..ac381ea71 100644 --- a/src/bin/expect_tests/ligo_interpreter_tests.ml +++ b/src/bin/expect_tests/ligo_interpreter_tests.ml @@ -9,6 +9,8 @@ let%expect_test _ = val lambda_call = 16 : int val higher_order1 = 5 : int val higher_order2 = 5 : int + val higher_order3 = 5 : int + val higher_order4 = 5 : int val concats = 0x7070 : bytes val record_concat = "ab" : string val record_patch = { ; a = ("a" : string) ; b = ("c" : string) } diff --git a/src/test/contracts/interpret_test.mligo b/src/test/contracts/interpret_test.mligo index 62992abd5..90fe2bcbf 100644 --- a/src/test/contracts/interpret_test.mligo +++ b/src/test/contracts/interpret_test.mligo @@ -1,28 +1,35 @@ let lambda_call = let a = 3 in - let foo: (int -> int) = - fun (i : int) -> i * i - in + let foo = fun (i : int) -> i * i in foo (a + 1) let higher_order1 = let a = 2 in - let foo: (int -> int -> int -> int) = - fun (i:int) (j:int) (k:int) -> a + i + j + 0 - in + let foo = fun (i:int) (j:int) (k:int) -> + a + i + j + 0 in let bar = (foo 1 2) in bar 3 let higher_order2 = let a = 2 in - let foo: (int -> int) = - fun (i:int) -> + let foo = fun (i:int) -> let b = 2 in - let bar : (int -> int) = - fun (i:int) -> i + a + b + let bar = fun (i:int) -> i + a + b in bar i in foo 1 +let higher_order3 = + let foo = fun (i:int) -> i + 1 in + let bar = fun (f:int->int) (i:int) -> (f i) + 1 in + let baz : (int -> int ) = bar foo in + baz 3 + +let higher_order4 = + let a = 3 in + let foo = fun (i : int) -> a + i in + let bar: (int -> int) = fun (i : int) -> foo i in + bar 2 + let concats = 0x70 ^ 0x70 From 82aacde97fcffc8ea57157b96142ecfe388497e1 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Mon, 10 Feb 2020 19:07:20 +0100 Subject: [PATCH 051/119] More documentation rewrites. --- .../docs/advanced/entrypoints-contracts.md | 61 +- gitlab-pages/docs/advanced/first-contract.md | 48 +- .../docs/advanced/timestamps-addresses.md | 14 +- .../intro/src/what-and-why/ligo-counter.ligo | 35 +- .../intro/src/what-and-why/ligo-counter.mligo | 23 + .../src/what-and-why/ligo-counter.religo | 26 + gitlab-pages/docs/intro/what-and-why.md | 252 ++++++--- .../docs/language-basics/boolean-if-else.md | 17 +- .../docs/language-basics/functions.md | 93 ++-- gitlab-pages/docs/language-basics/loops.md | 76 +-- .../docs/language-basics/maps-records.md | 289 +++++++--- .../docs/language-basics/math-numbers-tez.md | 22 +- .../docs/language-basics/sets-lists-tuples.md | 526 +++++++++++++----- gitlab-pages/docs/language-basics/strings.md | 24 +- .../docs/language-basics/tezos-specific.md | 19 +- gitlab-pages/docs/language-basics/types.md | 114 +++- .../unit-option-pattern-matching.md | 26 +- .../variables-and-constants.md | 27 +- gitlab-pages/website/core/CodeExamples.js | 93 ++-- gitlab-pages/website/pages/en/index.js | 8 +- gitlab-pages/website/siteConfig.js | 13 +- .../version-next/contributors/origin.md | 4 +- .../version-next/contributors/philosophy.md | 11 +- .../version-next-sidebars.json | 22 +- src/passes/operators/operators.ml | 5 +- 25 files changed, 1238 insertions(+), 610 deletions(-) create mode 100644 gitlab-pages/docs/intro/src/what-and-why/ligo-counter.mligo create mode 100644 gitlab-pages/docs/intro/src/what-and-why/ligo-counter.religo diff --git a/gitlab-pages/docs/advanced/entrypoints-contracts.md b/gitlab-pages/docs/advanced/entrypoints-contracts.md index 29160031c..07bb7ee0c 100644 --- a/gitlab-pages/docs/advanced/entrypoints-contracts.md +++ b/gitlab-pages/docs/advanced/entrypoints-contracts.md @@ -1,20 +1,20 @@ --- id: entrypoints-contracts -title: Entrypoints to Contracts +title: Access function and Entrypoints --- -## Entrypoints +## Access Functions A LIGO contract is made of a series of constant and function declarations. Only functions having a special type can be called when -the contract is activated: they are called *entrypoints*. An -entrypoint need to take two parameters, the *contract parameter* and -the *on-chain storage*, and return a pair made of a *list of -operations* and a (new) storage. +the contract is activated: we called them *access functions*. An +access function takes two parameters, the *contract parameter* and the +*on-chain storage*, and returns a pair made of a *list of operations* +and a (new) storage. When the contract is originated, the initial value of the storage is -provided. When and entrypoint is later called, only the parameter is -provided, but the type of an entrypoint contains both. +provided. When an access function is later called, only the parameter +is provided, but the type of an access function contains both. The type of the contract parameter and the storage are up to the contract designer, but the type for list operations is not. The return @@ -23,7 +23,7 @@ has been defined elsewhere. (Note that you can use any type with any name for the storage.) - + ```pascaligo skip type storage is ... // Any name, any type type return is list (operation) * storage @@ -42,9 +42,9 @@ type return = (list (operation), storage); ``` -The contract storage can only be modified by activating an -entrypoint. It is important to understand what that means. What it -does *not* mean is that some global variable holding the storage is +The contract storage can only be modified by activating an access +function. It is important to understand what that means. What it does +*not* mean is that some global variable holding the storage is modified by the entrypoint. Instead, what it *does* mean is that, given the state of the storage *on-chain*, an entrypoint specifies how to create another state for it, depending on a parameter. @@ -54,7 +54,7 @@ is updated by the parameter. - + ```pascaligo group=a type storage is nat @@ -82,20 +82,29 @@ let main = ((parameter, store): (nat, storage)) : return => { ``` -In LIGO, the design pattern for entrypoints consists in actually -having exactly *one entrypoint*, like the `main` function in C. The -parameter of the contract is then a variant type, and, depending on -the constructors of that type, different functions in the contract are -called. In other terms, the unique entrypoint dispatches the control -flow depending on a *pattern matching* on the contract parameter. +## Entrypoints -In the following example, the storage contains a counter (of type -`nat`) and a name (of type `string`). Depending on the parameter of -the contract, either the counter or the name is updated. +In LIGO, the design pattern is to have *one* access function that +dispatches the control flow according to its parameter. Those +functions called for those actions are called *entrypoints*. + +As an analogy, in the C programming language, the `main` function is +the unique access function and any function called from it would be an +entrypoint. + +The parameter of the contract is then a variant type, and, depending +on the constructors of that type, different functions in the contract +are called. In other terms, the unique access function dispatches the +control flow depending on a *pattern matching* on the contract +parameter. + +In the following example, the storage contains a counter of type `nat` +and a name of type `string`. Depending on the parameter of the +contract, either the counter or the name is updated. - + ```pascaligo group=b type parameter is Entrypoint_A of nat @@ -188,7 +197,7 @@ any transaction that sends more tez than `0mutez`, that is, no incoming tokens are accepted. - + ```pascaligo group=c type parameter is unit type storage is unit @@ -232,7 +241,7 @@ let deny = ((param, store): (parameter, storage)) : return => { This example shows how `sender` or `source` can be used to deny access to an entrypoint. - + ```pascaligo group=c const owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); @@ -287,7 +296,7 @@ counter contract. - + ```pascaligo skip // counter.ligo type parameter is diff --git a/gitlab-pages/docs/advanced/first-contract.md b/gitlab-pages/docs/advanced/first-contract.md index 19861291f..1e9c5f120 100644 --- a/gitlab-pages/docs/advanced/first-contract.md +++ b/gitlab-pages/docs/advanced/first-contract.md @@ -3,20 +3,24 @@ id: first-contract title: First contract --- -So far so good, we've learned enough of the LIGO language, we're confident enough to write out first smart contract. +So far so good, we have learned enough of the LIGO language, we are +confident enough to write out first smart contract. -We'll be implementing a counter contract, let's go. +We will be implementing a counter contract. -## Dry-running a contract +## Dry-running a Contract -Testing a contract can be quite easy if we utilize LIGO's built-in dry run feature. Dry-run works by simulating the entrypoint execution, as if it were deployed on a real chain. You need to provide the following: +Testing a contract can be quite easy if we utilize LIGO's built-in dry +run feature. Dry-run works by simulating the access function +execution, as if it were deployed on a real chain. You need to provide +the following: - `file` - contract to run - `entrypoint` - name of the function to execute -- `parameter` - parameter passed to the entrypoint (in a theoretical invocation operation) +- `parameter` - parameter passed to the access function (in a theoretical invocation operation) - `storage` - a mock storage value, as if it were stored on a real chain -Here's a full example: +Here is a full example: @@ -29,25 +33,29 @@ ligo dry-run src/basic.ligo main Unit Unit ``` -Output of the `dry-run` is the return value of our entrypoint function, we can see the operations emited - in our case an empty list, and the new storage value being returned - which in our case is still `Unit`. +Output of the `dry-run` is the return value of our access function, we +can see the operations emited - in our case an empty list, and the new +storage value being returned - which in our case is still `Unit`. -## Building a counter contract +## A Counter Contract -Our counter contract will store a single `int` as it's storage, and will accept an `action` variant in order to re-route our single `main` entrypoint into two entrypoints for `addition` and `subtraction`. +Our counter contract will store a single `int` as it's storage, and +will accept an `action` variant in order to re-route our single `main` +access function to two entrypoints for `addition` and `subtraction`. ``` type action is -| Increment of int + Increment of int | Decrement of int function main (const p : action ; const s : int) : (list(operation) * int) is - block {skip} with ((nil : list(operation)), - case p of + ((nil : list(operation)), + (case p of | Increment (n) -> s + n | Decrement (n) -> s - n - end) + end)) ``` @@ -98,11 +106,13 @@ ligo dry-run src/counter.ligo main "Increment(5)" 5 -Yay, our contract's storage has been successfuly incremented to `10`. +Our contract's storage has been successfuly incremented to `10`. ## Deploying and interacting with a contract on a live-chain -In order to deploy the counter contract to a real Tezos network, we'd have to compile it first, this can be done with the help of the `compile-contract` CLI command: +In order to deploy the counter contract to a real Tezos network, we'd +have to compile it first, this can be done with the help of the +`compile-contract` CLI command: @@ -156,7 +166,10 @@ Command above will output the following Michelson code: ``` -However in order to originate a Michelson contract on Tezos, we also need to provide the initial storage value, we can use `compile-storage` to compile the LIGO representation of the storage to Michelson. +However in order to originate a Michelson contract on Tezos, we also +need to provide the initial storage value, we can use +`compile-storage` to compile the LIGO representation of the storage to +Michelson. @@ -182,4 +195,5 @@ ligo compile-parameter src/counter.ligo main 'Increment(5)' -Now we can use `(Right 5)` which is a Michelson value, to invoke our contract - e.g. via `tezos-client` +Now we can use `(Right 5)` which is a Michelson value, to invoke our +contract - e.g. via `tezos-client` diff --git a/gitlab-pages/docs/advanced/timestamps-addresses.md b/gitlab-pages/docs/advanced/timestamps-addresses.md index 8c20da011..5174e1cc8 100644 --- a/gitlab-pages/docs/advanced/timestamps-addresses.md +++ b/gitlab-pages/docs/advanced/timestamps-addresses.md @@ -16,7 +16,7 @@ expression, please be aware that it is up to the baker to set the current timestamp value. - + ```pascaligo group=a const today : timestamp = now ``` @@ -44,7 +44,7 @@ constraints on your smart contracts. Consider the following scenarios. #### In 24 hours - + ```pascaligo group=b const today : timestamp = now const one_day : int = 86400 @@ -76,7 +76,7 @@ let one_day_later : timestamp = some_date + one_day; #### 24 hours Ago - + ```pascaligo group=c const today : timestamp = now const one_day : int = 86400 @@ -105,7 +105,7 @@ You can compare timestamps using the same comparison operators applying to numbers. - + ```pascaligo group=c const not_tommorow : bool = (now = in_24_hrs) ``` @@ -130,7 +130,7 @@ type `address`. Beware of failures if the address is invalid. Consider the following examples. - + ```pascaligo group=d const my_account : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) @@ -159,7 +159,7 @@ failure if the signature is invalid. Here is how you can define a signature: - + ```pascaligo group=e const my_sig : signature = ("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7" : @@ -188,7 +188,7 @@ failure if the key is invalid. Here is how you can define a key. - + ```pascaligo group=f const my_key : key = ("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav" : key) diff --git a/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.ligo b/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.ligo index 989afba07..4fd886fb7 100644 --- a/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.ligo +++ b/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.ligo @@ -1,12 +1,25 @@ -type action is -| Increment of int -| Decrement of int -| Reset of unit +type storage is int -function main (const p : action ; const s : int) : (list(operation) * int) is - block { skip } with ((nil : list(operation)), - case p of - | Increment(n) -> s + n - | Decrement(n) -> s - n - | Reset(n) -> 0 - end) \ No newline at end of file +type parameter is + Increment of int +| Decrement of int +| Reset + +type return is list (operation) * storage + +(* Two entrypoints *) + +function add (const store : storage; const delta : int) : storage is store + delta + +function sub (const store : storage; const delta : int) : storage is store - delta + +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) + +function main (const action : parameter; const store : storage) : return is + ((nil : list (operation)), // No operations + case action of + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0 + end) diff --git a/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.mligo b/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.mligo new file mode 100644 index 000000000..3cfa8551f --- /dev/null +++ b/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.mligo @@ -0,0 +1,23 @@ +type storage = int + +type parameter = + Increment of int +| Decrement of int +| Reset + +type return = operation list * storage + +(* Two entrypoints *) + +let add (store, delta : storage * int) : storage = store + delta +let sub (store, delta : storage * int) : storage = store - delta + +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) + +let main (action, store : parameter * storage) : return = + ([] : operation list), // No operations + (match action with + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0) diff --git a/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.religo b/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.religo new file mode 100644 index 000000000..74292563c --- /dev/null +++ b/gitlab-pages/docs/intro/src/what-and-why/ligo-counter.religo @@ -0,0 +1,26 @@ +type storage = int; + +type parameter = + Increment (int) +| Decrement (int) +| Reset; + +type return = (list (operation), storage); + +(* Two entrypoints *) + +let add = ((store, delta) : (storage, int)) : storage => store + delta; + +let sub = ((store, delta) : (storage, int)) : storage => store - delta; + +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) + +let main = ((action, store) : (parameter, storage)) : return => { + (([] : list (operation)), // No operations + (switch (action) { + | Increment (n) => add ((store, n)) + | Decrement (n) => sub ((store, n)) + | Reset => 0 + })) +}; diff --git a/gitlab-pages/docs/intro/what-and-why.md b/gitlab-pages/docs/intro/what-and-why.md index fdd1d2887..f9e627efd 100644 --- a/gitlab-pages/docs/intro/what-and-why.md +++ b/gitlab-pages/docs/intro/what-and-why.md @@ -1,14 +1,73 @@ --- id: what-and-why -title: What & Why +title: Michelson and LIGO --- -Before we get into what LIGO is and why LIGO needs to exist, let's take a look at what options the Tezos blockchain offers us out of the box. If you want to implement smart contracts natively on Tezos, you have to learn [Michelson](https://tezos.gitlab.io/whitedoc/michelson.html). +Before we get into what LIGO is and why LIGO needs to exist, let us +take a look at what options the Tezos blockchain offers us out of the +box. If you want to implement smart contracts natively on Tezos, you +have to learn +[Michelson](https://tezos.gitlab.io/whitedoc/michelson.html). -> 💡 The (Michelson) language is stack-based, with high level data types and primitives and strict static type checking. +**The rationale and design of Michelson** +The language native to the Tezos blockchain for writing smart +contracts is *Michelson*, a Domain-Specific Language (DSL) inspired by +Lisp and Forth. This unusual lineage aims at satisfying unusual +constraints, but entails some tensions in the design. -Here's an example of Michelson code: +First, to measure stepwise gas consumption, *Michelson is interpreted*. + +On the one hand, to assess gas usage per instruction, instructions +should be simple, which points to low-level features (a RISC-like +language). On the other hand, it was originally thought that users +will want to write in Michelson instead of lowering a language to +Michelson, because the gas cost would otherwise be harder to +predict. This means that *high-level features* were deemed necessary +(like a restricted variant of Lisp lambdas, a way to encode algebraic +data types, as well as built-in sets, maps and lists). + +To avoid ambiguous and otherwise misleading contracts, the layout of +Michelson contracts has been constrained (e.g., indentation, no +UTF-8), and a *canonical form* was designed and enforced when storing +contracts on the chain. + +To reduce the size of the code, Michelson was designed as *a +stack-based language*, whence the lineage from Forth and other +concatenative languages like PostScript, Joy, Cat, Factor etc. (Java +bytecode would count too.) + +Programs in those languages are *compact* because they assume an +implicit stack in which some input values are popped, and output +values are pushed, according to the current instruction being +executed. + +*Each Michelson instruction modifies a prefix of the stack*, that is, +a segment starting at the top. + +Whilst the types of Michelson instructions can be polymorphic, their +instantiations must be monomorphic, hence *Michelson instructions are +not first-class values* and cannot be partially interpreted. + +This enables a simple *static type checking*, as opposed to a complex +type inference. It can be performed efficiently: *contract type +checking consumes gas*. Basically, type checking aims at validating +the composition of instructions, therefore is key to safely composing +contracts (concatenation, activations). Once a contract passes type +checking, it cannot fail due to inconsistent assumptions on the +storage and other values (there are no null values, no casts), but it +can still fail for other reasons: division by zero, token exhaustion, +gas exhaustion, or an explicit `FAILWITH` instruction. This property +is called *type safety*. Also, such a contract cannot remain stuck: +this is the *progress property*. + +The existence of a formal type system for Michelson, of a formal +specification of its dynamic semantics (evaluation), of a Michelson +interpreter in Coq, of proofs in Coq of properties of some typical +contracts, all those achievements are instances of *formal methods in +Tezos*. + +Here is an example of a Michelson contract. **`counter.tz`** ```text @@ -21,118 +80,167 @@ Here's an example of Michelson code: NIL operation ; PAIR } } ``` -The contract above maintains an `int` in its storage. It has two entrypoints *(functions)* `add` and `sub` to modify it, and the default *entrypoint* of type unit will reset it to 0. +The contract above maintains an `int` as its storage. It has two +[entrypoints](https://tezos.gitlab.io/whitedoc/michelson.html#entrypoints), +`add` and `sub`, to modify it, and the `default` entrypoint of type +`unit` will reset it to `0`. -The contract itself contains three main parts: +The contract itself contains three sections: +- `parameter` - The argument provided by a transaction invoking the contract. +- `storage` - The type definition for the contract's data storage. +- `code` - Actual Michelson code that has the provided parameter and + the current storage value in its initial stack. It outputs in the + resulting stack a pair made of a list of operations and a new + storage value. -- `parameter` - Argument provided by a transaction invoking the contract -- `storage` - Type definition for the contract's data storage. -- `code` - Actual Michelson code that has the provided parameter & the current storage value in its initial stack. It outputs a pair of operations and a new storage value as its resulting stack. +Michelson code consists of *instructions* like `IF_LEFT`, `PUSH ...`, +`UNPAIR` etc. that are composed sequentially in what is called a +*sequence*. The implicit stack contains at all times the state of the +evaluation of the program, whilst the storage represents the +persistent state. If the contract execution is successful, the new +storage state will be committed to the chain and become visible to all +the nodes. Instructions are used to transform a prefix of the stack, +that is, the topmost part of it, for example, by duplicating its top +element, dropping it, subtracting the first two etc. -Michelson code consists of *instructions* like `IF_LEFT`, `PUSH ...`, `UNPAIR` that are bundled togeter in what is called a *sequence*. Stack represents an intermediate state of the program, while **storage represents a persistent state**. Instructions are used to modify the run-time stack in order to yield a desired stack value when the program terminates. +> 💡 A Michelson program running on the Tezos blockchain is meant to +> output a pair of values including a `list of operations` to include +> in a transaction, and a new `storage` value to persist on the chain. -> 💡 A Michelson program running on the Tezos blockchain is meant to output a pair of values including a `list of operations` to emit and a new `storage` value to persist +## Stack versus variables -## Differences between a stack and traditional variable management - -Stack management might be a little bit challanging, especially if you're coming from a *C-like language*. Let's implement a similar program in Javascript: +Perhaps the biggest challenge when programming in Michelson is the +lack of *variables* to denote the data: the stack layout has to be +kept in mind when retrieving and storing data. For example, let us +implement a program in Javascript that is similar to the Michelson +above: **`counter.js`** ```javascript var storage = 0; -function add(a) { - storage += a -} +function add (a) { storage += a; } +function sub (a) { storage -= a; } -function sub(a) { - storage -= a -} +// We are calling this function "reset" instead of "default" +// because `default` is a Javascript keyword -// We're calling this function reset instead of default -// because `default` is a javascript keyword -function reset() { - storage = 0; -} +function reset () { storage = 0; } ``` -In our javascript program the initial `storage` value is `0` and it can be modified by running the functions `add(a)`, `sub(a)` and `reset()`. +In our Javascript program the initial `storage` value is `0` and it +can be modified by calling `add (a)`, `sub (a)` and `reset ()`. -Unfortunately (???), we **can't run Javascript on the Tezos blockchain** at the moment. But we can choose LIGO, which will abstract the stack management and allow us to create readable, type-safe, and efficient smart contracts. +We cannot run Javascript on the Tezos blockchain, but we can choose +LIGO, which will abstract the stack management and allow us to create +readable, type-safe, and efficient smart contracts. -> 💡 You can try running the javascript program [here](https://codepen.io/maht0rz/pen/dyyvoPQ?editors=0012) +## LIGO for Programming Smart Contracts on Tezos -## C-like smart contracts instead of Michelson +Perhaps the most striking feature of LIGO is that it comes in +different concrete syntaxes, and even different programming +paradigms. In other words, LIGO is not defined by one syntax and one +paradigm, like imperative versus functional. -Let's take a look at a similar LIGO program. Don't worry if it's a little confusing at first; we'll explain all the syntax in the upcoming sections of the documentation. + - There is **PascaLIGO**, which is inspired by Pascal, hence is an + imperative language with lots of keywords, where values can be + locally mutated after they have been annotated with their types + (declaration). + + - There is **CameLIGO**, which is inspired by the pure subset of + [OCaml](https://ocaml.org/), hence is a functional language with + few keywords, where values cannot be mutated, but still require + type annotations (unlike OCaml, whose compiler performs almost + full type inference). + + - There is **ReasonLIGO**, which is inspired by the pure subset of + [ReasonML](https://reasonml.github.io/), which is based upon + OCaml. + +Let us decline the same LIGO contract in the three flavours above. Do +not worry if it is a little confusing at first; we will explain all +the syntax in the upcoming sections of the documentation. -```pascaligo -type action is -| Increment of int -| Decrement of int -| Reset of unit +```pascaligo group=a +type storage is int -function main (const p : action ; const s : int) : (list(operation) * int) is - block { skip } with ((nil : list(operation)), - case p of - | Increment(n) -> s + n - | Decrement(n) -> s - n - | Reset(n) -> 0 +type parameter is + Increment of int +| Decrement of int +| Reset + +type return is list (operation) * storage + +function main (const action : parameter; const store : storage) : return is + ((nil : list (operation)), + case action of + Increment (n) -> store + n + | Decrement (n) -> store - n + | Reset -> 0 end) ``` -```cameligo -type action = -| Increment of int -| Decrement of int -| Reset of unit +```cameligo group=a +type storage = int -let main (p, s: action * int) : operation list * int = - let result = - match p with - | Increment n -> s + n - | Decrement n -> s - n - | Reset n -> 0 - in - (([]: operation list), result) +type parameter = + Increment of int +| Decrement of int +| Reset + +type return = operation list * storage + +let main (action, store : parameter * storage) : return = + ([] : operation list), + (match action with + Increment n -> store + n + | Decrement n -> store - n + | Reset -> 0) ``` -```reasonligo -type action = -| Increment(int) -| Decrement(int) -| Reset(unit); +```reasonligo group=a +type storage = int; -let main = ((p,s): (action, int)) : (list(operation), int) => { - let result = - switch (p) { - | Increment(n) => s + n - | Decrement(n) => s - n - | Reset n => 0 - }; - (([]: list(operation)), result); +type parameter = + Increment (int) +| Decrement (int) +| Reset; + +type return = (list (operation), storage); + +let main = ((action, store): (parameter, storage)) : return => { + (([] : list (operation)), + (switch (action) { + | Increment (n) => store + n + | Decrement (n) => store - n + | Reset => 0})); }; ``` + + -> 💡 You can find the Michelson compilation output of the contract above in **`ligo-counter.tz`** +This LIGO contract behaves almost exactly* like the Michelson +contract we saw first, and it accepts the following LIGO expressions: +`Increment(n)`, `Decrement(n)` and `Reset`. Those serve as +`entrypoint` identification, same as `%add` `%sub` or `%default` in +the Michelson contract. -The LIGO contract behaves exactly* like the Michelson contract we've saw first, and it accepts the following LIGO expressions/values: `Increment(n)`, `Decrement(n)` and `Reset(n)`. Those serve as `entrypoint` identification, same as `%add` `%sub` or `%default` in the Michelson contract. - -**not exactly, the Michelson contract also checks if the `AMOUNT` sent is `0`* +**The Michelson contract also checks if the `AMOUNT` sent is `0`* --- ## Runnable code snippets & exercises Some of the sections in this documentation will include runnable code snippets and exercises. Sources for those are available at -the [LIGO Gitlab repository](https://gitlab.com/ligolang/ligo). +the [LIGO Gitlab repository](https://gitlab.com/ligolang/ligo). ### Snippets For example **code snippets** for the *Types* subsection of this doc, can be found here: diff --git a/gitlab-pages/docs/language-basics/boolean-if-else.md b/gitlab-pages/docs/language-basics/boolean-if-else.md index d938f5b7b..56d565cec 100644 --- a/gitlab-pages/docs/language-basics/boolean-if-else.md +++ b/gitlab-pages/docs/language-basics/boolean-if-else.md @@ -9,7 +9,7 @@ The type of a boolean value is `bool`. Here is how to define a boolean value: - + ```pascaligo group=a const a : bool = True // Notice the capital letter const b : bool = False // Same. @@ -19,7 +19,6 @@ const b : bool = False // Same. let a : bool = true let b : bool = false ``` - ```reasonligo group=a let a : bool = true; @@ -27,8 +26,7 @@ let b : bool = false; ``` - -## Comparing two Values +## Comparing Values In LIGO, only values of the same type can be compared. Moreover, not all values of the same type can be compared, only those with @@ -42,7 +40,7 @@ function. ### Comparing Strings - + ```pascaligo group=b const a : string = "Alice" const b : string = "Alice" @@ -62,11 +60,10 @@ let c : bool = (a == b); // true ``` - ### Comparing numbers - + ```pascaligo group=c const a : int = 5 const b : int = 4 @@ -102,14 +99,13 @@ let h : bool = (a != b); ``` - ### Comparing tez > 💡 Comparing `tez` values is especially useful when dealing with an > amount sent in a transaction. - + ```pascaligo group=d const a : tez = 5mutez const b : tez = 10mutez @@ -136,7 +132,7 @@ Conditional logic enables forking the control flow depending on the state. - + ```pascaligo group=e type magnitude is Small | Large // See variant types. @@ -183,5 +179,4 @@ ligo run-function gitlab-pages/docs/language-basics/boolean-if-else/cond.religo compare 21n' # Outputs: Large ``` - diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index e68c93ed8..9fe1ff4f2 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -3,47 +3,42 @@ id: functions title: Functions --- -Writing code is fun as long as it does not get out of hand. To make -sure our code does not turn into spaghetti, we can structure some -logic into functions. +LIGO features functions are the basic building block of contracts. For +example, entrypoints are functions. -## Blocks +## Declaring Functions + + + + +There are two ways in PascaLIGO to define functions: with or without a +*block*. + +### Blocks In PascaLIGO, *blocks* enable the sequential composition of instructions into an isolated scope. Each block needs to include at -least one instruction. If we need a placeholder, we use the -instruction `skip` which leaves the state unchanged. The rationale -for `skip` instead of a truly empty block is that it prevents you from -writing an empty block by mistake. - - - +least one instruction. ```pascaligo skip -// terse style block { a := a + 1 } -// verbose style -begin - a := a + 1 -end ``` -Blocks are more versatile than simply containing instructions: -they can also include *declarations* of values, like so: + +If we need a placeholder, we use the instruction `skip` which leaves +the state unchanged. The rationale for `skip` instead of a truly +empty block is that it prevents you from writing an empty block by +mistake. + ```pascaligo skip -// terse style -block { const a : int = 1 } -// verbose style -begin - const a : int = 1 -end +block { skip } ``` - +Blocks are more versatile than simply containing instructions: they +can also include *declarations* of values, like so: -## Defining a function - - - +```pascaligo skip +block { const a : int = 1 } +``` Functions in PascaLIGO are defined using the `function` keyword followed by their `name`, `parameters` and `return` type definitions. @@ -60,15 +55,23 @@ function add (const a : int; const b : int) : int is The function body consists of two parts: -- `block { }` - logic of the function -- `with ` - the value returned by the function +- `block { }` is the logic of the function; +- `with ` is the value returned by the function. -#### Blockless functions +### Blockless functions + +Functions that can contain all of their logic into a single +*expression* can be defined without the need of a block: + +```pascaligo +function identity (const n : int) : int is block { skip } with n // Bad! Empty block not needed! + +function identity (const n : int) : int is n // Blockless +``` + +The value of the expression is implicitly returned by the +function. Another example is as follows: -Functions that can contain all of their logic into a single expression -can be defined without a block. Instead of a block, you put an -expression, whose value is implicitly returned by the function, like -so: ```pascaligo group=b function add (const a: int; const b : int) : int is a + b ``` @@ -134,10 +137,10 @@ ligo run-function gitlab-pages/docs/language-basics/src/functions/curry.mligo in The function body is a single expression, whose value is returned. - -Functions in ReasonLIGO are defined using the `let` keyword, like -other values. The difference is that a succession of parameters is -provided after the value name, followed by the return type. + Functions in ReasonLIGO are defined using the `let` +keyword, like other values. The difference is that a tuple of +parameters is provided after the value name, with its type, then +followed by the return type. Here is how you define a basic function that sums two integers: ```reasonligo group=b @@ -163,7 +166,7 @@ a key in a record or a map. Here is how to define an anonymous function: - + ```pascaligo group=c function increment (const b : int) : int is (function (const a : int) : int is a + 1) (b) @@ -194,7 +197,7 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.mligo a ```reasonligo group=c let increment = (b : int) : int => ((a : int) : int => a + 1)(b); -let a : int = increment (1); // a = 2 +let a : int = increment (1); // a == 2 ``` You can check the value of `a` defined above using the LIGO compiler @@ -212,7 +215,7 @@ the use case of having a list of integers and mapping the increment function to all its elements. - + ```pascaligo group=c function incr_map (const l : list (int)) : list (int) is list_map (function (const i : int) : int is i + 1, l) @@ -226,7 +229,7 @@ gitlab-pages/docs/language-basics/src/functions/incr_map.ligo incr_map # Outputs: [ 2 ; 3 ; 4 ] ``` - + ```cameligo group=c let incr_map (l : int list) : int list = List.map (fun (i : int) -> i + 1) l @@ -240,7 +243,7 @@ gitlab-pages/docs/language-basics/src/functions/incr_map.mligo incr_map # Outputs: [ 2 ; 3 ; 4 ] ``` - + ```reasonligo group=c let incr_map = (l : list (int)) : list (int) => List.map ((i : int) => i + 1, l); diff --git a/gitlab-pages/docs/language-basics/loops.md b/gitlab-pages/docs/language-basics/loops.md index 6ae699cd6..ce656ec86 100644 --- a/gitlab-pages/docs/language-basics/loops.md +++ b/gitlab-pages/docs/language-basics/loops.md @@ -7,36 +7,37 @@ title: Loops - + -General iteration in PascaLIGO takes the shape of "while" loops, which -should be familiar to programmers of imperative languages. Those loops -are of the form `while `. Their associated block is -repeatedly evaluated until the condition becomes true, or never -evaluated if the condition is false at the start. The loop never -terminates if the condition never becomes true. Because we are writing -smart contracts on Tezos, when the condition of a "while" loops fails -to become true, the execution will run out of gas and stop with a -failure anyway. +General iteration in PascaLIGO takes the shape of general loops, which +should be familiar to programmers of imperative languages as "while +loops". Those loops are of the form `while `. Their +associated block is repeatedly evaluated until the condition becomes +true, or never evaluated if the condition is false at the start. The +loop never terminates if the condition never becomes true. Because we +are writing smart contracts on Tezos, when the condition of a "while" +loops fails to become true, the execution will run out of gas and stop +with a failure anyway. Here is how to compute the greatest common divisors of two natural number by means of Euclid's algorithm: ```pascaligo group=a -function gcd (var x : nat; var y : nat) : nat is block { - if x < y then - block { - const z : nat = x; - x := y; y := z +function gcd (var x : nat; var y : nat) : nat is + block { + if x < y then + block { + const z : nat = x; + x := y; y := z + } + else skip; + var r : nat := 0n; + while y =/= 0n block { + r := x mod y; + x := y; + y := r } - else skip; - var r : nat := 0n; - while y =/= 0n block { - r := x mod y; - x := y; - y := r - } -} with x + } with x ``` You can call the function `gcd` defined above using the LIGO compiler @@ -64,6 +65,9 @@ to have a special type: if the type of the accumulator is `t`, then it must have the type `bool * t` (not simply `t`). It is the boolean value that denotes whether the stopping condition has been reached. +Here is how to compute the greatest common divisors of two natural +number by means of Euclid's algorithm: + ```cameligo group=a let iter (x,y : nat * nat) : bool * (nat * nat) = if y = 0n then false, (x,y) else true, (y, x mod y) @@ -86,7 +90,6 @@ let gcd (x,y : nat * nat) : nat = let x,y = Loop.fold_while iter (x,y) in x ``` - You can call the function `gcd` defined above using the LIGO compiler like so: ```shell @@ -113,6 +116,9 @@ accumulator is `t`, then it must have the type `bool * t` (not simply `t`). It is the boolean value that denotes whether the stopping condition has been reached. +Here is how to compute the greatest common divisors of two natural +number by means of Euclid's algorithm: + ```reasonligo group=a let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => if (y == 0n) { (false, (x,y)); } else { (true, (y, x mod y)); }; @@ -139,15 +145,15 @@ let gcd = ((x,y) : (nat, nat)) : nat => { ``` -## For Loops +## Bounded Loops - - +In addition to general loops, PascaLIGO features a specialised kind of +*loop to iterate over bounded intervals*. These loops are familiarly +known as "for loops" and they have the form `for to + `, which is familiar for programmers of +imperative languages. -To iterate over a range of integers you use a loop of the form `for - to `, which is -familiar for programmers of imperative languages. Note that, for the -sake of generality, the bounds are of type `int`, not `nat`. +Consider how to sum integers from `0` to `n`: ```pascaligo group=c function sum (var n : nat) : int is block { @@ -158,6 +164,8 @@ function sum (var n : nat) : int is block { } with acc ``` +(Please do not use that function: there exists a closed form formula.) + You can call the function `sum` defined above using the LIGO compiler like so: ```shell @@ -165,11 +173,6 @@ ligo run-function gitlab-pages/docs/language-basics/src/loops/sum.ligo sum 7n # Outputs: 28 ``` - - - - - PascaLIGO "for" loops can also iterate through the contents of a collection, that is, a list, a set or a map. This is done with a loop @@ -230,4 +233,3 @@ gitlab-pages/docs/language-basics/src/loops/collection.ligo sum_map 'map ["1"->1; "2"->2; "3"->3]' # Outputs: ( "123", 6 ) ``` - diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index 50ec7e8b8..59226b4e3 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -17,7 +17,8 @@ special operator (`.`). Let us first consider and example of record type declaration. - + + ```pascaligo group=a type user is record [ @@ -27,7 +28,7 @@ type user is ] ``` - + ```cameligo group=a type user = { id : nat; @@ -36,7 +37,7 @@ type user = { } ``` - + ```reasonligo group=a type user = { id : nat, @@ -49,7 +50,7 @@ type user = { And here is how a record value is defined: - + ```pascaligo group=a const alice : user = record [ @@ -59,7 +60,7 @@ const alice : user = ] ``` - + ```cameligo group=a let alice : user = { id = 1n; @@ -68,7 +69,7 @@ let alice : user = { } ``` - + ```reasonligo group=a let alice : user = { id : 1n, @@ -80,21 +81,21 @@ let alice : user = { ### Accessing Record Fields -If we want the contents of a given field, we use the `.` infix +If we want the contents of a given field, we use the (`.`) infix operator, like so: - + ```pascaligo group=a const alice_admin : bool = alice.is_admin ``` - + ```cameligo group=a let alice_admin : bool = alice.is_admin ``` - + ```reasonligo group=a let alice_admin: bool = alice.is_admin; ``` @@ -118,7 +119,7 @@ points on a plane. - + ```pascaligo group=b type point is record [x : int; y : int; z : int] type vector is record [dx : int; dy : int] @@ -142,7 +143,7 @@ You have to understand that `p` has not been changed by the functional update: a namless new version of it has been created and returned by the blockless function. - + The syntax for the functional updates of record in CameLIGO follows that of OCaml: @@ -156,7 +157,6 @@ let origin : point = {x = 0; y = 0; z = 0} let xy_translate (p, vec : point * vector) : point = {p with x = p.x + vec.dx; y = p.y + vec.dy} ``` - You can call the function `xy_translate` defined above by running the following command of the shell: @@ -171,7 +171,7 @@ xy_translate "({x=2;y=3;z=1}, {dx=3;dy=4})" > functional update: a nameless new version of it has been created and > returned. - + The syntax for the functional updates of record in ReasonLIGO follows that of OCaml: @@ -187,7 +187,7 @@ let xy_translate = ((p, vec) : (point, vector)) : point => ``` -You can call the function `x_translation` defined above by running the +You can call the function `xy_translate` defined above by running the following command of the shell: ```shell ligo run-function @@ -213,9 +213,6 @@ name "patch"). Let us consider defining a function that translates three-dimensional points on a plane. - - - ```pascaligo group=c type point is record [x : int; y : int; z : int] type vector is record [dx : int; dy : int] @@ -273,9 +270,10 @@ type vector is record [dx : int; dy : int] const origin : point = record [x = 0; y = 0; z = 0] -function xy_translate (var p : point; const vec : vector) : point is block { - const p : point = p with record [x = p.x + vec.dx; y = p.y + vec.dy] -} with p +function xy_translate (var p : point; const vec : vector) : point is + block { + const p : point = p with record [x = p.x + vec.dx; y = p.y + vec.dy] + } with p ``` You can call the new function `xy_translate` defined above by running the @@ -289,9 +287,6 @@ xy_translate "(record [x=2;y=3;z=1], record [dx=3;dy=4])" The hiding of a variable by another (here `p`) is called `shadowing`. - - - ## Maps *Maps* are a data structure which associate values of the same type to @@ -304,19 +299,19 @@ Here is how a custom map from addresses to a pair of integers is defined. - + ```pascaligo group=f type move is int * int type register is map (address, move) ``` - + ```cameligo group=f type move = int * int type register = (address, move) map ``` - + ```reasonligo group=f type move = (int, int); type register = map (address, move); @@ -326,7 +321,7 @@ type register = map (address, move); And here is how a map value is defined: - + ```pascaligo group=f const moves : register = @@ -340,7 +335,7 @@ const moves : register = > address)` means that we cast a string into an address. Also, `map` > is a keyword. - + ```cameligo group=f let moves : register = Map.literal [ @@ -353,7 +348,7 @@ let moves : register = > separate individual map entries. `("": address)` > means that we type-cast a string into an address. - + ```reasonligo group=f let moves : register = Map.literal ([ @@ -375,19 +370,19 @@ associated to a given key (`address` here) in the register. Here is an example: - + ```pascaligo group=f const my_balance : option (move) = moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)] ``` - + ```cameligo group=f let my_balance : move option = Map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves ``` - + ```reasonligo group=f let my_balance : option (move) = Map.find_opt (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), moves); @@ -400,7 +395,7 @@ the reader to account for a missing key in the map. This requires - + ```pascaligo group=f function force_access (const key : address; const moves : register) : move is case moves[key] of @@ -409,7 +404,7 @@ function force_access (const key : address; const moves : register) : move is end ``` - + ```cameligo group=f let force_access (key, moves : address * register) : move = match Map.find_opt key moves with @@ -417,7 +412,7 @@ let force_access (key, moves : address * register) : move = | None -> (failwith "No move." : move) ``` - + ```reasonligo group=f let force_access = ((key, moves) : (address, register)) : move => { switch (Map.find_opt (key, moves)) { @@ -438,7 +433,7 @@ those operations are called *updates*. - + The values of a PascaLIGO map can be updated using the usual assignment syntax `[] := `. Let us @@ -464,7 +459,7 @@ function assignments (var m : register) : register is } with m ``` - + We can update a binding in a map in CameLIGO by means of the `Map.update` built-in function: @@ -479,7 +474,7 @@ let assign (m : register) : register = > use `None` instead, that would have meant that the binding is > removed. - + We can update a binding in a map in ReasonLIGO by means of the `Map.update` built-in function: @@ -501,7 +496,7 @@ To remove a binding from a map, we need its key. - + In PascaLIGO, there is a special instruction to remove a binding from a map. @@ -512,13 +507,19 @@ function delete (const key : address; var moves : register) : register is } with moves ``` - + + +In CameLIGO, we use the predefined function `Map.remove` as follows: + ```cameligo group=f let delete (key, moves : address * register) : register = Map.remove key moves ``` - + + +In ReasonLIGO, we use the predefined function `Map.remove` as follows: + ```reasonligo group=f let delete = ((key, moves) : (address, register)) : register => { Map.remove (key, moves); @@ -528,51 +529,85 @@ let delete = ((key, moves) : (address, register)) : register => { -### Iterating Functionally over a Map +### Functional Iteration over Maps A *functional iterator* is a function that traverses a data structure and calls in turn a given function over the elements of that structure to compute some value. Another approach is possible in PascaLIGO: *loops* (see the relevant section). -There are three kinds of functional iteration over LIGO maps: `iter`, -`map` and `fold`. The first, `iter`, is an iteration over the map with +There are three kinds of functional iterations over LIGO maps: the +*iterated operation*, the *map operation* (not to be confused with the +*map data structure*) and the *fold operation*. + +#### Iterated Operation + +The first, the *iterated operation*, is an iteration over the map with no return value: its only use is to produce side-effects. This can be useful if for example you would like to check that each value inside of a map is within a certain range, and fail with an error otherwise. - + + + +In PascaLIGO, the predefined functional iterator implementing the +iterated operation over maps is called `map_iter`. In the following +example, the register of moves is iterated to check that the start of +each move is above `3`. + ```pascaligo group=f function iter_op (const m : register) : unit is block { - function aggregate (const i : address; const j : move) : unit is block - { if j.1 > 1 then skip else failwith ("Below range.") } with unit - } with map_iter (aggregate, m) + function iterated (const i : address; const j : move) : unit is + if j.1 > 3 then Unit else (failwith ("Below range.") : unit) + } with map_iter (iterated, m) ``` - +> The iterated function must be pure, that is, it cannot mutate +> variables. + + + +In CameLIGO, the predefinded functional iterator implementing the +iterated operation over maps is called `Map.iter`. In the following +example, the register of moves is iterated to check that the start of +each move is above `3`. + ```cameligo group=f let iter_op (m : register) : unit = - let assert_eq = fun (i,j : address * move) -> assert (j.0 > 1) - in Map.iter assert_eq m + let predicate = fun (i,j : address * move) -> assert (j.0 > 3) + in Map.iter predicate m ``` - + + +In ReasonLIGO, the predefined functional iterator implementing the +iterated operation over maps is called `Map.iter`. In the following +example, the register of moves is iterated to check that the start of +each move is above `3`. + ```reasonligo group=f let iter_op = (m : register) : unit => { - let assert_eq = ((i,j) : (address, move)) => assert (j[0] > 1); - Map.iter (assert_eq, m); + let predicate = ((i,j) : (address, move)) => assert (j[0] > 3); + Map.iter (predicate, m); }; ``` +#### Map Operation + We may want to change all the bindings of a map by applying to them a -function. This is also called a *map operation*, as opposed to the -*map data structure* we have been presenting. +function. This is called a *map operation*, not to be confused with +the map data structure. - + + + +In PascaLIGO, the predefined functional iterator implementing the map +operation over maps is called `map_map`and is used as follows: + ```pascaligo group=f function map_op (const m : register) : register is block { @@ -581,49 +616,78 @@ function map_op (const m : register) : register is } with map_map (increment, m) ``` - +> The mapped function must be pure, that is, it cannot mutate +> variables. + + + +In CameLIGO, the predefined functional iterator implementing the map +operation over maps is called `Map.map` and is used as follows: + ```cameligo group=f let map_op (m : register) : register = let increment = fun (i,j : address * move) -> j.0, j.1 + 1 in Map.map increment m ``` - + + +In ReasonLIGO, the predefined functional iteratir implementing the map +operation over maps is called `Map.map` and is used as follows: + ```reasonligo group=f let map_op = (m : register) : register => { let increment = ((i,j): (address, move)) => (j[0], j[1] + 1); - Map.map(increment, m); + Map.map (increment, m); }; ``` -A *fold operation* is the most general of iterations. The iterated +#### Fold Operation + +A *fold operation* is the most general of iterations. The folded function takes two arguments: an *accumulator* and the structure *element* at hand, with which it then produces a new accumulator. This enables having a partial result that becomes complete when the traversal of the data structure is over. - + + + +In PascaLIGO, the predefined functional iterator implementing the fold +operation over maps is called `map_fold` and is used as follows: + ```pascaligo group=f function fold_op (const m : register) : int is block { - function aggregate (const j : int; const cur : address * move) : int is + function iterated (const j : int; const cur : address * move) : int is j + cur.1.1 - } with map_fold (aggregate, m, 5) + } with map_fold (iterated, m, 5) ``` - +> The folded function must be pure, that is, it cannot mutate +> variables. + + + +In CameLIGO, the predefined functional iterator implementing the fold +operation over maps is called `Map.fold` and is used as follows: + ```cameligo group=f let fold_op (m : register) : register = - let aggregate = fun (i,j : int * (address * move)) -> i + j.1.1 - in Map.fold aggregate m 5 + let iterated = fun (i,j : int * (address * move)) -> i + j.1.1 + in Map.fold iterated m 5 ``` - + + +In ReasonLIGO, the predefined functional iterator implementing the +fold operation over maps is called `Map.fold` and is used as follows: + ```reasonligo group=f let fold_op = (m : register) : register => { - let aggregate = ((i,j): (int, (address, move))) => i + j[1][1]; - Map.fold (aggregate, m, 5); + let iterated = ((i,j): (int, (address, move))) => i + j[1][1]; + Map.fold (iterated, m, 5); }; ``` @@ -643,32 +707,32 @@ interface for big maps is analogous to the one used for ordinary maps. Here is how we define a big map: - + ```pascaligo group=g type move is int * int type register is big_map (address, move) ``` - + ```cameligo group=g type move = int * int type register = (address, move) big_map ``` - + ```reasonligo group=g type move = (int, int); -type register = big_map(address, move); +type register = big_map (address, move); ``` And here is how a map value is created: - + ```pascaligo group=g const moves : register = @@ -682,7 +746,7 @@ const moves : register = > `("" : address)` means that we cast a string into an > address. - + ```cameligo group=g let moves : register = @@ -696,7 +760,7 @@ let moves : register = > separating individual map entries. The annotated value `(" value>" : address)` means that we cast a string into an address. - + ```reasonligo group=g let moves : register = @@ -713,28 +777,30 @@ let moves : register = -### Accessing Values by Key +### Accessing Values If we want to access a move from our `register` above, we can use the postfix `[]` operator to read the associated `move` value. However, -the value we read is an optional value: in our case, of type `option -(move)`. Here is an example: +the value we read is an optional value (in our case, of type `option +(move)`), to account for a missing key. Here is an example: - + + + ```pascaligo group=g const my_balance : option (move) = moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)] ``` - + ```cameligo group=g let my_balance : move option = Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves ``` - + ```reasonligo group=g let my_balance : option (move) = @@ -742,23 +808,25 @@ let my_balance : option (move) = ``` -### Updating a Big Map +### Updating Big Maps - + The values of a PascaLIGO big map can be updated using the assignment syntax for ordinary maps ```pascaligo group=g -function assign (var m : register) : register is +function add (var m : register) : register is block { m [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address)] := (4,9) } with m + +const updated_map : register = add (moves) ``` - + We can update a big map in CameLIGO using the `Big_map.update` built-in: @@ -769,7 +837,7 @@ let updated_map : register = ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) (Some (4,9)) moves ``` - + We can update a big map in ReasonLIGO using the `Big_map.update` built-in: @@ -780,6 +848,47 @@ let updated_map : register = (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some((4,9)), moves); ``` -### Removing Bindings from a Map + + +### Removing Bindings + +Removing a binding in a map is done differently according to the LIGO +syntax. + + + + + +PascaLIGO features a special syntactic construct to remove bindings +from maps, of the form `remove from map `. For example, + +```pascaligo group=g +function rem (var m : register) : register is + block { + remove ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) from map moves + } with m + +const updated_map : register = rem (moves) +``` + + + +In CameLIGO, the predefined function which removes a binding in a map +is called `Map.remove` and is used as follows: + +```cameligo group=g +let updated_map : register = + Map.remove ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves +``` + + + +In ReasonLIGO, the predefined function which removes a binding in a map +is called `Map.remove` and is used as follows: + +```reasonligo group=g +let updated_map : register = + Map.remove (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves) +``` diff --git a/gitlab-pages/docs/language-basics/math-numbers-tez.md b/gitlab-pages/docs/language-basics/math-numbers-tez.md index bb274cd7c..11a589c12 100644 --- a/gitlab-pages/docs/language-basics/math-numbers-tez.md +++ b/gitlab-pages/docs/language-basics/math-numbers-tez.md @@ -18,8 +18,7 @@ adding a value of type `int` to a value of type `tez` is invalid. Note that adding an integer to a natural number produces an integer. - - + ```pascaligo group=a // int + int yields int const a : int = 5 + 10 @@ -50,7 +49,6 @@ const g : int = 1_000_000 >``` - ```cameligo group=a // int + int yields int let a : int = 5 + 10 @@ -81,7 +79,6 @@ let g : int = 1_000_000 >``` - ```reasonligo group=a // int + int yields int let a : int = 5 + 10; @@ -99,7 +96,7 @@ let c : tez = 5mutez + 10mutez; let e : nat = 5n + 10n; // nat + int yields an int: invalid -//let f : nat = 5n + 10; +// let f : nat = 5n + 10; let g : int = 1_000_000; ``` @@ -109,7 +106,6 @@ let g : int = 1_000_000; >```reasonligo >let sum : tex = 100_000mutez; >``` - ## Subtraction @@ -119,7 +115,7 @@ Subtraction looks as follows. > ⚠️ Even when subtracting two `nats`, the result is an `int` - + ```pascaligo group=b const a : int = 5 - 10 @@ -166,7 +162,7 @@ let d : tez = 5mutez - 1mutez; You can multiply values of the same type, such as: - + ```pascaligo group=c const a : int = 5 * 5 @@ -200,7 +196,7 @@ In LIGO you can divide `int`, `nat`, and `tez`. Here is how: > ⚠️ Division of two `tez` values results into a `nat` - + ```pascaligo group=d const a : int = 10 / 3 const b : nat = 10n / 3n @@ -248,11 +244,11 @@ let b : nat = abs (1); -## Check if a value is a `nat` +## Checking a `nat` -You can check if a value is a `nat` by using a syntax specific -built-in function, which accepts an `int` and returns an optional -`nat`: if `Some(nat)` then the provided integer was indeed a natural +You can check if a value is a `nat` by using a predefined cast +function which accepts an `int` and returns an optional `nat`: if the +result is not `None`, then the provided integer was indeed a natural number, and not otherwise. diff --git a/gitlab-pages/docs/language-basics/sets-lists-tuples.md b/gitlab-pages/docs/language-basics/sets-lists-tuples.md index e43de8200..8da5b6300 100644 --- a/gitlab-pages/docs/language-basics/sets-lists-tuples.md +++ b/gitlab-pages/docs/language-basics/sets-lists-tuples.md @@ -3,11 +3,8 @@ id: sets-lists-tuples title: Tuples, Lists, Sets --- -Apart from complex data types such as `maps` and `records`, ligo also -exposes `tuples`, `lists` and `sets`. - -> ⚠️ Make sure to pick the appropriate data type for your use case, and -> bear in mind the related gas costs. +Apart from complex data types such as `maps` and `records`, LIGO also +features `tuples`, `lists` and `sets`. ## Tuples @@ -15,16 +12,16 @@ Tuples gather a given number of values in a specific order and those values, called *components*, can be retrieved by their index (position). Probably the most common tuple is the *pair*. For example, if we were storing coordinates on a two dimensional grid we -might use a pair of type `int * int` to store the coordinates `x` and -`y` as the pair value `(x,y)`. There is a *specific order*, so `(y,x)` -is not equal to `(x,y)`. The number of components is part of the type -of a tuple, so, for example, we cannot add an extra component to a -pair and obtain a triple of the same type: `(x,y)` has always a -different type from `(x,y,z)`, whereas `(y,x)` may have the same type. +might use a pair `(x,y)` to store the coordinates `x` and `y`. There +is a *specific order*, so `(y,x)` is not equal to `(x,y)`. The number +of components is part of the type of a tuple, so, for example, we +cannot add an extra component to a pair and obtain a triple of the +same type, so, for instance, `(x,y)` has always a different type from +`(x,y,z)`, whereas `(y,x)` might have the same type as `(x,y)`. Like records, tuple components can be of arbitrary types. -### Defining a tuple +### Defining Tuples Unlike [a record](language-basics/maps-records.md), tuple types do not have to be defined before they can be used. However below we will give @@ -33,54 +30,55 @@ them names by *type aliasing*. -```pascaligo group=c + +```pascaligo group=tuple type full_name is string * string // Alias const full_name : full_name = ("Alice", "Johnson") ``` -```cameligo group=c + +```cameligo group=tuple type full_name = string * string // Alias -(* The parenthesis here are optional *) -let full_name : full_name = ("Alice", "Johnson") +let full_name : full_name = ("Alice", "Johnson") // Optional parentheses ``` -```reasonligo group=c + +```reasonligo group=tuple type full_name = (string, string); // Alias -(* The parenthesis here are optional *) let full_name : full_name = ("Alice", "Johnson"); ``` -### Accessing an Element in a Tuple +### Accessing Components Accessing the components of a tuple in OCaml is achieved by [pattern matching](language-basics/unit-option-pattern-matching.md). LIGO currently supports tuple patterns only in the parameters of functions, -not in pattern matching. In LIGO, however, we can access components by -their position in their tuple, which cannot be done in OCaml. +not in pattern matching. However, we can access components by their +position in their tuple, which cannot be done in OCaml. - + Tuple components are one-indexed like so: -```pascaligo group=c +```pascaligo group=tuple const first_name : string = full_name.1; ``` - + Tuple elements are zero-indexed and accessed like so: -```cameligo group=c +```cameligo group=tuple let first_name : string = full_name.0 ``` @@ -88,10 +86,12 @@ let first_name : string = full_name.0 Tuple components are one-indexed like so: -```reasonligo group=c +```reasonligo group=tuple let first_name : string = full_name[1]; ``` + + ## Lists Lists are linear collections of elements of the same type. Linear @@ -105,105 +105,183 @@ think of a list a *stack*, where the top is written on the left. > 💡 Lists are useful when returning operations from a smart > contract's entrypoint. -### Defining a List +### Defining Lists - -```pascaligo group=b + +```pascaligo group=lists const my_list : list (int) = list [1; 2; 2] // The head is 1 ``` -```cameligo group=b +```cameligo group=lists let my_list : int list = [1; 2; 2] // The head is 1 ``` -```reasonligo group=b +```reasonligo group=lists let my_list : list (int) = [1, 2, 2]; // The head is 1 ``` -### Adding to a List +### Adding to Lists Lists can be augmented by adding an element before the head (or, in terms of stack, by *pushing an element on top*). This operation is usually called *consing* in functional languages. + + + + In PascaLIGO, the *cons operator* is infix and noted `#`. It is not symmetric: on the left lies the element to cons, and, on the right, a list on which to cons. (The symbol is helpfully asymmetric to remind you of that.) +```pascaligo group=lists +const larger_list : list (int) = 5 # my_list // [5;1;2;2] +``` + + + In CameLIGO, the *cons operator* is infix and noted `::`. It is not symmetric: on the left lies the element to cons, and, on the right, a list on which to cons. +```cameligo group=lists +let larger_list : int list = 5 :: my_list // [5;1;2;2] +``` + + + In ReasonLIGO, the *cons operator* is infix and noted `, ...`. It is not symmetric: on the left lies the element to cons, and, on the right, a list on which to cons. - - -```pascaligo group=b -const larger_list : list (int) = 5 # my_list -``` - - -```cameligo group=b -let larger_list : int list = 5 :: my_list -``` - - -```reasonligo group=b -let larger_list : list (int) = [5, ...my_list]; +```reasonligo group=lists +let larger_list : list (int) = [5, ...my_list]; // [5,1,2,2] ``` -
- > 💡 Lists can be iterated, folded or mapped to different values. You > can find additional examples > [here](https://gitlab.com/ligolang/ligo/tree/dev/src/test/contracts) > and other built-in operators > [here](https://gitlab.com/ligolang/ligo/blob/dev/src/passes/operators/operators.ml#L59) -### Mapping of a List +### Functional Iteration over Lists -We may want to apply a function to all the elements of a list and -obtain the resulting list, in the same order. For example, we may want -to create a list that contains all the elements of another list -incremented by one. This is a special case of *fold operation* called -a *map operation*. Map operations (not to be confused by the -[map data structure](language-basics/maps-records.md)), are predefined -functions in LIGO. They take as a parameter the function to apply to -all the elements. Of course, that function must return a value of the -same type as the element. +A *functional iterator* is a function that traverses a data structure +and calls in turn a given function over the elements of that structure +to compute some value. Another approach is possible in PascaLIGO: +*loops* (see the relevant section). -In PascaLIGO, the map function is called `list_map`. +There are three kinds of functional iterations over LIGO maps: the +*iterated operation*, the *map operation* (not to be confused with the +*map data structure*) and the *fold operation*. -In CameLIGO and ReasonLIGO, the map function is called `List.map`. +#### Iterated Operation + +The first, the *iterated operation*, is an iteration over the map with +no return value: its only use is to produce side-effects. This can be +useful if for example you would like to check that each value inside +of a map is within a certain range, and fail with an error otherwise. - -```pascaligo group=b + + + +In PascaLIGO, the predefined functional iterator implementing the +iterated operation over lists is called `list_iter`. + +In the following example, a list is iterated to check that all its +elements (integers) are greater than `3`: + +```pascaligo group=lists +function iter_op (const l : list (int)) : unit is + block { + function iterated (const i : int) : unit is + if i > 2 then Unit else (failwith ("Below range.") : unit) + } with list_iter (iterated, l) +``` + +> The iterated function must be pure, that is, it cannot mutate +> variables. + + + +In CameLIGO, the predefined functional iterator implementing the +iterated operation over lists is called `List.iter`. + +In the following example, a list is iterated to check that all its +elements (integers) are greater than `3`: + +```cameligo group=lists +let iter_op (l : int list) : unit = + let predicate = fun (i : int) -> assert (i > 3) + in List.iter predicate l +``` + + + +In ReasonLIGO, the predefined functional iterator implementing the +iterated operation over lists is called `List.iter`. + +In the following example, a list is iterated to check that all its +elements (integers) are greater than `3`: + +```reasonligo group=lists +let iter_op = (l : list (int)) : unit => { + let predicate = (i : int) => assert (i > 3); + List.iter (predicate, l); +}; +``` + + + + +#### Map Operation + +We may want to change all the elements of a given list by applying to +them a function. This is called a *map operation*, not to be confused +with the map data structure. + + + + + +In PascaLIGO, the predefined functional iterator implementing the map +operation over lists is called `list_map` and is used as follows: + +```pascaligo group=lists function increment (const i : int): int is i + 1 // Creates a new list with all elements incremented by 1 const plus_one : list (int) = list_map (increment, larger_list) ``` + -```cameligo group=b + +In CameLIGO, the predefined functional iterator implementing the map +operation over lists is called `List.map` and is used as follows: + +```cameligo group=lists let increment (i : int) : int = i + 1 // Creates a new list with all elements incremented by 1 let plus_one : int list = List.map increment larger_list ``` + -```reasonligo group=b + +In ReasonLIGO, the predefined functional iterator implementing the map +operation over lists is called `List.map` and is used as follows: + +```reasonligo group=lists let increment = (i : int) : int => i + 1; // Creates a new list with all elements incremented by 1 @@ -212,33 +290,51 @@ let plus_one : list (int) = List.map (increment, larger_list); -### Folding of over a List +#### Fold Operation + +A *fold operation* is the most general of iterations. The folded +function takes two arguments: an *accumulator* and the structure +*element* at hand, with which it then produces a new accumulator. This +enables having a partial result that becomes complete when the +traversal of the data structure is over. - -```pascaligo group=b + + + +In PascaLIGO, the predefined functional iterator implementing the fold +operation over lists is called `list_fold` and is used as follows: + +```pascaligo group=lists function sum (const acc : int; const i : int): int is acc + i const sum_of_elements : int = list_fold (sum, my_list, 0) ``` +> The folded function must be pure, that is, it cannot mutate +> variables. + -```cameligo group=b +In CameLIGO, the predefined functional iterator implementing the fold +operation over lists is called `List.fold` and is used as follows: + +```cameligo group=lists let sum (acc, i: int * int) : int = acc + i let sum_of_elements : int = List.fold sum my_list 0 ``` -```reasonligo group=b +In ReasonLIGO, the predefined functional iterator implementing the +fold operation over lists is called `List.fold` and is used as follows: + +```reasonligo group=lists let sum = ((result, i): (int, int)): int => result + i; let sum_of_elements : int = List.fold (sum, my_list, 0); ``` - - ## Sets Sets are unordered collections of values of the same type, like lists @@ -249,56 +345,65 @@ whereas they can be repeated in a list. ### Empty Sets - -```pascaligo group=a + + + +In PascaLIGO, the notation for sets is similar to that for lists, +except the keyword `set` is used before: + +```pascaligo group=sets const my_set : set (int) = set [] ``` -```cameligo group=a -let my_set : int set = (Set.empty : int set) + +In CameLIGO, the empty set is denoted by the predefined value +`Set.empty`. + +```cameligo group=sets +let my_set : int set = Set.empty ``` + -```reasonligo group=a -let my_set : set (int) = (Set.empty : set (int)); + +In CameLIGO, the empty set is denoted by the predefined value +`Set.empty`. + +```reasonligo group=sets +let my_set : set (int) = Set.empty; ``` ### Non-empty Sets + + In PascaLIGO, the notation for sets is similar to that for lists, except the keyword `set` is used before: - - -```pascaligo group=a +```pascaligo group=sets const my_set : set (int) = set [3; 2; 2; 1] ``` - - You can check that `2` is not repeated in `my_set` by using the LIGO compiler like this (the output will sort the elements of the set, but that order is not significant for the compiler): - ```shell ligo evaluate-value gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo my_set # Outputs: { 3 ; 2 ; 1 } ``` + + In CameLIGO, there is no predefined syntactic construct for sets: you must build your set by adding to the empty set. (This is the way in OCaml.) - - -```cameligo group=a +```cameligo group=sets let my_set : int set = Set.add 3 (Set.add 2 (Set.add 2 (Set.add 1 (Set.empty : int set)))) ``` - - You can check that `2` is not repeated in `my_set` by using the LIGO compiler like this (the output will sort the elements of the set, but that order is not significant for the compiler): @@ -309,17 +414,16 @@ gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo my_set # Outputs: { 3 ; 2 ; 1 } ``` + + In ReasonLIGO, there is no predefined syntactic construct for sets: you must build your set by adding to the empty set. (This is the way in OCaml.) - - -```reasonligo group=a +```reasonligo group=sets let my_set : set (int) = Set.add (3, Set.add (2, Set.add (2, Set.add (1, Set.empty : set (int))))); ``` - You can check that `2` is not repeated in `my_set` by using the LIGO compiler like this (the output will sort the elements of the set, but @@ -330,25 +434,36 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo my_set # Outputs: { 3 ; 2 ; 1 } ``` + ### Set Membership + + -PascaLIGO features a special keyword `constains` that operates like an +PascaLIGO features a special keyword `contains` that operates like an infix operator checking membership in a set. - - -```pascaligo group=a +```pascaligo group=sets const contains_3 : bool = my_set contains 3 ``` + -```cameligo group=a + +In CameLIGO, the predefined predicate `Set.mem` tests for membership +in a set as follows: + +```cameligo group=sets let contains_3 : bool = Set.mem 3 my_set ``` + -```reasonligo group=a + +In ReasonLIGO, the predefined predicate `Set.mem` tests for membership +in a set as follows: + +```reasonligo group=sets let contains_3 : bool = Set.mem (3, my_set); ``` @@ -357,37 +472,50 @@ let contains_3 : bool = Set.mem (3, my_set); ### Cardinal - -```pascaligo group=a + + + +In PascaLIGO, the predefined function `size` returns the number of +elements in a given set as follows: + +```pascaligo group=sets const set_size : nat = size (my_set) ``` -```cameligo group=a + +In CameLIGO, the predefined function `Set.size` returns the number of +elements in a given set as follows: + +```cameligo group=sets let set_size : nat = Set.size my_set ``` -```reasonligo group=a + +In ReasonLIGO, the predefined function `Set.size` returns the number +of elements in a given set as follows: + +```reasonligo group=sets let set_size : nat = Set.size (my_set); ``` + -### Adding or Removing from a Set - - - -In PascaLIGO, there are two ways to update a set. Either we create a -new set from the given one, or we modify it in-place. First, let us -consider the former: +### Updating Sets - -```pascaligo group=a + + + +In PascaLIGO, there are two ways to update a set, that is to add or +remove from it. Either we create a new set from the given one, or we +modify it in-place. First, let us consider the former way + +```pascaligo group=sets const larger_set : set (int) = set_add (4, my_set) const smaller_set : set (int) = set_remove (3, my_set) ``` - If we are in a block, we can use an instruction to modify the set bound to a given variable. This is called a *patch*. It is only @@ -400,37 +528,31 @@ this instruction is equivalent to perform the union of two sets, one that is modified in-place, and the other given as a literal (extensional definition). - - -```pascaligo group=a +```pascaligo group=sets function update (var s : set (int)) : set (int) is block { patch s with set [4; 7] } with s const new_set : set (int) = update (my_set) ``` - + In CameLIGO, we update a given set by creating another one, with or without some elements. - - -```cameligo group=a +```cameligo group=sets let larger_set : int set = Set.add 4 my_set let smaller_set : int set = Set.remove 3 my_set ``` - + In ReasonLIGO, we update a given set by creating another one, with or without some elements. - - -```reasonligo group=a +```reasonligo group=sets let larger_set : set (int) = Set.add (4, my_set); let smaller_set : set (int) = Set.remove (3, my_set); @@ -438,32 +560,149 @@ let smaller_set : set (int) = Set.remove (3, my_set); -### Folding over a Set +### Functional Iteration over Sets +A *functional iterator* is a function that traverses a data structure +and calls in turn a given function over the elements of that structure +to compute some value. Another approach is possible in PascaLIGO: +*loops* (see the relevant section). -Given a set, we may want to apply a function in turn to all the -elements it contains, while accumulating some value which is returned -at the end. This is a *fold operation*. In the following example, we -sum up all the elements of the set `my_set` defined above. +There are three kinds of functional iterations over LIGO maps: the +*iterated operation*, the *map operation* (not to be confused with the +*map data structure*) and the *fold operation*. +#### Iterated Operation -In PascaLIGO, the folded function takes the accumulator first and the -(current) set element second. The predefined fold is called `set_fold`. +The first, the *iterated operation*, is an iteration over the map with +no return value: its only use is to produce side-effects. This can be +useful if for example you would like to check that each value inside +of a map is within a certain range, and fail with an error otherwise. - -```pascaligo group=a + + + +In PascaLIGO, the predefined functional iterator implementing the +iterated operation over sets is called `set_iter`. + +In the following example, a set is iterated to check that all its +elements (integers) are greater than `3`: + +```pascaligo group=sets +function iter_op (const s : set (int)) : unit is + block { + function iterated (const i : int) : unit is + if i > 2 then Unit else (failwith ("Below range.") : unit) + } with set_iter (iterated, s) +``` + +> The iterated function must be pure, that is, it cannot mutate +> variables. + + + +In CameLIGO, the predefined functional iterator implementing the +iterated operation over sets is called `Set.iter`. + +In the following example, a set is iterated to check that all its +elements (integers) are greater than `3`: + +```cameligo group=sets +let iter_op (s : int set) : unit = + let predicate = fun (i : int) -> assert (i > 3) + in Set.iter predicate s +``` + + + +In ReasonLIGO, the predefined functional iterator implementing the +iterated operation over sets is called `Set.iter`. + +In the following example, a set is iterated to check that all its +elements (integers) are greater than `3`: + +```reasonligo group=sets +let iter_op = (s : set (int)) : unit => { + let predicate = (i : int) => assert (i > 3); + Set.iter (predicate, s); +}; +``` + + + + +#### Map Operation + +We may want to change all the elements of a given set by applying to +them a function. This is called a *map operation*, not to be confused +with the map data structure. + + + + + +In PascaLIGO, the predefined functional iterator implementing the map +operation over sets is called `set_map` and is used as follows: + +```pascaligo group=sets +function increment (const i : int): int is i + 1 + +// Creates a new set with all elements incremented by 1 +const plus_one : set (int) = set_map (increment, larger_set) +``` + + + +In CameLIGO, the predefined functional iterator implementing the map +operation over sets is called `Set.map` and is used as follows: + +```cameligo group=sets +let increment (i : int) : int = i + 1 + +// Creates a new set with all elements incremented by 1 +let plus_one : int set = Set.map increment larger_set +``` + + + +In ReasonLIGO, the predefined functional iterator implementing the map +operation over sets is called `Set.map` and is used as follows: + +```reasonligo group=sets +let increment = (i : int) : int => i + 1; + +// Creates a new set with all elements incremented by 1 +let plus_one : set (int) = Set.map (increment, larger_set); +``` + + +#### Fold Operation + +A *fold operation* is the most general of iterations. The folded +function takes two arguments: an *accumulator* and the structure +*element* at hand, with which it then produces a new accumulator. This +enables having a partial result that becomes complete when the +traversal of the data structure is over. + + + + + +In PascaLIGO, the predefined functional iterator implementing the fold +operation over sets is called `set_fold` and is used as follows: + +```pascaligo group=sets function sum (const acc : int; const i : int): int is acc + i const sum_of_elements : int = set_fold (sum, my_set, 0) ``` - + +> The folded function must be pure, that is, it cannot mutate +> variables. It is possible to use a *loop* over a set as well. - - -```pascaligo group=a +```pascaligo group=sets function loop (const s : set (int)) : int is block { var sum : int := 0; for element in set s block { @@ -471,27 +710,24 @@ function loop (const s : set (int)) : int is block { } } with sum ``` - + + In CameLIGO, the predefined fold over sets is called `Set.fold`. - - -```cameligo group=a +```cameligo group=sets let sum (acc, i : int * int) : int = acc + i let sum_of_elements : int = Set.fold sum my_set 0 ``` - + + In ReasonLIGO, the predefined fold over sets is called `Set.fold`. - - -```reasonligo group=a +```reasonligo group=sets let sum = ((acc, i) : (int, int)) : int => acc + i; let sum_of_elements : int = Set.fold (sum, my_set, 0); ``` - diff --git a/gitlab-pages/docs/language-basics/strings.md b/gitlab-pages/docs/language-basics/strings.md index 297edee09..3ad0d568d 100644 --- a/gitlab-pages/docs/language-basics/strings.md +++ b/gitlab-pages/docs/language-basics/strings.md @@ -6,7 +6,7 @@ title: Strings Strings are defined using the built-in `string` type like this: - + ``` const a : string = "Hello Alice" ``` @@ -21,10 +21,10 @@ let a : string = "Hello Alice"; -## Concatenating strings +## Concatenating Strings - + Strings can be concatenated using the `^` operator. ```pascaligo @@ -51,12 +51,12 @@ let full_greeting : string = greeting ++ " " ++ name; -## Slicing strings +## Slicing Strings Strings can be sliced using a built-in function: - + ```pascaligo const name : string = "Alice" const slice : string = string_slice (0n, 1n, name) @@ -73,29 +73,27 @@ let slice : string = String.slice (0n, 1n, name); ``` -> ⚠️ Notice that the `offset` and slice `length` are natural numbers -> (`nat`). +> ⚠️ Notice that the offset and length of the slice are natural numbers. -## Aquiring the length of a string +## Length of Strings The length of a string can be found using a built-in function: - + ```pascaligo const name : string = "Alice" -// length = 5 -const length : nat = size (name) +const length : nat = size (name) // length = 5 ``` ```cameligo let name : string = "Alice" -let length : nat = String.size name +let length : nat = String.size name // length = 5 ``` ```reasonligo let name : string = "Alice"; -let length : nat = String.size (name); +let length : nat = String.size (name); // length == 5 ``` diff --git a/gitlab-pages/docs/language-basics/tezos-specific.md b/gitlab-pages/docs/language-basics/tezos-specific.md index a1f8c17dc..bd50a4229 100644 --- a/gitlab-pages/docs/language-basics/tezos-specific.md +++ b/gitlab-pages/docs/language-basics/tezos-specific.md @@ -7,7 +7,7 @@ LIGO is a programming language for writing Tezos smart contracts. It would be a little odd if it did not have any Tezos specific functions. This page will tell you about them. -## Pack and unpack +## Pack and Unpack Michelson provides the `PACK` and `UNPACK` instructions for data serialization. The instruction `PACK` converts Michelson data @@ -59,11 +59,12 @@ predefined function returning a value of type `key_hash`. ```pascaligo group=b -function check_hash_key (const kh1 : key_hash; const k2 : key) : bool * key_hash is block { - var ret : bool := False; - var kh2 : key_hash := crypto_hash_key (k2); - if kh1 = kh2 then ret := True else skip -} with (ret, kh2) +function check_hash_key (const kh1 : key_hash; const k2 : key) : bool * key_hash is + block { + var ret : bool := False; + var kh2 : key_hash := crypto_hash_key (k2); + if kh1 = kh2 then ret := True else skip + } with (ret, kh2) ``` @@ -122,14 +123,14 @@ let check_signature = -## Getting the contract's own address +## Contract's Own Address Often you want to get the address of the contract being executed. You can do it with `self_address`. > ⚠️ Due to limitations in Michelson, `self_address` in a contract is -> only allowed at the entry-point level (a.k.a top-level). Using it in -> an auxiliaru function will cause an error. +> only allowed at the entrypoint level, that is, at the +> top-level. Using it in an embedded function will cause an error. diff --git a/gitlab-pages/docs/language-basics/types.md b/gitlab-pages/docs/language-basics/types.md index 6654e7a3b..ace3e8794 100644 --- a/gitlab-pages/docs/language-basics/types.md +++ b/gitlab-pages/docs/language-basics/types.md @@ -3,10 +3,10 @@ id: types title: Types --- -LIGO is strongly and statically typed. This means that the compiler -checks your program at compilation time and, if it passes the tests, -this ensures that there will be no runtime error due to wrong -assumptions on the data. This is called *type checking*. +*LIGO is strongly and statically typed.* This means that the compiler +checks how your contract processes data. If it passes the test, your +contract will not fail at run-time due to inconsistent assumptions on +your data. This is called *type checking*. LIGO types are built on top of Michelson's type system. @@ -23,7 +23,7 @@ alias a string type as an animal breed - this will allow us to comunicate our intent with added clarity. - + ```pascaligo group=a type breed is string const dog_breed : breed = "Saluki" @@ -51,15 +51,14 @@ let dog_breed : breed = "Saluki"; ## Simple types - + ```pascaligo group=b // The type accountBalances denotes maps from addresses to tez type account_balances is map (address, tez) const ledger : account_balances = - map - [("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> 10mutez] + map [("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> 10mutez] ``` @@ -99,19 +98,22 @@ below you can see the definition of data types for a ledger that keeps the balance and number of previous transactions for a given account. - + ```pascaligo group=c // Type aliasing + type account is address type number_of_transactions is nat // The type account_data is a record with two fields. + type account_data is record [ balance : tez; transactions : number_of_transactions ] // A ledger is a map from accounts to account_data + type ledger is map (account, account_data) const my_ledger : ledger = map [ @@ -126,14 +128,19 @@ const my_ledger : ledger = map [ ```cameligo group=c // Type aliasing + type account = address type number_of_transactions = nat + // The type account_data is a record with two fields. + type account_data = { balance : tez; transactions : number_of_transactions } + // A ledger is a map from accounts to account_data + type ledger = (account, account_data) map let my_ledger : ledger = Map.literal @@ -144,16 +151,19 @@ let my_ledger : ledger = Map.literal ```reasonligo group=c // Type aliasing + type account = address; type number_of_transactions = nat; // The type account_data is a record with two fields. + type account_data = { balance : tez, transactions : number_of_transactions }; // A ledger is a map from accounts to account_data + type ledger = map (account, account_data); let my_ledger : ledger = @@ -173,19 +183,91 @@ exclusive to each other). ## Annotations In certain cases, the type of an expression cannot be properly -inferred by the compiler. In order to help the type checke, you can +inferred by the compiler. In order to help the type checker, you can annotate an expression with its desired type. Here is an example: - -```pascaligo -type int_map is map (int, int) -function get_first (const my_map : int_map): option (int) is my_map[1] + +```pascaligo group=d +type parameter is Back | Claim | Withdraw -// The empty map always needs a type annotation +type storage is + record + owner : address; + goal : tez; + deadline : timestamp; + backers : map (address, tez); + funded : bool + end -const first : option (int) = get_first (((map end) : int_map)) +type return is list (operation) * storage + +function back (var action : unit; var store : storage) : return is + begin + if now > store.deadline then + failwith ("Deadline passed.") + else case store.backers[sender] of + None -> store.backers[sender] := amount + | Some (x) -> skip + end + end with ((nil : list (operation)), store) // Annotation +``` + + +```cameligo group=d +type parameter = Back | Claim | Withdraw + +type storage = { + owner : address; + goal : tez; + deadline : timestamp; + backers : (address, tez) map; + funded : bool +} + +type return = operation list * storage + +let back (param, store : unit * storage) : return = + let no_op : operation list = [] in + if Current.time > store.deadline then + (failwith "Deadline passed." : return) // Annotation + else + match Map.find_opt sender store.backers with + None -> + let backers = Map.update sender (Some amount) store.backers + in no_op, {store with backers=backers} + | Some (x) -> no_op, store +``` + + +```reasonligo group=d +type parameter = | Back | Claim | Withdraw; + +type storage = { + owner : address, + goal : tez, + deadline : timestamp, + backers : map (address, tez), + funded : bool, +}; + +type return = (list (operation), storage); + +let back = ((param, store) : (unit, storage)) : return => { + let no_op : list (operation) = []; + if (Current.time > store.deadline) { + (failwith ("Deadline passed.") : return); // Annotation + } + else { + switch (Map.find_opt (sender, store.backers)) { + | None => { + let backers = Map.update (sender, Some (amount), store.backers); + (no_op, {...store, backers:backers}) } + | Some (x) => (no_op, store) + } + } +}; ``` diff --git a/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md b/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md index 3243750cc..ff497a6b3 100644 --- a/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md +++ b/gitlab-pages/docs/language-basics/unit-option-pattern-matching.md @@ -10,21 +10,18 @@ features it as well. Both the option type and the unit types are instances of a more general kind of types: *variant types* (sometimes called *sum types*). -## The unit type +## The unit Type The `unit` type in Michelson or LIGO is a predefined type that contains only one value that carries no information. It is used when no relevant information is required or produced. Here is how it used. -> 💡 Units come in handy when we try pattern matching on custom -> variants below. - - + In PascaLIGO, the unique value of the `unit` type is `Unit`. ```pascaligo group=a -const n : unit = Unit +const n : unit = Unit // Note the capital letter ``` @@ -56,11 +53,11 @@ Here is how we define a coin as being either head or tail (and nothing else): - + ```pascaligo group=b type coin is Head | Tail -const head : coin = Head (Unit) // Unit needed because of a bug -const tail : coin = Tail (Unit) // Unit needed because of a bug +const head : coin = Head (Unit) // Unit needed for now. +const tail : coin = Tail (Unit) // Unit needed for now. ``` @@ -87,7 +84,7 @@ define different kinds of users of a system. - + ```pascaligo group=c type id is nat @@ -128,9 +125,6 @@ let g : user = Guest; -Defining a variant can be extremely useful for building semantically -appealing contracts. We will learn how to use variants for "logic -purposes"' shortly. ## Optional values @@ -143,7 +137,7 @@ meaningful value *of any type*. An example in arithmetic is the division operation: - + ```pascaligo group=d function div (const a : nat; const b : nat) : option (nat) is if b = 0n then (None: option (nat)) else Some (a/b) @@ -169,10 +163,10 @@ let div = ((a, b) : (nat, nat)) : option (nat) => *Pattern matching* is similiar to the `switch` construct in Javascript, and can be used to route the program's control flow based on the value of a variant. Consider for example the definition of a -function `flip` that flips a coin, as defined above. +function `flip` that flips a coin. - + ```pascaligo group=e type coin is Head | Tail diff --git a/gitlab-pages/docs/language-basics/variables-and-constants.md b/gitlab-pages/docs/language-basics/variables-and-constants.md index 87f2ab109..5c3c4ede2 100644 --- a/gitlab-pages/docs/language-basics/variables-and-constants.md +++ b/gitlab-pages/docs/language-basics/variables-and-constants.md @@ -13,7 +13,7 @@ declaration. When defining a constant you need to provide a `name`, `type` and a `value`: - + ```pascaligo group=a const age : int = 25 ``` @@ -53,14 +53,11 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/variables-and-constant ## Variables - + -Variables, unlike constants, are mutable. They cannot be declared in a -*global scope*, but they can be declared and used within functions, or -as function parameters. - -> 💡 Do not worry if you do not understand the function syntax yet. We -> will get to it in upcoming sections of this documentation. +Variables, unlike constants, are *mutable*. They cannot be declared in +a *global scope*, but they can be declared and used within functions, +or as function parameters. > ⚠️ Please be wary that mutation only works within the function scope > itself, values outside of the function scope will not be affected. @@ -68,7 +65,7 @@ as function parameters. ```pascaligo group=b // The following is invalid: use `const` for global values instead. -// var four : int = 4 +// var four : int := 4 function add (const a : int; const b : int) : int is block { @@ -90,11 +87,8 @@ ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/ As expected in the pure subset of a functional language, CameLIGO only -features constant values: once they are declared, the value cannot be -changed (or "mutated"). - -> 💡 Do not worry if you do not understand the function syntax yet. We -> will get to it in upcoming sections of this documentation. +features *constant values*: once they are declared, the value cannot +be changed (or "mutated"). ```cameligo group=c let add (a : int) (b : int) : int = @@ -110,12 +104,9 @@ ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/ As expected in the pure subset of a functional language, ReasonLIGO -only features constant values: once they are declared, the value +only features *constant values*: once they are declared, the value cannot be changed (or "mutated"). -> 💡 Do not worry if you do not understand the function syntax yet. We -> will get to it in upcoming sections of this documentation. - ```reasonligo group=c let add = ((a, b): (int, int)): int => { let c : int = a + b; diff --git a/gitlab-pages/website/core/CodeExamples.js b/gitlab-pages/website/core/CodeExamples.js index 4ace23b4e..9cdf27c1c 100644 --- a/gitlab-pages/website/core/CodeExamples.js +++ b/gitlab-pages/website/core/CodeExamples.js @@ -3,68 +3,83 @@ const React = require('react'); const pre = '```'; const PASCALIGO_EXAMPLE = `${pre}pascaligo -// variant defining pseudo multi-entrypoint actions -type action is -| Increment of int +type storage is int + +type parameter is + Increment of int | Decrement of int +| Reset -function add (const a : int ; const b : int) : int is a + b +type return is list (operation) * storage -function subtract (const a : int ; const b : int) : int is a - b +// Two entrypoints -// real entrypoint that re-routes the flow based on the action provided -function main (const p : action ; const s : int) : (list(operation) * int) is - ((nil : list(operation)), - case p of - | Increment (n) -> add (s, n) - | Decrement (n) -> subtract (s, n) - end) +function add (const store : storage; const delta : int) : storage is store + delta +function sub (const store : storage; const delta : int) : storage is store - delta + +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) + +function main (const action : parameter; const store : storage) : return is + ((nil : list (operation)), // No operations + case action of + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0 + end) ${pre}`; const CAMELIGO_EXAMPLE = `${pre}ocaml type storage = int -(* variant defining pseudo multi-entrypoint actions *) - -type action = -| Increment of int +type parameter = + Increment of int | Decrement of int +| Reset -let add (a,b: int * int) : int = a + b -let sub (a,b: int * int) : int = a - b +type return = operation list * storage -(* real entrypoint that re-routes the flow based on the action provided *) +// Two entrypoints -let main (p,s: action * storage) = - let storage = - match p with - | Increment n -> add (s, n) - | Decrement n -> sub (s, n) - in ([] : operation list), storage +let add (store, delta : storage * int) : storage = store + delta +let sub (store, delta : storage * int) : storage = store - delta + +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) + +let main (action, store : parameter * storage) : return = + ([] : operation list), // No operations + (match action with + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0) ${pre}`; const REASONLIGO_EXAMPLE = `${pre}reasonligo type storage = int; -/* variant defining pseudo multi-entrypoint actions */ +type parameter = + Increment (int) +| Decrement (int) +| Reset; -type action = - | Increment(int) - | Decrement(int); +type return = (list (operation), storage); -let add = ((a,b): (int, int)): int => a + b; -let sub = ((a,b): (int, int)): int => a - b; +(* Two entrypoints *) -/* real entrypoint that re-routes the flow based on the action provided */ +let add = ((store, delta) : (storage, int)) : storage => store + delta; +let sub = ((store, delta) : (storage, int)) : storage => store - delta; -let main = ((p,storage): (action, storage)) => { - let storage = - switch (p) { - | Increment(n) => add((storage, n)) - | Decrement(n) => sub((storage, n)) - }; - ([]: list(operation), storage); +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) + +let main = ((action, store) : (parameter, storage)) : return => { + (([] : list (operation)), // No operations + (switch (action) { + | Increment (n) => add ((store, n)) + | Decrement (n) => sub ((store, n)) + | Reset => 0})) }; ${pre}`; diff --git a/gitlab-pages/website/pages/en/index.js b/gitlab-pages/website/pages/en/index.js index a9bc41277..9bbddcb17 100644 --- a/gitlab-pages/website/pages/en/index.js +++ b/gitlab-pages/website/pages/en/index.js @@ -6,14 +6,14 @@ const docUrl = require(`${process.cwd()}/core/UrlUtils`).docUrl; const FEATURES = [ { image: 'img/strong-type-system.svg', - title: 'Strong Type System', + title: 'Strong, Static Type System', content: 'Write types, then code. Benefit from the safety of type systems.' }, { image: 'img/syntax-agnostic.svg', - title: 'Syntax Agnostic', + title: 'Polyglot', content: - 'Code in your language. Write PascaLIGO, CameLIGO, or add your own syntax.' + 'Code in your language. Write PascaLIGO, CameLIGO, ReasonLIGO or add your own syntax.' }, { image: 'img/easy-integration.svg', @@ -77,7 +77,7 @@ module.exports = props => {
-

A friendly smart-contract language for Tezos

+

A friendly Smart Contract Language for Tezos

Michelson was never so easy

diff --git a/gitlab-pages/website/siteConfig.js b/gitlab-pages/website/siteConfig.js index c42f07a31..b0f7d419c 100644 --- a/gitlab-pages/website/siteConfig.js +++ b/gitlab-pages/website/siteConfig.js @@ -4,7 +4,7 @@ let reasonHighlightJs = require('reason-highlightjs'); const siteConfig = { title: 'LIGO', // Title for your website. - tagline: 'LIGO is a friendly smart-contract language for Tezos', + tagline: 'LIGO, the friendly Smart Contract Language for Tezos', taglineSub: 'Michelson was never so easy', url: 'https://ligolang.org', // Your website URL baseUrl: '/', // Base URL for your project */ @@ -14,7 +14,7 @@ const siteConfig = { // Used for publishing and more projectName: 'ligo', - organizationName: 'marigold', + organizationName: 'TBN', // For top-level user or org sites, the organization is still the same. // e.g., for the https://JoelMarcey.github.io site, it would be set like... // organizationName: 'JoelMarcey' @@ -87,10 +87,11 @@ const siteConfig = { beginKeywords: '', keywords: { keyword: - 'and begin block case const contains down else end fail for ' + - 'from function if in is list map mod nil not of or patch ' + - 'procedure record remove set skip step then to type var while with', - literal: 'true false unit int string some none bool nat list' + 'and attributes begin big_map block case const contains else' + + ' end False for from function if in is list map mod nil' + + ' not of or patch record remove set skip then to True type' + + ' var while with', + literal: 'true false unit int string Some None bool nat list' }, lexemes: '[a-zA-Z][a-zA-Z0-9_]*', contains: [ diff --git a/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md b/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md index 3b3820ef0..805f45c40 100644 --- a/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md +++ b/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md @@ -4,8 +4,8 @@ title: Origin original_id: origin --- -LIGO is a programming language that aims to provide developers with an uncomplicated and safer way to implement smart-contracts. LIGO is currently being implemented for the Tezos blockchain and as a result, it compiles down to Michelson - the native smart-contract language of Tezos. +LIGO is a programming language that aims to provide developers with an uncomplicated and safe way to implement smart-contracts. Since it is being implemented for the Tezos blockchain LIGO compiles to Michelson—the native smart-contract language of Tezos. > Smart-contracts are programs that run within a blockchain network. -LIGO was initially meant to be a language for developing Marigold, on top of a hacky framework called Meta-Michelson. However, due to the attention received by the Tezos community, a decision has been put into action to develop LIGO as a standalone language that will support Tezos directly as well. \ No newline at end of file +LIGO was meant to be a language for developing Marigold on top of a hacky framework called Meta-Michelson. However, due to the attention received by the Tezos community, LIGO is now a standalone language being developed to support Tezos directly. \ No newline at end of file diff --git a/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md b/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md index 349c6d131..1d2dc2e3c 100644 --- a/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md +++ b/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md @@ -4,23 +4,22 @@ title: Philosophy original_id: philosophy --- -To understand LIGO’s design choices, it’s important to get its philosophy. There are two main concerns that we have in mind when building LIGO. - - +To understand LIGO’s design choices it’s important to understand its philosophy. We have two main concerns in mind while building LIGO. ## Safety Once a smart-contract is deployed, it will likely be impossible to change it. You must get it right on the first try, and LIGO should help as much as possible. There are multiple ways to make LIGO a safer language for smart-contracts. ### Automated Testing -Automated Testing is the process through which a program will run some other program, and check that this other program behaves correctly. +Automated Testing is the process through which a program runs another program, and checks that this other program behaves correctly. + There already is a testing library for LIGO programs written in OCaml that is used to test LIGO itself. Making it accessible to users will greatly improve safety. A way to do so would be to make it accessible from within LIGO. ### Static Analysis Static analysis is the process of having a program analyze another one. -For instance, type systems are a kind of static analysis through which it is possible to find lots of bugs. There is already a fairly simple type system in LIGO, and we plan to make it much stronger. +For instance, type systems are a kind of static analysis through which it is possible to find lots of bugs. LIGO already has a simple type system, and we plan to make it much stronger. ### Conciseness -Writing less code gives you less room to introduce errors and that's why LIGO encourages writing lean rather than chunky smart-contracts. +Writing less code gives you less room to introduce errors. That's why LIGO encourages writing lean rather than chunky smart-contracts. --- diff --git a/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json b/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json index e74ff6d36..07fc287dd 100644 --- a/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json +++ b/gitlab-pages/website/versioned_sidebars/version-next-sidebars.json @@ -6,15 +6,27 @@ "version-next-intro/editor-support" ], "Language Basics": [ - "version-next-language-basics/cheat-sheet", "version-next-language-basics/types", - "version-next-language-basics/variables", + "version-next-language-basics/constants-and-variables", + "version-next-language-basics/math-numbers-tez", + "version-next-language-basics/strings", "version-next-language-basics/functions", - "version-next-language-basics/entrypoints", - "version-next-language-basics/operators" + "version-next-language-basics/boolean-if-else", + "version-next-language-basics/loops", + "version-next-language-basics/unit-option-pattern-matching", + "version-next-language-basics/maps-records", + "version-next-language-basics/sets-lists-tuples", + "version-next-language-basics/tezos-specific" + ], + "Advanced": [ + "version-next-advanced/timestamps-addresses", + "version-next-advanced/entrypoints-contracts", + "version-next-advanced/include", + "version-next-advanced/first-contract" ], "API": [ - "version-next-api-cli-commands" + "version-next-api/cli-commands", + "version-next-api/cheat-sheet" ] }, "version-next-contributors-docs": { diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index be1196ad1..42aa97936 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -32,7 +32,7 @@ module Simplify = struct - The left-hand-side is the reserved name in the given front-end. - The right-hand-side is the name that will be used in the AST. *) - let unit_expr = make_t @@ T_constant TC_unit + let unit_expr = make_t @@ T_constant TC_unit let type_constants s = match s with @@ -185,6 +185,7 @@ module Simplify = struct | "Set.literal" -> ok C_SET_LITERAL | "Set.add" -> ok C_SET_ADD | "Set.remove" -> ok C_SET_REMOVE + | "Set.iter" -> ok C_SET_ITER | "Set.fold" -> ok C_SET_FOLD | "Set.size" -> ok C_SIZE @@ -1152,7 +1153,7 @@ module Compiler = struct | C_CONCAT -> ok @@ simple_binary @@ prim I_CONCAT | C_CHAIN_ID -> ok @@ simple_constant @@ prim I_CHAIN_ID | _ -> simple_fail @@ Format.asprintf "operator not implemented for %a" Stage_common.PP.constant c - + (* Some complex operators will need to be added in compiler/compiler_program. From 541728fc6c9263d0a92606cc8f456214062ff2cc Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Mon, 10 Feb 2020 19:27:58 +0100 Subject: [PATCH 052/119] First batch of rewritten contracts (PascaLIGO). --- src/passes/operators/operators.ml | 4 +- src/test/contracts/address.ligo | 6 +- src/test/contracts/annotation.ligo | 2 +- src/test/contracts/application.ligo | 22 +- src/test/contracts/arithmetic.ligo | 21 +- src/test/contracts/assign.ligo | 6 +- src/test/contracts/attributes.ligo | 12 +- src/test/contracts/bad_timestamp.ligo | 10 +- src/test/contracts/bad_type_operator.ligo | 11 +- src/test/contracts/balance_constant.ligo | 11 +- src/test/contracts/big_map.ligo | 39 ++- src/test/contracts/bitwise_arithmetic.ligo | 9 +- src/test/contracts/blockless.ligo | 3 +- src/test/contracts/boolean_operators.ligo | 15 +- src/test/contracts/bytes_arithmetic.ligo | 9 +- src/test/contracts/bytes_unpack.ligo | 18 +- src/test/contracts/chain_id.ligo | 6 +- src/test/contracts/check_signature.ligo | 6 +- src/test/contracts/closure-1.ligo | 5 +- src/test/contracts/closure-2.ligo | 9 +- src/test/contracts/closure-3.ligo | 16 +- src/test/contracts/closure.ligo | 8 +- src/test/contracts/coase.ligo | 161 +++++----- src/test/contracts/condition-simple.ligo | 11 +- src/test/contracts/condition.ligo | 20 +- src/test/contracts/counter.ligo | 9 +- src/test/contracts/crypto.ligo | 4 +- src/test/contracts/declaration-local.ligo | 2 +- src/test/contracts/declarations.ligo | 7 +- src/test/contracts/deep_access.ligo | 52 ++-- src/test/contracts/dispatch-counter.ligo | 27 +- src/test/contracts/double_main.ligo | 17 +- src/test/contracts/empty_case.ligo | 16 +- src/test/contracts/entrypoints.ligo | 23 +- src/test/contracts/evaluation_tests.ligo | 12 +- src/test/contracts/failwith.ligo | 58 ++-- src/test/contracts/for_fail.ligo | 11 +- src/test/contracts/function-complex.ligo | 12 +- src/test/contracts/function-shared.ligo | 9 +- src/test/contracts/function.ligo | 5 +- src/test/contracts/get_contract.ligo | 21 +- src/test/contracts/heap-instance.ligo | 6 +- src/test/contracts/heap.ligo | 156 +++++----- src/test/contracts/high-order.ligo | 36 +-- src/test/contracts/implicit_account.ligo | 2 +- src/test/contracts/isnat.ligo | 3 +- src/test/contracts/key_hash.ligo | 12 +- src/test/contracts/lambda.ligo | 8 +- src/test/contracts/list.ligo | 60 ++-- src/test/contracts/loop.ligo | 329 ++++++++++---------- src/test/contracts/map.ligo | 72 ++--- src/test/contracts/match.ligo | 28 +- src/test/contracts/multiple-parameters.ligo | 16 +- src/test/contracts/multisig-v2.ligo | 218 +++++++------ src/test/contracts/multisig.ligo | 82 ++--- 55 files changed, 862 insertions(+), 891 deletions(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 49f693030..df11d2400 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -32,7 +32,7 @@ module Simplify = struct - The left-hand-side is the reserved name in the given front-end. - The right-hand-side is the name that will be used in the AST. *) - let unit_expr = make_t @@ T_constant TC_unit + let unit_expr = make_t @@ T_constant TC_unit let type_constants s = match s with @@ -1157,7 +1157,7 @@ module Compiler = struct | C_CONCAT -> ok @@ simple_binary @@ prim I_CONCAT | C_CHAIN_ID -> ok @@ simple_constant @@ prim I_CHAIN_ID | _ -> simple_fail @@ Format.asprintf "operator not implemented for %a" Stage_common.PP.constant c - + (* Some complex operators will need to be added in compiler/compiler_program. diff --git a/src/test/contracts/address.ligo b/src/test/contracts/address.ligo index 2113bc7ac..59d5bff4c 100644 --- a/src/test/contracts/address.ligo +++ b/src/test/contracts/address.ligo @@ -1,5 +1,5 @@ -// function main (const c: contract(unit)) : address is address(c) +// function main (const c : contract (unit)) : address is address (c) function main (const p : key_hash) : address is block { - const c : contract(unit) = implicit_account(p) ; -} with address(c) \ No newline at end of file + const c : contract (unit) = implicit_account (p); +} with address (c) \ No newline at end of file diff --git a/src/test/contracts/annotation.ligo b/src/test/contracts/annotation.ligo index 58fd3e8bc..aaff23336 100644 --- a/src/test/contracts/annotation.ligo +++ b/src/test/contracts/annotation.ligo @@ -1,6 +1,6 @@ (* Test that a string is cast to an address given a type annotation *) -const lst : list(int) = list [] +const lst : list (int) = list [] const my_address : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) diff --git a/src/test/contracts/application.ligo b/src/test/contracts/application.ligo index 32a92701d..a36e86391 100644 --- a/src/test/contracts/application.ligo +++ b/src/test/contracts/application.ligo @@ -1,21 +1,13 @@ // Test different ways of calling functions in PascaLIGO -type foo is record - bar : int -> int ; -end +type foo is record [bar : int -> int] -function f (const i : int) : int is - begin - skip - end with i +function f (const i : int) : int is i -function g (const i : unit) : int -> int is - begin skip end with f +function g (const i : unit) : int -> int is f -const r : foo = record - bar = f ; -end +const r : foo = record [bar = f] -const x : int = f(42) -const y : int = r.bar(42) -const z : int = (g(unit))(42) +const x : int = f (42) +const y : int = r.bar (42) +const z : int = (g (unit))(42) diff --git a/src/test/contracts/arithmetic.ligo b/src/test/contracts/arithmetic.ligo index 1040aeebf..de3dc14ae 100644 --- a/src/test/contracts/arithmetic.ligo +++ b/src/test/contracts/arithmetic.ligo @@ -1,22 +1,15 @@ // Test PascaLIGO arithmetic operators -function mod_op (const n : int) : nat is - begin skip end with n mod 42 +function mod_op (const n : int) : nat is n mod 42 -function plus_op (const n : int) : int is - begin skip end with n + 42 +function plus_op (const n : int) : int is n + 42 -function minus_op (const n : int) : int is - begin skip end with n - 42 +function minus_op (const n : int) : int is n - 42 -function times_op (const n : int) : int is - begin skip end with n * 42 +function times_op (const n : int) : int is n * 42 -function div_op (const n : int) : int is - begin skip end with n / 2 +function div_op (const n : int) : int is n / 2 -function int_op (const n : nat) : int is - block { skip } with int(n) +function int_op (const n : nat) : int is int (n) -function neg_op (const n : int) : int is - begin skip end with -n +function neg_op (const n : int) : int is -n diff --git a/src/test/contracts/assign.ligo b/src/test/contracts/assign.ligo index d882d0e40..6c6de5351 100644 --- a/src/test/contracts/assign.ligo +++ b/src/test/contracts/assign.ligo @@ -1,4 +1,4 @@ function main (const i : int) : int is - begin - i := i + 1 ; - end with i + block { + i := i + 1 + } with i diff --git a/src/test/contracts/attributes.ligo b/src/test/contracts/attributes.ligo index 561e8f5ff..2248d31be 100644 --- a/src/test/contracts/attributes.ligo +++ b/src/test/contracts/attributes.ligo @@ -1,19 +1,19 @@ const x : int = 1; attributes ["inline"] function foo (const a : int) : int is - begin + block { const test : int = 2 + a; attributes ["inline"]; - end with test; + } with test; attributes ["inline"]; const y : int = 1; attributes ["inline"; "other"] function bar (const b : int) : int is - begin + block { function test (const z : int) : int is - begin + block { const r : int = 2 + b + z - end with r; + } with r; attributes ["inline"; "foo"; "bar"] - end with test(b) + } with test (b) diff --git a/src/test/contracts/bad_timestamp.ligo b/src/test/contracts/bad_timestamp.ligo index 42850560d..8be6968e2 100644 --- a/src/test/contracts/bad_timestamp.ligo +++ b/src/test/contracts/bad_timestamp.ligo @@ -1,7 +1,9 @@ -type storage_ is timestamp +type parameter is unit +type storage is timestamp +type return is list (operation) * storage -function main(const p : unit; const s : storage_) : list(operation) * storage_ is +function main (const p : parameter; const s : storage) : return is block { - var toto : timestamp := ("badtimestamp" : timestamp); + var stamp : timestamp := ("badtimestamp" : timestamp) } - with ((nil: list(operation)), toto) \ No newline at end of file + with ((nil: list(operation)), stamp) diff --git a/src/test/contracts/bad_type_operator.ligo b/src/test/contracts/bad_type_operator.ligo index eff64ad66..328cf2f1e 100644 --- a/src/test/contracts/bad_type_operator.ligo +++ b/src/test/contracts/bad_type_operator.ligo @@ -1,4 +1,9 @@ -type t is (nat * nat) -type s is map(t) +type parameter is unit -function main (const u : unit; const s : s) : (list(operation) * s) is ((nil : list(operation)), s) +type binding is nat * nat +type storage is map (binding) + +type return is list (operation) * storage + +function main (const param : parameter; const store : storage) : return is + ((nil : list (operation)), store) diff --git a/src/test/contracts/balance_constant.ligo b/src/test/contracts/balance_constant.ligo index cbe69d3c1..6a5af3fe4 100644 --- a/src/test/contracts/balance_constant.ligo +++ b/src/test/contracts/balance_constant.ligo @@ -1,11 +1,12 @@ -(** - +(* This test makes sure that the balance is accessible in PascaLIGO. -It's there to detect a regression of: https://gitlab.com/ligolang/ligo/issues/68 +It is meant to detect the regression detailled in the following issue: https://gitlab.com/ligolang/ligo/issues/68 *) +type parameter is unit type storage is tez +type return is list (operation) * storage -function main (const p : unit; const s: tez) : list(operation) * storage is - ((nil : list(operation)), balance) +function main (const param : parameter; const store: storage) : return is + ((nil : list (operation)), balance) diff --git a/src/test/contracts/big_map.ligo b/src/test/contracts/big_map.ligo index e6ab78c58..1a6dcfab0 100644 --- a/src/test/contracts/big_map.ligo +++ b/src/test/contracts/big_map.ligo @@ -1,36 +1,35 @@ -type storage_ is big_map(int, int) * unit -type foo is big_map(int, int) +type parameter is unit +type storage is big_map (int, int) * unit +type return is list (operation) * storage -function main(const p : unit; const s : storage_) : list(operation) * storage_ is +function main (const p : parameter; const s : storage) : return is block { - var toto : option (int) := Some(0); + var toto : option (int) := Some (0); toto := s.0[23]; - s.0[2] := 444; + s.0[2] := 444 } with ((nil: list(operation)), s) -function set_ (var n : int ; var m : foo) : foo is block { - m[23] := n ; +type foo is big_map (int, int) + +function set_ (var n : int; var m : foo) : foo is block { + m[23] := n } with m function rm (var m : foo) : foo is block { - remove 42 from map m; + remove 42 from map m } with m -function gf (const m : foo) : int is begin skip end with get_force(23, m) +function gf (const m : foo) : int is get_force (23, m) -function get (const m : foo) : option(int) is begin skip end with m[42] +function get (const m : foo) : option (int) is m[42] -const empty_big_map : big_map(int,int) = big_map end +const empty_big_map : big_map (int,int) = big_map [] -const big_map1 : big_map(int,int) = big_map - 23 -> 0 ; - 42 -> 0 ; -end +const big_map1 : big_map (int,int) = big_map [23 -> 0; 42 -> 0] -function mutimaps (const m : foo ; const n : foo) : foo is block -{ - var bar : foo := m ; - bar[42] := 0 ; - n[42] := get_force(42, bar) ; +function mutimaps (const m : foo; const n : foo) : foo is block { + var bar : foo := m; + bar[42] := 0; + n[42] := get_force (42, bar) } with n diff --git a/src/test/contracts/bitwise_arithmetic.ligo b/src/test/contracts/bitwise_arithmetic.ligo index 282b82be9..5e814c2c0 100644 --- a/src/test/contracts/bitwise_arithmetic.ligo +++ b/src/test/contracts/bitwise_arithmetic.ligo @@ -1,10 +1,7 @@ // Test PascaLIGO bitwise operators -function or_op (const n : nat) : nat is - begin skip end with bitwise_or(n , 4n) +function or_op (const n : nat) : nat is bitwise_or (n, 4n) -function and_op (const n : nat) : nat is - begin skip end with bitwise_and(n , 7n) +function and_op (const n : nat) : nat is bitwise_and (n, 7n) -function xor_op (const n : nat) : nat is - begin skip end with bitwise_xor(n , 7n) +function xor_op (const n : nat) : nat is bitwise_xor (n, 7n) diff --git a/src/test/contracts/blockless.ligo b/src/test/contracts/blockless.ligo index 103b926f0..94dddc8dd 100644 --- a/src/test/contracts/blockless.ligo +++ b/src/test/contracts/blockless.ligo @@ -1,2 +1 @@ -function blockless (const n: int) : int is - n + 10; +function blockless (const n : int) : int is n + 10 diff --git a/src/test/contracts/boolean_operators.ligo b/src/test/contracts/boolean_operators.ligo index 0d88c0f03..122894d25 100644 --- a/src/test/contracts/boolean_operators.ligo +++ b/src/test/contracts/boolean_operators.ligo @@ -1,16 +1,11 @@ // Test PascaLIGO boolean operators -function or_true (const b : bool) : bool is - begin skip end with b or True +function or_true (const b : bool) : bool is b or True -function or_false (const b : bool) : bool is - begin skip end with b or False +function or_false (const b : bool) : bool is b or False -function and_true (const b : bool) : bool is - begin skip end with b and True +function and_true (const b : bool) : bool is b and True -function and_false (const b : bool) : bool is - begin skip end with b and False +function and_false (const b : bool) : bool is b and False -function not_bool (const b: bool) : bool is - begin skip end with not b +function not_bool (const b : bool) : bool is not b diff --git a/src/test/contracts/bytes_arithmetic.ligo b/src/test/contracts/bytes_arithmetic.ligo index 8b9251f93..6d39dd4c9 100644 --- a/src/test/contracts/bytes_arithmetic.ligo +++ b/src/test/contracts/bytes_arithmetic.ligo @@ -1,8 +1,5 @@ -function concat_op (const s : bytes) : bytes is - begin skip end with bytes_concat(s , 0x7070) +function concat_op (const s : bytes) : bytes is bytes_concat (s, 0x7070) -function slice_op (const s : bytes) : bytes is - begin skip end with bytes_slice(1n , 2n , s) +function slice_op (const s : bytes) : bytes is bytes_slice (1n, 2n, s) -function hasherman (const s : bytes) : bytes is - begin skip end with sha_256(s) +function hasherman (const s : bytes) : bytes is sha_256 (s) diff --git a/src/test/contracts/bytes_unpack.ligo b/src/test/contracts/bytes_unpack.ligo index c6b087635..e57ace2ab 100644 --- a/src/test/contracts/bytes_unpack.ligo +++ b/src/test/contracts/bytes_unpack.ligo @@ -1,11 +1,11 @@ -function id_string (const p : string) : option(string) is block { - const packed : bytes = bytes_pack(p) ; -} with (bytes_unpack(packed): option(string)) +function id_string (const p : string) : option (string) is block { + const packed : bytes = bytes_pack (p) +} with (bytes_unpack (packed) : option (string)) -function id_int (const p : int) : option(int) is block { - const packed : bytes = bytes_pack(p) ; -} with (bytes_unpack(packed): option(int)) +function id_int (const p : int) : option (int) is block { + const packed : bytes = bytes_pack (p) +} with (bytes_unpack (packed) : option (int)) -function id_address (const p : address) : option(address) is block { - const packed : bytes = bytes_pack(p) ; -} with (bytes_unpack(packed): option(address)) \ No newline at end of file +function id_address (const p : address) : option (address) is block { + const packed : bytes = bytes_pack (p) +} with (bytes_unpack (packed) : option (address)) diff --git a/src/test/contracts/chain_id.ligo b/src/test/contracts/chain_id.ligo index 7372d8ecc..353ba4a45 100644 --- a/src/test/contracts/chain_id.ligo +++ b/src/test/contracts/chain_id.ligo @@ -1,5 +1 @@ - -function chain_id (const tt : chain_id) : chain_id is - block { - var toto : chain_id := get_chain_id ; - } with ( toto ) \ No newline at end of file +function chain_id (const tt : chain_id) : chain_id is get_chain_id diff --git a/src/test/contracts/check_signature.ligo b/src/test/contracts/check_signature.ligo index 231b726ea..97de04bd2 100644 --- a/src/test/contracts/check_signature.ligo +++ b/src/test/contracts/check_signature.ligo @@ -1,2 +1,4 @@ -function check_signature (const pk: key; const signed: signature; const msg: bytes) : bool is - crypto_check(pk, signed, msg) +function check_signature (const pk : key; + const signed : signature; + const msg: bytes) : bool +is crypto_check (pk, signed, msg) diff --git a/src/test/contracts/closure-1.ligo b/src/test/contracts/closure-1.ligo index 420c888c9..4403b8d2e 100644 --- a/src/test/contracts/closure-1.ligo +++ b/src/test/contracts/closure-1.ligo @@ -1,5 +1,4 @@ function foo (const i : int) : int is block { - function bar (const j : int) : int is - i + j ; - } with bar (i) + function add (const j : int) : int is i+j + } with add (i) diff --git a/src/test/contracts/closure-2.ligo b/src/test/contracts/closure-2.ligo index 5e84645e6..aa741ecd2 100644 --- a/src/test/contracts/closure-2.ligo +++ b/src/test/contracts/closure-2.ligo @@ -1,6 +1,5 @@ -function foobar(const i : int) : int is +function foobar (const i : int) : int is block { - const j : int = 3 ; - function toto(const k : int) : int is - i + j + k ; - } with toto(42) + const j : int = 3; + function add (const k : int) : int is i+j+k + } with add (42) diff --git a/src/test/contracts/closure-3.ligo b/src/test/contracts/closure-3.ligo index a23cdbb22..ae4e68956 100644 --- a/src/test/contracts/closure-3.ligo +++ b/src/test/contracts/closure-3.ligo @@ -1,12 +1,10 @@ -// This might seem like it's covered by induction with closure-2.ligo -// But it exists to prevent a regression on the bug patched by: +// This might seem like it is covered by induction with closure-2.ligo, +// but it exists to prevent a regression on the bug patched by: // https://gitlab.com/ligolang/ligo/commit/faf3bbc06106de98189f1c1673bd57e78351dc7e -function foobar(const i : int) : int is +function foobar (const i : int) : int is block { - const j : int = 3 ; - const k : int = 4 ; - function toto(const l : int) : int is - i + j + k + l; - - } with toto(42) + const j : int = 3; + const k : int = 4; + function add (const l : int) : int is i+j+k+l + } with add (42) diff --git a/src/test/contracts/closure.ligo b/src/test/contracts/closure.ligo index ccb8a5e8c..6cc7f19cd 100644 --- a/src/test/contracts/closure.ligo +++ b/src/test/contracts/closure.ligo @@ -1,7 +1,5 @@ function toto (const i : int) : int is block { - function tata (const j : int) : int is - i + j ; - function titi (const j : int) : int is - i + j ; - } with tata(i) + titi(i) + function tata (const j : int) : int is i+j; + function titi (const j : int) : int is i+j + } with tata (i) + titi (i) diff --git a/src/test/contracts/coase.ligo b/src/test/contracts/coase.ligo index 04b891c7d..fd870b7a8 100644 --- a/src/test/contracts/coase.ligo +++ b/src/test/contracts/coase.ligo @@ -1,98 +1,113 @@ // Copyright Coase, Inc 2019 type card_pattern_id is nat + type card_pattern is record [ - coefficient : tez ; - quantity : nat ; + coefficient : tez; + quantity : nat ] -type card_patterns is map(card_pattern_id , card_pattern) +type card_patterns is map (card_pattern_id, card_pattern) type card_id is nat -type card is record [ - card_owner : address ; - card_pattern : card_pattern_id ; -] -type cards is map(card_id , card) -type storage_type is record [ - cards : cards ; - card_patterns : card_patterns ; - next_id : nat ; +type card is record [ + card_owner : address; + card_pattern : card_pattern_id ] +type cards is map (card_id, card) + +type storage is record [ + cards : cards; + card_patterns : card_patterns; + next_id : nat +] + +type return is list (operation) * storage + type action_buy_single is record [ - card_to_buy : card_pattern_id ; -] -type action_sell_single is record [ - card_to_sell : card_id ; -] -type action_transfer_single is record [ - card_to_transfer : card_id ; - destination : address ; + card_to_buy : card_pattern_id ] -type action is -| Buy_single of action_buy_single -| Sell_single of action_sell_single +type action_sell_single is record [ + card_to_sell : card_id +] + +type action_transfer_single is record [ + card_to_transfer : card_id; + destination : address +] + +type parameter is + Buy_single of action_buy_single +| Sell_single of action_sell_single | Transfer_single of action_transfer_single -function transfer_single(const action : action_transfer_single ; const s : storage_type) : (list(operation) * storage_type) is - begin - const cards : cards = s.cards ; - const card : card = get_force(action.card_to_transfer , cards) ; - if (card.card_owner =/= source) then failwith ("This card doesn't belong to you") else skip ; - card.card_owner := action.destination ; - cards[action.card_to_transfer] := card ; - s.cards := cards ; - const operations : list(operation) = nil ; - end with (operations , s) ; +function transfer_single (const action : action_transfer_single; + const s : storage) : return is block { + const cards : cards = s.cards; + const card : card = get_force (action.card_to_transfer, cards); + if card.card_owner =/= source then + failwith ("This card doesn't belong to you") + else skip; + card.card_owner := action.destination; + cards[action.card_to_transfer] := card; + s.cards := cards; + const operations : list (operation) = nil + } with (operations, s) -function sell_single(const action : action_sell_single ; const s : storage_type) : (list(operation) * storage_type) is - begin - const card : card = get_force(action.card_to_sell , s.cards) ; - if (card.card_owner =/= source) then failwith ("This card doesn't belong to you") else skip ; - const card_pattern : card_pattern = get_force(card.card_pattern , s.card_patterns) ; - card_pattern.quantity := abs(card_pattern.quantity - 1n); - const card_patterns : card_patterns = s.card_patterns ; - card_patterns[card.card_pattern] := card_pattern ; - s.card_patterns := card_patterns ; - const cards : cards = s.cards ; - remove action.card_to_sell from map cards ; - s.cards := cards ; - const price : tez = card_pattern.coefficient * card_pattern.quantity ; - const receiver : contract(unit) = get_contract(source) ; - const op : operation = transaction(unit , price , receiver) ; - const operations : list(operation) = list op end ; - end with (operations , s) +function sell_single (const action : action_sell_single; + const s : storage) : return is + block { + const card : card = get_force (action.card_to_sell, s.cards); + if card.card_owner =/= source + then failwith ("This card doesn't belong to you") + else skip; + const card_pattern : card_pattern = + get_force (card.card_pattern, s.card_patterns); + card_pattern.quantity := abs (card_pattern.quantity - 1n); + const card_patterns : card_patterns = s.card_patterns; + card_patterns[card.card_pattern] := card_pattern; + s.card_patterns := card_patterns; + const cards : cards = s.cards; + remove action.card_to_sell from map cards; + s.cards := cards; + const price : tez = card_pattern.coefficient * card_pattern.quantity; + const receiver : contract (unit) = get_contract (source); + const op : operation = transaction (unit, price, receiver); + const operations : list (operation) = list [op] + } with (operations, s) -function buy_single(const action : action_buy_single ; const s : storage_type) : (list(operation) * storage_type) is - begin +function buy_single (const action : action_buy_single; + const s : storage) : return is + block { // Check funds - const card_pattern : card_pattern = get_force(action.card_to_buy , s.card_patterns) ; - const price : tez = card_pattern.coefficient * (card_pattern.quantity + 1n) ; - if (price > amount) then failwith ("Not enough money") else skip ; + const card_pattern : card_pattern = + get_force (action.card_to_buy, s.card_patterns); + const price : tez = + card_pattern.coefficient * (card_pattern.quantity + 1n); + if price > amount then failwith ("Not enough money") else skip; // Administrative procedure - const operations : list(operation) = nil ; + const operations : list(operation) = nil; // Increase quantity - card_pattern.quantity := card_pattern.quantity + 1n ; - const card_patterns : card_patterns = s.card_patterns ; - card_patterns[action.card_to_buy] := card_pattern ; - s.card_patterns := card_patterns ; + card_pattern.quantity := card_pattern.quantity + 1n; + const card_patterns : card_patterns = s.card_patterns; + card_patterns[action.card_to_buy] := card_pattern; + s.card_patterns := card_patterns; // Add card - const cards : cards = s.cards ; - cards[s.next_id] := record - card_owner = source ; - card_pattern = action.card_to_buy ; - end ; - s.cards := cards ; - s.next_id := s.next_id + 1n ; - end with (operations , s) + const cards : cards = s.cards; + cards[s.next_id] := record [ + card_owner = source; + card_pattern = action.card_to_buy + ]; + s.cards := cards; + s.next_id := s.next_id + 1n + } with (operations, s) -function main(const action : action ; const s : storage_type) : (list(operation) * storage_type) is - block {skip} with +function main (const action : parameter; const s : storage) : return is case action of - | Buy_single (bs) -> buy_single (bs , s) - | Sell_single (as) -> sell_single (as , s) - | Transfer_single (at) -> transfer_single (at , s) + Buy_single (bs) -> buy_single (bs, s) + | Sell_single (as) -> sell_single (as, s) + | Transfer_single (at) -> transfer_single (at, s) end diff --git a/src/test/contracts/condition-simple.ligo b/src/test/contracts/condition-simple.ligo index 9df22cbe3..1d8dc7c0b 100644 --- a/src/test/contracts/condition-simple.ligo +++ b/src/test/contracts/condition-simple.ligo @@ -1,10 +1 @@ -// Test if conditional with trivial conditions in PascaLIGO - -function main (const i : int) : int is - begin - if 1 = 1 then - i := 42 - else - i := 0 - end with i - +function main (const i : int) : int is if 1 = 1 then 42 else 0 diff --git a/src/test/contracts/condition.ligo b/src/test/contracts/condition.ligo index baf320f1d..fbf474980 100644 --- a/src/test/contracts/condition.ligo +++ b/src/test/contracts/condition.ligo @@ -1,16 +1,10 @@ -// Test if conditional in PascaLIGO - function main (const i : int) : int is - begin - var result : int := 23 ; - if i = 2 then - result := 42 - else - result := 0 - end with result + block { + var result : int := 23; + if i = 2 then result := 42 else result := 0 + } with result function foo (const b : bool) : int is - begin - var x : int := 41 ; - x := 1 + (if b then x else main(x)) ; - end with x + block { + const x : int = 41 + } with 1 + (if b then x else main (x)) diff --git a/src/test/contracts/counter.ligo b/src/test/contracts/counter.ligo index 469681a4c..295c540ee 100644 --- a/src/test/contracts/counter.ligo +++ b/src/test/contracts/counter.ligo @@ -1,6 +1,7 @@ -type some_type is int +type t is int -function main (const p : int ; const s : some_type) : (list(operation) * int) is - block { skip } // skip is a do nothing instruction, needed for empty blocks +function main (const p : int ; const s : t) : list (operation) * int is + block { + skip + } // skip is a do nothing instruction, needed for empty blocks with ((nil : list(operation)), p + s) - diff --git a/src/test/contracts/crypto.ligo b/src/test/contracts/crypto.ligo index 4e08f7b16..08d417241 100644 --- a/src/test/contracts/crypto.ligo +++ b/src/test/contracts/crypto.ligo @@ -1,3 +1,3 @@ -function hasherman512 (const s: bytes) : bytes is sha_512(s) +function hasherman512 (const s: bytes) : bytes is sha_512 (s) -function hasherman_blake (const s: bytes) : bytes is blake2b(s) +function hasherman_blake (const s: bytes) : bytes is blake2b (s) diff --git a/src/test/contracts/declaration-local.ligo b/src/test/contracts/declaration-local.ligo index 97f380112..3149a01f8 100644 --- a/src/test/contracts/declaration-local.ligo +++ b/src/test/contracts/declaration-local.ligo @@ -1,5 +1,5 @@ // Test PasaLIGO variable declarations inside of a block function main (const i : int) : int is block { - const j : int = 42 ; + const j : int = 42 } with j diff --git a/src/test/contracts/declarations.ligo b/src/test/contracts/declarations.ligo index 4001fbdbf..d6cc5dfb5 100644 --- a/src/test/contracts/declarations.ligo +++ b/src/test/contracts/declarations.ligo @@ -1,8 +1,5 @@ -// Test PascaLIGO top level declarations +// Test PascaLIGO top-level declarations const foo : int = 42 -function main (const i : int) : int is - begin - skip - end with i + foo +function main (const i : int) : int is i + foo diff --git a/src/test/contracts/deep_access.ligo b/src/test/contracts/deep_access.ligo index 7912aefc3..2d9ad32d4 100644 --- a/src/test/contracts/deep_access.ligo +++ b/src/test/contracts/deep_access.ligo @@ -1,31 +1,29 @@ -//Test deep_access in PascalLigo -type pii is (int*int) -type ppi is record x:pii; y:pii end -type ppp is (ppi*ppi) +// Test deep access -function main (const toto : unit) : int is block { - var a : ppp := ( - record - x = (0,1); - y = (10,11); - end , - record - x = (100,101); - y = (110,111); - end - ) ; - a.0.x.0 := 2; - const b:int = a.0.x.0; -} with b +type pii is int * int + +type ppi is record [x : pii; y : pii] + +type ppp is ppi * ppi + +function main (const toto : unit) : int is + block { + var a : ppp := + (record [x = (0,1); y = (10,11)], + record [x = (100,101); y = (110,111)]); + a.0.x.0 := 2; + } with a.0.x.0 -function asymetric_tuple_access(const foo : unit) : int is block { - var mytuple : int * (int * (int * int)) := (0,(1,(2,3))) ; -} with mytuple.0 + mytuple.1.0 + mytuple.1.1.0 + mytuple.1.1.1 +function asymetric_tuple_access (const foo : unit) : int is + block { + var tuple : int * (int * (int * int)) := (0,(1,(2,3))) + } with tuple.0 + tuple.1.0 + tuple.1.1.0 + tuple.1.1.1 -type nested_record_t is record - nesty : (record mymap : map(int,string) ; end) ; -end -function nested_record (var nee : nested_record_t) : string is block { - nee.nesty.mymap[1] := "one" ; -} with ( get_force(1, nee.nesty.mymap) ) \ No newline at end of file +type nested_record_t is + record [nesty : record [mymap : map (int,string)]] + +function nested_record (var nee : nested_record_t) : string is + block { + nee.nesty.mymap[1] := "one" + } with get_force (1, nee.nesty.mymap) diff --git a/src/test/contracts/dispatch-counter.ligo b/src/test/contracts/dispatch-counter.ligo index 79a71b837..c513381ae 100644 --- a/src/test/contracts/dispatch-counter.ligo +++ b/src/test/contracts/dispatch-counter.ligo @@ -1,16 +1,19 @@ -type action is -| Increment of int +type parameter is + Increment of int | Decrement of int -function increment(const i : int ; const n : int) : int is - block { skip } with (i + n) +type storage is int -function decrement(const i : int ; const n : int) : int is - block { skip } with (i - n) +type return is list (operation) * storage -function main (const p : action ; const s : int) : (list(operation) * int) is - block {skip} with ((nil : list(operation)), - case p of - | Increment (n) -> increment (s, n) - | Decrement (n) -> decrement (s, n) - end) +function increment (const i : int; const n : int) : int is i+n + +function decrement (const i : int; const n : int) : int is i-n + +const nop : list (operation) = nil + +function main (const action : parameter; const store : storage) : return is + case action of + Increment (n) -> (nop, increment (store, n)) + | Decrement (n) -> (nop, decrement (store, n)) + end diff --git a/src/test/contracts/double_main.ligo b/src/test/contracts/double_main.ligo index 6ad75dd80..a46df45ab 100644 --- a/src/test/contracts/double_main.ligo +++ b/src/test/contracts/double_main.ligo @@ -1,8 +1,11 @@ -function main(const p : unit; const s : int) : list(operation) * int is - ((list end : list(operation)), s + 1) +type parameter is unit +type storage is int +type return is list (operation) * storage -function main(const p : unit; const s : int) : list(operation) * int is - begin - const ret : list(operation) * int = main(p, s) - end - with (ret.0, ret.1 + 1) \ No newline at end of file +function main(const p : parameter; const s : storage) : return is + ((nil : list(operation)), s+1) + +function main (const p : parameter; const s : storage) : return is + block { + const ret : return = main (p, s) + } with (ret.0, ret.1 + 1) diff --git a/src/test/contracts/empty_case.ligo b/src/test/contracts/empty_case.ligo index 30771c774..c2236099f 100644 --- a/src/test/contracts/empty_case.ligo +++ b/src/test/contracts/empty_case.ligo @@ -1,9 +1,9 @@ -type foo is - | Bar of int - | Baz +type t is + Bar of int +| Baz -function main (const f: foo) : int is - (case f of - | Bar (n) -> n - | Baz -> -1 - end) +function main (const x : t) : int is + case x of + Bar (n) -> n + | Baz -> -1 + end diff --git a/src/test/contracts/entrypoints.ligo b/src/test/contracts/entrypoints.ligo index d884a1ec9..d1945ac8d 100644 --- a/src/test/contracts/entrypoints.ligo +++ b/src/test/contracts/entrypoints.ligo @@ -1,16 +1,19 @@ -function cb(const a : address; const s : unit) : list(operation) * unit is +type storage is unit + +type return is list (operation) * storage + +function cb (const a : address; const s : storage) : return is block { - const c : contract(unit) = get_entrypoint("%cb", a) + const c : contract (unit) = get_entrypoint ("%cb", a) } - with (list transaction(unit, 0mutez, c) end, s) + with (list [transaction (unit, 0mutez, c)], s) -function cbo(const a : address; const s : unit) : list(operation) * unit is +function cbo (const a : address; const s : storage) : return is block { - const c : contract(unit) = - case (get_entrypoint_opt("%cbo", a) : option(contract (unit))) of - | Some (c) -> c - | None -> (failwith ("entrypoint not found") : contract (unit)) + const c : contract (unit) = + case (get_entrypoint_opt ("%cbo", a) : option (contract (unit))) of + Some (c) -> c + | None -> (failwith ("entrypoint not found") : contract (unit)) end - } - with (list transaction(unit, 0mutez, c) end, s) + } with (list [transaction(unit, 0mutez, c)], s) diff --git a/src/test/contracts/evaluation_tests.ligo b/src/test/contracts/evaluation_tests.ligo index b531d4a7b..7eef1067f 100644 --- a/src/test/contracts/evaluation_tests.ligo +++ b/src/test/contracts/evaluation_tests.ligo @@ -1,11 +1,5 @@ -type myrec is record - foo : nat; - bar : string; -end; +type t is record [foo : nat; bar : string] -const a : myrec = record - foo = 0n; - bar = "bar"; -end; +const a : t = record [foo = 0n; bar = "bar"] -const b : int = 2 ; \ No newline at end of file +const b : int = 2 diff --git a/src/test/contracts/failwith.ligo b/src/test/contracts/failwith.ligo index 29b757c3e..73e9a4f06 100644 --- a/src/test/contracts/failwith.ligo +++ b/src/test/contracts/failwith.ligo @@ -1,37 +1,43 @@ -type param is -| Zero of nat -| Pos of nat +type parameter is + Zero of nat +| Pos of nat -function main (const p : param; const s : unit) : list(operation) * unit is +type storage is unit + +type return is list (operation) * storage + +function main (const p : parameter; const s : storage) : return is block { case p of - | Zero (n) -> if n > 0n then failwith("fail") else skip - | Pos (n) -> if n > 0n then skip else failwith("fail") + Zero (n) -> if n > 0n then failwith ("fail") else skip + | Pos (n) -> if n > 0n then skip else failwith ("fail") end } - with ((nil : list(operation)), s) + with ((nil : list (operation)), s) function foobar (const i : int) : int is block { - var p : param := Zero (42n) ; - if i > 0 then block { - i := i + 1 ; - if i > 10 then block { - i := 20 ; - failwith ("who knows") ; - i := 30 ; - } else skip - } else block { - case p of - | Zero (n) -> failwith ("wooo") - | Pos (n) -> skip - end + var p : parameter := Zero (42n); + if i > 0 then { + i := i + 1; + if i > 10 then { + i := 20; + failwith ("who knows"); + i := 30 // Should be no-op + } + else skip } - } with case p of - | Zero (n) -> i - | Pos (n) -> (failwith ("waaaa") : int) - end + else + case p of + Zero (n) -> failwith ("wooo") + | Pos (n) -> skip + end + } with + case p of + Zero (n) -> i + | Pos (n) -> (failwith ("waaaa") : int) + end -function failer(const p : int) : int is block { - if p = 1 then failwith("some_string") else skip ; +function failer (const p : int) : int is block { + if p = 1 then failwith ("some_string") else skip } with p diff --git a/src/test/contracts/for_fail.ligo b/src/test/contracts/for_fail.ligo index 0a177bca1..a8c870843 100644 --- a/src/test/contracts/for_fail.ligo +++ b/src/test/contracts/for_fail.ligo @@ -1,11 +1,2 @@ -// This was meant to test the for loop in PascaLIGO -// But for whatever reason, the LIGO compiler currently thinks this is a 'complex loop' -// even though it isn't. -// See this error: -// $ ligo dry-run for.ligo main 0 0 -// bounded iterators: only simple for loops are supported yet -// {"loop_loc":"in file \"for.ligo\", line 4, characters 10-42"} - - function main (const a: int) : int is - block { for i := 0 to 100 block { skip } } with i; + block { for i := 0 to 100 block { skip } } with i diff --git a/src/test/contracts/function-complex.ligo b/src/test/contracts/function-complex.ligo index 4c361cbfd..854a9ed65 100644 --- a/src/test/contracts/function-complex.ligo +++ b/src/test/contracts/function-complex.ligo @@ -1,9 +1,9 @@ // Test a PascaLIGO function with more complex logic than function.ligo function main (const i : int) : int is - begin - var j : int := 0 ; - var k : int := 1 ; - j := k + i ; - k := i + j ; - end with (k + j) + block { + var j : int := 0; + var k : int := 1; + j := k + i; + k := i + j + } with k + j diff --git a/src/test/contracts/function-shared.ligo b/src/test/contracts/function-shared.ligo index 0155b5cb1..cd7d64386 100644 --- a/src/test/contracts/function-shared.ligo +++ b/src/test/contracts/function-shared.ligo @@ -1,10 +1,7 @@ // Test a PascaLIGO function which uses other functions as subroutines -function inc ( const i : int ) : int is - block { skip } with i + 1 +function inc (const i : int) : int is i+1 -function double_inc ( const i : int ) : int is - block { skip } with inc(i + 1) +function double_inc (const i : int) : int is inc (i+1) -function foo ( const i : int ) : int is - block { skip } with inc(i) + double_inc(i) +function foo (const i : int) : int is inc (i) + double_inc (i) diff --git a/src/test/contracts/function.ligo b/src/test/contracts/function.ligo index 27f4437ef..81daec7ce 100644 --- a/src/test/contracts/function.ligo +++ b/src/test/contracts/function.ligo @@ -1,6 +1,3 @@ // Test a trivial PascaLIGO function -function main (const i : int) : int is - begin - skip - end with i +function main (const i : int) : int is i diff --git a/src/test/contracts/get_contract.ligo b/src/test/contracts/get_contract.ligo index 12d58aba6..cb203c840 100644 --- a/src/test/contracts/get_contract.ligo +++ b/src/test/contracts/get_contract.ligo @@ -1,16 +1,19 @@ -function cb(const s : unit) : list(operation) * unit is +type storage is unit +type return is list (operation) * storage + +function cb (const s : storage) : return is block { - const c : contract(unit) = get_contract(source) + const c : contract (unit) = get_contract (source) } - with (list transaction(unit, 0mutez, c) end, s) + with (list [transaction(unit, 0mutez, c)], s) -function cbo(const s : unit) : list(operation) * unit is +function cbo (const s : unit) : return is block { - const c : contract(unit) = - case (get_contract_opt(source) : option(contract (unit))) of - | Some (c) -> c - | None -> (failwith ("contract not found") : contract (unit)) + const c : contract (unit) = + case (get_contract_opt (source) : option (contract (unit))) of + Some (c) -> c + | None -> (failwith ("contract not found") : contract (unit)) end } - with (list transaction(unit, 0mutez, c) end, s) + with (list [transaction(unit, 0mutez, c)], s) diff --git a/src/test/contracts/heap-instance.ligo b/src/test/contracts/heap-instance.ligo index b214f0fab..11b1c58de 100644 --- a/src/test/contracts/heap-instance.ligo +++ b/src/test/contracts/heap-instance.ligo @@ -1,6 +1,6 @@ -type heap_element is int * string +type heap_elt is int * string -function heap_element_lt(const x : heap_element ; const y : heap_element) : bool is - block { skip } with x.0 < y.0 +function heap_elt_lt (const x : heap_elt; + const y : heap_elt) : bool is x.0 < y.0 #include "heap.ligo" diff --git a/src/test/contracts/heap.ligo b/src/test/contracts/heap.ligo index 48130f96b..66c7747b6 100644 --- a/src/test/contracts/heap.ligo +++ b/src/test/contracts/heap.ligo @@ -1,93 +1,95 @@ // Implementation of the heap data structure in PascaLIGO // See: https://en.wikipedia.org/wiki/Heap_%28data_structure%29 -type heap is map(nat, heap_element) ; +type heap is map (nat, heap_elt) -function is_empty (const h : heap) : bool is - block {skip} with size(h) = 0n +function is_empty (const h : heap) : bool is size (h) = 0n -function get_top (const h : heap) : heap_element is - block {skip} with get_force(1n, h) +function get_top (const h : heap) : heap_elt is get_force (1n, h) function pop_switch (const h : heap) : heap is block { - const result : heap_element = get_top (h) ; - const s : nat = size(h) ; - const last : heap_element = get_force(s, h) ; - remove 1n from map h ; - h[1n] := last ; + const result : heap_elt = get_top (h); + const s : nat = size (h); + const last : heap_elt = get_force (s, h); + remove 1n from map h; + h[1n] := last } with h function pop_ (const h : heap) : nat is - begin - const result : heap_element = get_top (h) ; - const s : nat = size(h) ; - var current : heap_element := get_force(s, h) ; - const i : nat = 1n ; - const left : nat = 2n * i ; - const right : nat = left + 1n ; - remove 1n from map h ; - h[1n] := current ; - var largest : nat := i ; - if (left <= s and heap_element_lt(get_force(s , h) , get_force(left , h))) then - largest := left - else if (right <= s and heap_element_lt(get_force(s , h) , get_force(right , h))) then - largest := right - else skip - end with largest + block { + const result : heap_elt = get_top (h); + const s : nat = size (h); + var current : heap_elt := get_force (s, h); + const i : nat = 1n; + const left : nat = 2n * i; + const right : nat = left + 1n; + remove 1n from map h; + h[1n] := current; + var largest : nat := i; + const tmp : heap_elt = get_force (s, h); + if left <= s and heap_elt_lt (tmp, get_force (left,h)) + then largest := left + else + if right <= s and heap_elt_lt (tmp, get_force (right,h)) + then largest := right + else skip + } with largest -function insert (const h : heap ; const e : heap_element) : heap is - begin - var i : nat := size(h) + 1n ; - h[i] := e ; - var largest : nat := i ; - var parent : nat := 0n ; - while (largest =/= i) block { - parent := i / 2n ; - largest := i ; - if (parent >= 1n) then block { - if (heap_element_lt(get_force(parent , h) , get_force(i , h))) then block { - largest := parent ; - const tmp : heap_element = get_force(i , h) ; - h[i] := get_force(parent , h) ; - h[parent] := tmp ; +function insert (const h : heap ; const e : heap_elt) : heap is + block { + var i : nat := size (h) + 1n; + h[i] := e; + var largest : nat := i; + var parent : nat := 0n; + while largest =/= i block { + parent := i/2n; + largest := i; + if parent >= 1n then { + if heap_elt_lt (get_force (parent,h), get_force(i,h))) then { + largest := parent; + const tmp : heap_elt = get_force (i,h); + h[i] := get_force(parent, h); + h[parent] := tmp } else skip } else skip } - end with h + } with h -function pop (const h : heap) : (heap * heap_element * nat) is - begin - const result : heap_element = get_top (h) ; - var s : nat := size(h) ; - const last : heap_element = get_force(s, h) ; - remove s from map h ; - h[1n] := last ; - s := size(h) ; - var i : nat := 0n ; - var largest : nat := 1n ; - var left : nat := 0n ; - var right : nat := 0n ; - var c : nat := 0n ; - while (largest =/= i) block { - c := c + 1n ; - i := largest ; - left := 2n * i ; - right := left + 1n ; - if (left <= s) then begin - if (heap_element_lt(get_force(left , h) , get_force(i , h))) then begin - largest := left ; - const tmp : heap_element = get_force(i , h) ; - h[i] := get_force(left , h) ; - h[left] := tmp ; - end else skip ; - end else if (right <= s) then begin - if (heap_element_lt(get_force(right , h) , get_force(i , h))) then begin - largest := right ; - const tmp : heap_element = get_force(i , h) ; - h[i] := get_force(right , h) ; - h[left] := tmp ; - end else skip ; - end else skip ; - } - end with (h , result , c) +function pop (const h : heap) : heap * heap_elt * nat is + block { + const result : heap_elt = get_top (h); + var s : nat := size (h); + const last : heap_elt = get_force (s,h); + remove s from map h; + h[1n] := last; + s := size (h); + var i : nat := 0n; + var largest : nat := 1n; + var left : nat := 0n; + var right : nat := 0n; + var c : nat := 0n; + while largest =/= i block { + c := c + 1n; + i := largest; + left := 2n * i; + right := left + 1n; + if left <= s then { + if heap_elt_lt (get_force (left,h), get_force(i,h)) then { + largest := left; + const tmp : heap_elt = get_force(i,h); + h[i] := get_force (left, h); + h[left] := tmp + } else skip + } + else + if right <= s then { + if heap_elt_lt (get_force (right, h), get_force (i,h)) then { + largest := right; + const tmp : heap_elt = get_force (i,h); + h[i] := get_force (right, h); + h[left] := tmp + } else skip + } else skip + } + } with (h, result, c) diff --git a/src/test/contracts/high-order.ligo b/src/test/contracts/high-order.ligo index 20162400d..e1d3b9a18 100644 --- a/src/test/contracts/high-order.ligo +++ b/src/test/contracts/high-order.ligo @@ -1,27 +1,27 @@ -// Test a PascaLIGO function which takes another PascaLIGO function as an argument +(* Test a PascaLIGO function which takes another function as an + argument *) + function foobar (const i : int) : int is - begin + block { function foo (const i : int) : int is i; function bar (const f : int -> int) : int is f (i); - end with bar (foo); + } with bar (foo) // higher order function with more than one argument -function higher2(const i : int; const f : int -> int): int is - begin - const ii: int = f (i) - end with ii + +function higher2 (const i : int; const f : int -> int): int is f (i) function foobar2 (const i : int) : int is - begin + block { function foo2 (const i : int) : int is i - end with higher2 (i,foo2) + } with higher2 (i, foo2) -const a : int = 0; +const a : int = 0 function foobar3 (const i : int) : int is - begin + block { function foo2 (const i : int) : int is a+i - end with higher2 (i,foo2) + } with higher2 (i, foo2) function f (const i : int) : int is i @@ -29,17 +29,15 @@ function g (const i : int) : int is f (i) function foobar4 (const i : int) : int is g (g (i)) -function higher3(const i : int; const f : int -> int; const g : int -> int) -: int is - begin - const ii : int = f(g(i)) - end with ii +function higher3 (const i : int; + const f : int -> int; + const g : int -> int) : int is f (g (i)) function foobar5 (const i : int) : int is - begin + block { const a : int = 0; function foo (const i : int) : int is a+i; function goo (const i : int) : int is foo (i) - end with higher3(i,foo,goo) + } with higher3 (i, foo, goo) function foobar6 (const i : int) : int -> int is f diff --git a/src/test/contracts/implicit_account.ligo b/src/test/contracts/implicit_account.ligo index 8883a778d..ad0a6c54b 100644 --- a/src/test/contracts/implicit_account.ligo +++ b/src/test/contracts/implicit_account.ligo @@ -1 +1 @@ -function main (const kh: key_hash) : contract(unit) is implicit_account(kh) +function main (const kh: key_hash) : contract (unit) is implicit_account (kh) diff --git a/src/test/contracts/isnat.ligo b/src/test/contracts/isnat.ligo index 75215f28a..1d2a4dfda 100644 --- a/src/test/contracts/isnat.ligo +++ b/src/test/contracts/isnat.ligo @@ -1,2 +1 @@ -function main (const i: int) : option(nat) is - block {skip} with is_nat(i) +function main (const i : int) : option (nat) is is_nat (i) diff --git a/src/test/contracts/key_hash.ligo b/src/test/contracts/key_hash.ligo index 38b72366a..865abfbb8 100644 --- a/src/test/contracts/key_hash.ligo +++ b/src/test/contracts/key_hash.ligo @@ -1,5 +1,7 @@ -function check_hash_key (const kh1 : key_hash; const k2 : key) : bool*key_hash is block { - var ret : bool := False ; - var kh2 : key_hash := crypto_hash_key(k2) ; - if kh1 = kh2 then ret := True else skip; -} with (ret, kh2) \ No newline at end of file +function check_hash_key (const kh1 : key_hash; + const k2 : key) : bool * key_hash is + block { + var ret : bool := False; + var kh2 : key_hash := crypto_hash_key (k2); + if kh1 = kh2 then ret := True else skip + } with (ret, kh2) diff --git a/src/test/contracts/lambda.ligo b/src/test/contracts/lambda.ligo index 036327729..8c3160ed9 100644 --- a/src/test/contracts/lambda.ligo +++ b/src/test/contracts/lambda.ligo @@ -1,7 +1,3 @@ -function f (const x : unit) : unit is - begin skip end with unit +function f (const x : unit) : unit is Unit -function main (const p : unit ; const s : unit) : unit is - begin - var y : unit := f(unit) ; - end with y +function main (const p : unit ; const s : unit) : unit is f (Unit) diff --git a/src/test/contracts/list.ligo b/src/test/contracts/list.ligo index 77f8beec3..155b80ac5 100644 --- a/src/test/contracts/list.ligo +++ b/src/test/contracts/list.ligo @@ -1,49 +1,33 @@ // Test list type and related built-in functions in PascaLIGO -type foobar is list(int) +type foobar is list (int) -const fb : foobar = list - 23 ; - 42 ; -end +const fb : foobar = list [23; 42] const fb2 : foobar = 144 # fb -const fb3 : foobar = cons(688 , fb2) +const fb3 : foobar = cons (688, fb2) -function size_ (const m : foobar) : nat is - block {skip} with (size(m)) +function size_ (const m : foobar) : nat is size (m) -// function hdf (const m : foobar) : int is begin skip end with hd(m) +// function hdf (const m : foobar) : int is hd (m) -const bl : foobar = list - 144 ; - 51 ; - 42 ; - 120 ; - 421 ; -end +const bl : foobar = list [144; 51; 42; 120; 421] -function fold_op (const s: list(int)) : int is - begin - function aggregate (const prec: int; const cur: int) : int is - begin - skip - end with prec + cur - end with list_fold(aggregate, s, 10) - - -function iter_op (const s : list(int)) : int is - begin - var r : int := 0 ; - function aggregate (const i : int) : unit is - begin - r := r + i ; - end with unit ; - list_iter(aggregate, s) ; - end with r - -function map_op (const s : list(int)) : list(int) is +function fold_op (const s : list (int)) : int is block { - function increment (const i : int) : int is block { skip } with i + 1 - } with list_map(increment, s) + function aggregate (const prec: int; const cur: int) : int is prec+cur + } with list_fold (aggregate, s, 10) + +function iter_op (const s : list (int)) : int is + block { + var r : int := 0; + function aggregate (const i : int) : unit is + block { r := r + i } with unit; + list_iter (aggregate, s) + } with r + +function map_op (const s : list (int)) : list (int) is + block { + function increment (const i : int) : int is i+1 + } with list_map (increment, s) diff --git a/src/test/contracts/loop.ligo b/src/test/contracts/loop.ligo index 50e87da04..7866a5cdb 100644 --- a/src/test/contracts/loop.ligo +++ b/src/test/contracts/loop.ligo @@ -1,193 +1,188 @@ // Test while loops in PascaLIGO -function counter (var n : nat) : nat is block { - var i : nat := 0n ; - while i < n block { - i := i + 1n; - } -} with i +function counter (var n : nat) : nat is + block { + var i : nat := 0n; + while i < n block { + i := i + 1n + } + } with i -function while_sum (var n : nat) : nat is block { - var i : nat := 0n ; - var r : nat := 0n ; - while i < n block { - i := i + 1n; - r := r + i; - } -} with r +function while_sum (var n : nat) : nat is + block { + var i : nat := 0n; + var r : nat := 0n; + while i < n block { + i := i + 1n; + r := r + i + } + } with r -function for_sum (var n : nat) : int is block { - var acc : int := 0 ; - for i := 1 to int(n) - begin - acc := acc + i; - end -} with acc +function for_sum (var n : nat) : int is + block { + var acc : int := 0; + for i := 1 to int (n) + block { + acc := acc + i + } + } with acc -function for_collection_list (var nee : unit) : (int * string) is block { - var acc : int := 0; - var st : string := "to"; - var mylist : list(int) := list 1; 1; 1 end; - for x in list mylist - begin +function for_collection_list (var nee : unit) : (int * string) is + block { + var acc : int := 0; + var st : string := "to"; + var mylist : list (int) := list [1; 1; 1]; + for x in list mylist + block { + acc := acc + x; + st := st ^ "to" + } + } with (acc, st) + +function for_collection_set (var nee : unit) : int * string is + block { + var acc : int := 0; + var st : string := "to"; + var myset : set (int) := set [1; 2; 3]; + for x in set myset block { acc := acc + x; - st := st ^ "to"; - end -} with (acc, st) + st := st ^ "to" + } + } with (acc, st) -function for_collection_set (var nee : unit) : (int * string) is block { - var acc : int := 0; - var st : string := "to"; - var myset : set(int) := set 1; 2; 3 end; - for x in set myset - begin - acc := acc + x ; - st := st^"to" ; - end -} with (acc, st) +function for_collection_if_and_local_var (var nee : unit) : int is + block { + var acc : int := 0; + const theone : int = 1; + var myset : set (int) := set [1; 2; 3]; + for x in set myset block { + const thetwo : int = 2; + if x = theone then acc := acc + x + else if x = thetwo then acc := acc + thetwo + else acc := acc + 10 + } + } with acc -function for_collection_if_and_local_var (var nee : unit) : int is block { - var acc : int := 0 ; - const theone : int = 1 ; - var myset : set(int) := set 1 ; 2 ; 3 end ; - for x in set myset - begin - const thetwo : int = 2 ; - if x=theone then - acc := acc + x - else if x=thetwo then - acc := acc + thetwo; - else - acc := acc + 10; - end -} with acc +function for_collection_rhs_capture (var nee : unit) : int is + block { + var acc : int := 0; + const mybigint : int = 1000; + var myset : set (int) := set [1; 2; 3]; + for x in set myset block { + if x = 1 then acc := acc + mybigint + else acc := acc + 10 + } + } with acc -function for_collection_rhs_capture (var nee : unit) : int is block { - var acc : int := 0 ; - const mybigint : int = 1000 ; - var myset : set(int) := set 1 ; 2 ; 3 end ; - for x in set myset - begin - if x=1 then acc := acc + mybigint; - else acc := acc + 10; - end -} with acc +function for_collection_proc_call (var nee : unit) : int is + block { + var acc : int := 0; + var myset : set (int) := set [1; 2; 3]; + for x in set myset block { + if x = 1 then + acc := acc + for_collection_rhs_capture (unit) + else acc := acc + 10 + } + } with acc -function for_collection_proc_call (var nee : unit) : int is block { - var acc : int := 0 ; - var myset : set(int) := set 1 ; 2 ; 3 end ; - for x in set myset - begin - if x=1 then - acc := acc + for_collection_rhs_capture(unit); - else - acc := acc + 10; - end -} with acc - -function for_collection_comp_with_acc (var nee : unit) : int is block { - var myint : int := 0 ; - var mylist : list(int) := list 1 ; 10 ; 15 end; - for x in list mylist - begin +function for_collection_comp_with_acc (var nee : unit) : int is + block { + var myint : int := 0; + var mylist : list (int) := list [1; 10; 15]; + for x in list mylist block { if x < myint then skip; else myint := myint + 10 - end -} with myint + } + } with myint -function for_collection_with_patches (var nee : unit) : map(string,int) is block { - var myint : int := 12 ; - var mylist : list(string) := list "I"; "am"; "foo" end; - var mymap : map(string,int) := map end; - for x in list mylist - begin - patch mymap with map [x -> myint]; - end -} with mymap +function for_collection_with_patches (var nee : unit) : map (string,int) is + block { + var myint : int := 12; + var mylist : list (string) := list ["I"; "am"; "foo"]; + var mymap : map (string,int) := map []; + for x in list mylist block { + patch mymap with map [x -> myint] + } + } with mymap -function for_collection_empty (var nee : unit) : int is block { - var acc : int := 0 ; - var myset : set(int) := set 1; 2; 3 end; - for x in set myset - begin +function for_collection_empty (var nee : unit) : int is + block { + var acc : int := 0; + var myset : set(int) := set [1; 2; 3]; + for x in set myset block { skip - end -} with acc + } + } with acc -function for_collection_map_kv (var nee : unit) : (int * string) is block { - var acc : int := 0; - var st : string := ""; - var mymap : map(string,int) := map "1" -> 1; "2" -> 2; "3" -> 3 end; - for k -> v in map mymap - begin +function for_collection_map_kv (var nee : unit) : int * string is + block { + var acc : int := 0; + var st : string := ""; + var mymap : map (string, int) := map ["1" -> 1; "2" -> 2; "3" -> 3]; + for k -> v in map mymap block { acc := acc + v; st := st ^ k; - end -} with (acc, st) + } + } with (acc, st) -function for_collection_map_k (var nee : unit) : string is block { - var st : string := "" ; - var mymap : map(string,int) := map "1" -> 1 ; "2" -> 2 ; "3" -> 3 end ; - for k in map mymap - begin - st := st ^ k; - end -} with st +function for_collection_map_k (var nee : unit) : string is + block { + var st : string := ""; + var mymap : map (string, int) := map ["1" -> 1; "2" -> 2; "3" -> 3]; + for k in map mymap block { + st := st ^ k + } + } with st -function nested_for_collection (var nee : unit) : (int*string) is block { - var myint : int := 0; - var mystoo : string := ""; - var mylist : list(int) := list 1 ; 2 ; 3 end ; - var mymap : map(string,string) := map " one" -> "," ; "two" -> " " end ; +function nested_for_collection (var nee : unit) : int * string is + block { + var myint : int := 0; + var mystoo : string := ""; + var mylist : list(int) := list [1; 2; 3]; + var mymap : map (string, string) := map [" one" -> ","; "two" -> " "]; + for i in list mylist block { + myint := myint + i; + var myset : set (string) := set ["1"; "2"; "3"]; + for st in set myset block { + myint := myint + i; + mystoo := mystoo ^ st; + for k -> v in map mymap block { + mystoo := mystoo ^ k ^ v + } + } + } + } with (myint, mystoo) - for i in list mylist - begin - myint := myint + i ; - var myset : set(string) := set "1" ; "2" ; "3" end ; - for st in set myset - begin - myint := myint + i ; - mystoo := mystoo ^ st ; - for k -> v in map mymap - begin - mystoo := mystoo ^ k ^ v ; - end - end - end -} with (myint,mystoo) - -function nested_for_collection_local_var (var nee : unit) : (int*string) is block { - var myint : int := 0; - var myst : string := ""; - var mylist : list(int) := list 1 ; 2 ; 3 end ; - - for i in list mylist - begin - var myst_loc : string := "" ; - myint := myint + i ; - var myset : set(string) := set "1" ; "2" ; "3" end ; - for st in set myset - begin - myint := myint + i ; - myst_loc := myst_loc ^ st ; - end; - myst := myst_loc ^ myst ; - end -} with (myint,myst) +function nested_for_collection_local_var (var nee : unit) : int*string is + block { + var myint : int := 0; + var myst : string := ""; + var mylist : list (int) := list [1; 2; 3]; + for i in list mylist block { + var myst_loc : string := ""; + myint := myint + i; + var myset : set (string) := set ["1"; "2"; "3"]; + for st in set myset block { + myint := myint + i; + myst_loc := myst_loc ^ st; + }; + myst := myst_loc ^ myst + } + } with (myint, myst) function dummy (const n : nat) : nat is block { while False block { skip } } with n -function inner_capture_in_conditional_block (var nee : unit) : bool*int is block { - var count : int := 1 ; - var ret : bool := False ; - var mylist : list(int) := list 1 ; 2 ; 3 end ; - for it1 in list mylist block { - for it2 in list mylist block { - if count = it2 then ret := not (ret) - else skip; - }; - count := count + 1; - } -} with (ret,count) \ No newline at end of file +function inner_capture_in_conditional_block (var nee : unit) : bool * int is + block { + var count : int := 1; + var ret : bool := False; + var mylist : list (int) := list [1; 2; 3]; + for it1 in list mylist block { + for it2 in list mylist block { + if count = it2 then ret := not (ret) else skip + }; + count := count + 1 + } + } with (ret, count) diff --git a/src/test/contracts/map.ligo b/src/test/contracts/map.ligo index 797bb1a8b..cd394e0d2 100644 --- a/src/test/contracts/map.ligo +++ b/src/test/contracts/map.ligo @@ -1,23 +1,20 @@ // Test map type and related built-in functions in PascaLIGO -type foobar is map(int, int) +type foobar is map (int, int) -const empty_map : foobar = map end +const empty_map : foobar = map [] -const map1 : foobar = map - 144 -> 23 ; - 51 -> 23 ; - 42 -> 23 ; - 120 -> 23 ; - 421 -> 23 ; -end -const map2 : foobar = map - 23 -> 0 ; - 42 -> 0 ; -end +const map1 : foobar = map [ + 144 -> 23; + 51 -> 23; + 42 -> 23; + 120 -> 23; + 421 -> 23] -function set_ (var n : int ; var m : foobar) : foobar is block { - m[23] := n ; +const map2 : foobar = map [23 -> 0; 42 -> 0] + +function set_ (var n : int; var m : foobar) : foobar is block { + m[23] := n } with m @@ -25,50 +22,43 @@ function rm (var m : foobar) : foobar is block { remove 42 from map m } with m -function patch_ (var m: foobar) : foobar is block { +function patch_ (var m : foobar) : foobar is block { patch m with map [0 -> 5; 1 -> 6; 2 -> 7] } with m -function patch_deep (var m: foobar * nat) : foobar * nat is - begin patch m.0 with map [1 -> 9]; end with m +function patch_deep (var m : foobar * nat) : foobar * nat is + block { patch m.0 with map [1 -> 9] } with m -function size_ (const m : foobar) : nat is - block {skip} with (size(m)) +function size_ (const m : foobar) : nat is size (m) -function gf (const m : foobar) : int is begin skip end with get_force(23, m) +function gf (const m : foobar) : int is get_force (23, m) -function get (const m : foobar) : option(int) is - begin - skip - end with m[42] +function get (const m : foobar) : option (int) is m[42] -function get_ (const m : foobar) : option(int) is - begin - skip - end with map_get(42 , m) +function get_ (const m : foobar) : option (int) is map_get (42, m) -function mem (const k: int; const m: foobar) : bool is map_mem(k, m) +function mem (const k: int; const m: foobar) : bool is map_mem (k, m) function iter_op (const m : foobar) : unit is block { - function aggregate (const i : int ; const j : int) : unit is block - { if (i=j) then skip else failwith("fail") } with unit ; - // map_iter(m , aggregate) ; - } with map_iter(aggregate, m) ; + function aggregate (const i : int; const j : int) : unit is block + { if i=j then skip else failwith ("fail") } with unit + } with map_iter (aggregate, m) function map_op (const m : foobar) : foobar is block { - function increment (const i : int ; const j : int) : int is block { skip } with j + 1 ; - } with map_map(increment, m) ; + function increment (const i : int; const j : int) : int is j+1 + } with map_map (increment, m) function fold_op (const m : foobar) : int is block { - function aggregate (const i : int ; const j : (int * int)) : int is block { skip } with i + j.0 + j.1 ; - } with map_fold(aggregate, m , 10) + function aggregate (const i : int; const j : int * int) : int is + i + j.0 + j.1 + } with map_fold(aggregate, m, 10) function deep_op (var m : foobar) : foobar is block { - var coco : (int*foobar) := (0, m); - remove 42 from map coco.1 ; - coco.1[32] := 16 ; + var coco : int * foobar := (0, m); + remove 42 from map coco.1; + coco.1[32] := 16 } with coco.1 diff --git a/src/test/contracts/match.ligo b/src/test/contracts/match.ligo index 167f3d976..d4fbae47c 100644 --- a/src/test/contracts/match.ligo +++ b/src/test/contracts/match.ligo @@ -1,37 +1,37 @@ // Test the pattern matching functionality of PascaLIGO function match_bool (const i : int) : int is - begin - var result : int := 23 ; + block { + var result : int := 23; case i = 2 of - | True -> result := 42 + True -> result := 42 | False -> result := 0 end - end with result + } with result -function match_option (const o : option(int)) : int is - begin - var result : int := 23 ; +function match_option (const o : option (int)) : int is + block { + var result : int := 23; case o of - | None -> skip + None -> skip | Some (s) -> result := s end - end with result + } with result function match_expr_bool (const i : int) : int is case i = 2 of - | True -> 42 + True -> 42 | False -> 0 end -function match_expr_option (const o : option(int)) : int is +function match_expr_option (const o : option (int)) : int is case o of - | None -> 42 + None -> 42 | Some (s) -> s end -function match_expr_list (const l : list(int)) : int is +function match_expr_list (const l : list (int)) : int is case l of - | nil -> -1 + nil -> -1 | hd # tl -> hd end diff --git a/src/test/contracts/multiple-parameters.ligo b/src/test/contracts/multiple-parameters.ligo index 26f5daa0d..f955c2301 100644 --- a/src/test/contracts/multiple-parameters.ligo +++ b/src/test/contracts/multiple-parameters.ligo @@ -1,10 +1,14 @@ // Test functions with several parameters in PascaLIGO -function ab(const a : int; const b : int) : int is - begin skip end with (a + b) +function ab (const a : int; const b : int) : int is a+b -function abcd(const a : int; const b : int; const c : int; const d : int) : int is - begin skip end with (a + b + c + d + 2) +function abcd (const a : int; + const b : int; + const c : int; + const d : int) : int is a+b+c+d+2 -function abcde(const a : int; const b : int; const c : int; const d : int; const e : int) : int is - begin skip end with (c + e + 3) +function abcde (const a : int; + const b : int; + const c : int; + const d : int; + const e : int) : int is c+e+3 diff --git a/src/test/contracts/multisig-v2.ligo b/src/test/contracts/multisig-v2.ligo index 81b3536d4..cb3292d18 100644 --- a/src/test/contracts/multisig-v2.ligo +++ b/src/test/contracts/multisig-v2.ligo @@ -1,118 +1,150 @@ // storage type -type threshold_t is nat -type max_proposal_t is nat -type max_message_size_t is nat -type state_hash_t is bytes -type addr_set_t is set(address) -type message_store_t is map(bytes,addr_set_t) -type proposal_counters_t is map(address,nat) -type storage_t is record - state_hash : state_hash_t ; - threshold : threshold_t ; - max_proposal : max_proposal_t ; - max_message_size : max_message_size_t ; - authorized_addresses : addr_set_t ; - message_store : message_store_t ; - proposal_counters : proposal_counters_t ; -end +type threshold is nat +type max_proposal is nat +type max_message_size is nat +type state_hash is bytes +type addr_set is set (address) +type message_store is map (bytes, addr_set) +type proposal_counters is map (address, nat) + +type storage is + record [ + state_hash : state_hash; + threshold : threshold; + max_proposal : max_proposal; + max_message_size : max_message_size; + authorized_addresses : addr_set; + message_store : message_store; + proposal_counters : proposal_counters + ] // I/O types -type message_t is (bytes -> list(operation)) -type send_pt is message_t -type withdraw_pt is message_t + +type message is bytes -> list (operation) +type send_pt is message +type withdraw_pt is message type default_pt is unit -type contract_return_t is (list(operation) * storage_t) +type return is list (operation) * storage -type entry_point_t is -| Send of send_pt +type parameter is + Send of send_pt | Withdraw of withdraw_pt -| Default of default_pt +| Default of default_pt +function send (const param : send_pt; const s : storage) : return is + block { + // check sender against the authorized addresses -function send (const param : send_pt; const s : storage_t) : contract_return_t is block { + if not set_mem (sender, s.authorized_addresses) + then failwith("Unauthorized address") + else skip; - // check sender against the authorized addresses - if not set_mem(sender,s.authorized_addresses) then failwith("Unauthorized address") else skip ; + // check message size against the stored limit - // check message size against the stored limit - var message : message_t := param ; - const packed_msg : bytes = bytes_pack(message) ; - if size(packed_msg) > s.max_message_size then failwith("Message size exceed maximum limit") - else skip ; + var message : message := param; + const packed_msg : bytes = bytes_pack (message); + if size (packed_msg) > s.max_message_size + then failwith ("Message size exceed maximum limit") + else skip; - // compute the new set of addresses associated with the message and update counters - var new_store : addr_set_t := set_empty ; - case map_get(packed_msg, s.message_store) of - | Some(voters) -> block { // the message is already stored - // increment the counter only if the sender isn't already associated with the message - if set_mem(sender,voters) then skip - else s.proposal_counters[sender] := get_force(sender,s.proposal_counters) + 1n ; + (* compute the new set of addresses associated with the message and + update counters *) - new_store := set_add(sender,voters) - } - | None -> block { // the message has never been received before - s.proposal_counters[sender] := get_force(sender,s.proposal_counters) + 1n ; - new_store := set [sender]; - } - end ; + var new_store : addr_set := set_empty; - // check sender counters against the maximum number of proposal - var sender_proposal_counter : nat := get_force(sender,s.proposal_counters) ; - if sender_proposal_counter > s.max_proposal then failwith("Maximum number of proposal reached") - else skip ; + case map_get (packed_msg, s.message_store) of + Some (voters) -> + block { + (* The message is already stored. + Increment the counter only if the sender is not already + associated with the message. *) + if set_mem (sender, voters) + then skip + else s.proposal_counters[sender] := + get_force (sender, s.proposal_counters) + 1n; - // check the threshold - var ret_ops : list(operation) := (nil : list(operation)) ; - if size(new_store) >= s.threshold then block { - remove packed_msg from map s.message_store ; - ret_ops := message(s.state_hash) ; - // update the state hash - s.state_hash := sha_256 ( bytes_concat (s.state_hash , packed_msg) ) ; - // decrement the counters - for addr -> ctr in map s.proposal_counters block { - if set_mem(addr,new_store) then - s.proposal_counters[addr] := abs (ctr - 1n) - else skip ; - } - } else - s.message_store[packed_msg] := new_store - -} with ( ret_ops , s) + new_store := set_add(sender,voters) + } + | None -> + block { + // the message has never been received before + s.proposal_counters[sender] := + get_force (sender, s.proposal_counters) + 1n; + new_store := set [sender] + } + end; -function withdraw (const param : withdraw_pt; const s : storage_t) : contract_return_t is block { + // check sender counters against the maximum number of proposal - var message : message_t := param ; - const packed_msg : bytes = bytes_pack(message) ; + var sender_proposal_counter : nat := + get_force (sender, s.proposal_counters); - case map_get(packed_msg, s.message_store) of - | Some(voters) -> block { // the message is stored - const new_set : addr_set_t = set_remove(sender,voters) ; + if sender_proposal_counter > s.max_proposal + then failwith ("Maximum number of proposal reached") + else skip; - // decrement the counter only if the sender was already associated with the message - if size(voters) =/= size(new_set) then - s.proposal_counters[sender] := abs (get_force(sender,s.proposal_counters) - 1n) - else skip ; + // check the threshold - // if the message is left without any associated addresses, remove the corresponding message_store field - if size(new_set) = 0n then remove packed_msg from map s.message_store - else s.message_store[packed_msg] := new_set - } - | None -> skip end // the message isn't stored, ignore + var ret_ops : list (operation) := nil; -} with ( (nil: list(operation)) , s) + if size (new_store) >= s.threshold then { + remove packed_msg from map s.message_store; + ret_ops := message (s.state_hash); + // update the state hash + s.state_hash := sha_256 (bytes_concat (s.state_hash, packed_msg)); + // decrement the counters + for addr -> ctr in map s.proposal_counters block { + if set_mem(addr,new_store) then + s.proposal_counters[addr] := abs (ctr - 1n) + else skip + } + } else s.message_store[packed_msg] := new_store + } with (ret_ops, s) -function default (const p : default_pt; const s : storage_t) : contract_return_t is - ((nil: list(operation)) , s) +function withdraw (const param : withdraw_pt; const s : storage) : return is + block { + var message : message := param; + const packed_msg : bytes = bytes_pack (message); -function main(const param : entry_point_t; const s : storage_t) : contract_return_t is + case map_get(packed_msg, s.message_store) of + Some (voters) -> + block { + // The message is stored + const new_set : addr_set = set_remove (sender, voters); + + (* Decrement the counter only if the sender was already + associated with the message *) + + if size (voters) =/= size (new_set) + then s.proposal_counters[sender] := + abs (get_force (sender, s.proposal_counters) - 1n) + else skip ; + + (* If the message is left without any associated addresses, + remove the corresponding message_store field *) + + if size (new_set) = 0n + then remove packed_msg from map s.message_store + else s.message_store[packed_msg] := new_set + } + | None -> skip + end // The message is not stored, ignore. + } with ((nil : list (operation)), s) + +function default (const p : default_pt; const s : storage) : return is + ((nil : list (operation)), s) + +function main (const param : parameter; const s : storage) : return is case param of - // propagate message p if the number authorized addresses having - // voted for the same message p equals the threshold - | Send (p) -> send(p,s) - // withraw vote for message p - | Withdraw (p) -> withdraw(p,s) - // use this entry-point to transfer tez to the contract - | Default (p) -> default(p,s) -end \ No newline at end of file + (* Propagate message p if the number of authorized addresses having + voted for the same message p equals the threshold. *) + | Send (p) -> send (p, s) + + (* Withraw vote for message p *) + | Withdraw (p) -> withdraw (p, s) + + (* Use this action to transfer tez to the contract *) + | Default (p) -> default (p, s) + end diff --git a/src/test/contracts/multisig.ligo b/src/test/contracts/multisig.ligo index 90e7e30d7..f0cdb636c 100644 --- a/src/test/contracts/multisig.ligo +++ b/src/test/contracts/multisig.ligo @@ -1,62 +1,66 @@ // storage type -type counter_t is nat -type threshold_t is nat -type authorized_keys_t is list(key) -type id_t is string -type storage_t is record - id : id_t ; - counter : counter_t ; - threshold : threshold_t ; - auth : authorized_keys_t ; -end +type counter is nat +type threshold is nat +type authorized_keys is list (key) +type id is string + +type storage is + record [ + id : id; + counter : counter; + threshold : threshold; + auth : authorized_keys + ] // I/O types -type message_t is (unit -> list(operation)) -type signatures_t is list(key_hash * signature) -type check_message_pt is record - counter : counter_t ; - message : message_t ; - signatures : signatures_t ; -end -type contract_return_t is (list(operation) * storage_t) +type message is unit -> list (operation) -type entry_point_t is -| CheckMessage of check_message_pt +type signatures is list (key_hash * signature) + +type check_message_pt is + record [ + counter : counter; + message : message; + signatures : signatures + ] + +type return is list (operation) * storage + +type parameter is CheckMessage of check_message_pt function check_message (const param : check_message_pt; - const s : storage_t) : contract_return_t is block { - var message : message_t := param.message ; + const s : storage) : return is block { + var message : message := param.message; if param.counter =/= s.counter then failwith ("Counters does not match") - else block { + else { const packed_payload : bytes = - bytes_pack((message , param.counter , s.id , get_chain_id)); - var valid : nat := 0n ; + bytes_pack ((message, param.counter, s.id, get_chain_id)); + var valid : nat := 0n; - var keys : authorized_keys_t := s.auth ; + var keys : authorized_keys := s.auth; for pkh_sig in list param.signatures block { case keys of - | nil -> skip + nil -> skip | key # tl -> block { - keys := tl ; - if pkh_sig.0 = crypto_hash_key(key) then - if crypto_check(key,pkh_sig.1,packed_payload) then valid := valid + 1n ; - else failwith ("Invalid signature") - else skip; - } + keys := tl; + if pkh_sig.0 = crypto_hash_key (key) then + if crypto_check (key, pkh_sig.1, packed_payload) + then valid := valid + 1n + else failwith ("Invalid signature") + else skip + } end }; if valid < s.threshold then failwith ("Not enough signatures passed the check") - else s.counter := s.counter + 1n ; + else s.counter := s.counter + 1n } -} with (message(unit), s) +} with (message (unit), s) -function main(const param : entry_point_t; const s : storage_t) : contract_return_t is - case param of - | CheckMessage (p) -> check_message(p,s) -end \ No newline at end of file +function main (const param : parameter; const s : storage) : return is + case param of CheckMessage (p) -> check_message (p,s) end From f79839276004ad80e4a605b699fa4a27b76570b9 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Mon, 10 Feb 2020 19:54:23 +0100 Subject: [PATCH 053/119] constant typer: * Removed unused LIST_CONS * support for misc constants (untestetable for now) --- src/passes/operators/operators.ml | 89 +++++++++++++++++------------ src/stages/common/PP.ml | 1 - src/stages/common/types.ml | 1 - src/stages/mini_c/PP.ml | 1 - src/stages/typesystem/shorthands.ml | 5 ++ 5 files changed, 59 insertions(+), 38 deletions(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index ed77a7f64..842e32520 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -327,6 +327,9 @@ module Typer = struct let tc_divargs a b c = tc [a;b;c] [ (*TODO…*) ] let tc_modargs a b c = tc [a;b;c] [ (*TODO…*) ] let tc_addargs a b c = tc [a;b;c] [ (*TODO…*) ] + let tc_comparable a = tc [a] [ [nat] ; [int] ; [mutez] ; [timestamp] ] + let tc_concatable a = tc [a] [ [string] ; [bytes] ] + let tc_storable a = tc [a] [ [string] ; [bytes] ; (*Humm .. TODO ?*) ] let t_none = forall "a" @@ fun a -> option a @@ -355,18 +358,20 @@ module Typer = struct let t_hash512 = tuple1 bytes --> bytes let t_blake2b = tuple1 bytes --> bytes let t_hash_key = tuple1 key --> key_hash + let t_is_nat = tuple1 int --> bool let t_check_signature = tuple3 key signature bytes --> bool let t_chain_id = tuple0 --> chain_id let t_sender = tuple0 --> address let t_source = tuple0 --> address let t_unit = tuple0 --> unit let t_amount = tuple0 --> mutez + let t_balance = tuple0 --> mutez let t_address = tuple0 --> address let t_now = tuple0 --> timestamp let t_transaction = forall "a" @@ fun a -> tuple3 a mutez (contract a) --> operation let t_get_contract = forall "a" @@ fun a -> tuple0 --> contract a let t_abs = tuple1 int --> nat - let t_cons = forall "a" @@ fun a -> a --> tuple1 (list a) --> list a + let t_cons = forall "a" @@ fun a -> tuple2 a (list a) --> list a let t_assertion = tuple1 bool --> unit let t_times = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_timargs a b c] => tuple2 a b --> c (* TYPECLASS *) let t_div = forall3_tc "a" "b" "c" @@ fun a b c -> [tc_divargs a b c] => tuple2 a b --> c (* TYPECLASS *) @@ -377,21 +382,41 @@ module Typer = struct let t_set_remove = forall "a" @@ fun a -> tuple2 a (set a) --> set a let t_not = tuple1 bool --> bool + let t_continuation = forall "a" @@ fun a -> tuple2 bool a + let t_fold_while = forall "a" @@ fun a -> tuple2 (a --> tuple2 bool a) a --> a + let t_neg = tuple1 int --> int + let t_and = tuple2 bool bool --> bool + let t_or = tuple2 bool bool --> bool + let t_xor = tuple2 bool bool --> bool + let t_lsl = tuple2 nat nat --> nat + let t_lsr = tuple2 nat nat --> nat + let t_comp = forall_tc "a" @@ fun a -> [tc_comparable a] => tuple2 a a --> bool + let t_concat = forall_tc "a" @@ fun a -> [tc_concatable a] => tuple2 a a --> a + let t_set_empty = forall_tc "a" @@ fun a -> [tc_comparable a] => tuple0 --> set a + let t_set_iter = forall_tc "a" @@ fun a -> [tc_comparable a] => tuple2 (a --> unit) (set a) --> unit + let t_set_fold = forall2_tc "a" "b" @@ fun a b -> [tc_comparable b] => tuple3 (tuple2 a b --> a) (set b) b --> b + let t_list_iter = forall "a" @@ fun a -> tuple2 (a --> unit) (list a) --> unit + let t_list_map = forall "a" @@ fun a -> tuple2 (a --> a) (list a) --> (list a) + let t_list_fold = forall2 "a" "b" @@ fun a b -> tuple3 (tuple2 a b --> a) (list b) a --> a + let t_self_address = tuple0 --> address + let t_implicit_account = forall_tc "a" @@ fun a -> [tc_storable a] => tuple1 key_hash --> contract a + let t_set_delegate = tuple1 (option key_hash) --> operation + let constant_type : constant' -> Typesystem.Core.type_value result = function | C_INT -> ok @@ t_int ; | C_UNIT -> ok @@ t_unit ; | C_NOW -> ok @@ t_now ; - | C_IS_NAT -> ok @@ failwith "t_is_nat" ; + | C_IS_NAT -> ok @@ t_is_nat ; | C_SOME -> ok @@ t_some ; | C_NONE -> ok @@ t_none ; | C_ASSERTION -> ok @@ t_assertion ; | C_FAILWITH -> ok @@ t_failwith ; (* LOOPS *) - | C_FOLD_WHILE -> ok @@ failwith "t_fold_while" ; - | C_CONTINUE -> ok @@ failwith "t_continue" ; - | C_STOP -> ok @@ failwith "t_stop" ; + | C_FOLD_WHILE -> ok @@ t_fold_while ; + | C_CONTINUE -> ok @@ t_continuation ; + | C_STOP -> ok @@ t_continuation ; (* MATH *) - | C_NEG -> ok @@ failwith "t_neg" ; + | C_NEG -> ok @@ t_neg ; | C_ABS -> ok @@ t_abs ; | C_ADD -> ok @@ t_add ; | C_SUB -> ok @@ t_sub ; @@ -400,38 +425,38 @@ module Typer = struct | C_MOD -> ok @@ t_mod ; (* LOGIC *) | C_NOT -> ok @@ t_not ; - | C_AND -> ok @@ failwith "t_and" ; - | C_OR -> ok @@ failwith "t_or" ; - | C_XOR -> ok @@ failwith "t_xor" ; - | C_LSL -> ok @@ failwith "t_lsl" ; - | C_LSR -> ok @@ failwith "t_lsr" ; + | C_AND -> ok @@ t_and ; + | C_OR -> ok @@ t_or ; + | C_XOR -> ok @@ t_xor ; + | C_LSL -> ok @@ t_lsl ; + | C_LSR -> ok @@ t_lsr ; (* COMPARATOR *) - | C_EQ -> ok @@ failwith "t_comparator EQ" ; - | C_NEQ -> ok @@ failwith "t_comparator NEQ" ; - | C_LT -> ok @@ failwith "t_comparator LT" ; - | C_GT -> ok @@ failwith "t_comparator GT" ; - | C_LE -> ok @@ failwith "t_comparator LE" ; - | C_GE -> ok @@ failwith "t_comparator GE" ; + | C_EQ -> ok @@ t_comp ; + | C_NEQ -> ok @@ t_comp ; + | C_LT -> ok @@ t_comp ; + | C_GT -> ok @@ t_comp ; + | C_LE -> ok @@ t_comp ; + | C_GE -> ok @@ t_comp ; (* BYTES / STRING *) | C_SIZE -> ok @@ t_size ; - | C_CONCAT -> ok @@ failwith "t_concat" ; + | C_CONCAT -> ok @@ t_concat ; | C_SLICE -> ok @@ t_slice ; | C_BYTES_PACK -> ok @@ t_bytes_pack ; | C_BYTES_UNPACK -> ok @@ t_bytes_unpack ; | C_CONS -> ok @@ t_cons ; (* SET *) - | C_SET_EMPTY -> ok @@ failwith "t_set_empty" ; + | C_SET_EMPTY -> ok @@ t_set_empty ; | C_SET_ADD -> ok @@ t_set_add ; | C_SET_REMOVE -> ok @@ t_set_remove ; - | C_SET_ITER -> ok @@ failwith "t_set_iter" ; - | C_SET_FOLD -> ok @@ failwith "t_set_fold" ; + | C_SET_ITER -> ok @@ t_set_iter ; + | C_SET_FOLD -> ok @@ t_set_fold ; | C_SET_MEM -> ok @@ t_set_mem ; (* LIST *) - | C_LIST_ITER -> ok @@ failwith "t_list_iter" ; - | C_LIST_MAP -> ok @@ failwith "t_list_map" ; - | C_LIST_FOLD -> ok @@ failwith "t_list_fold" ; - | C_LIST_CONS -> ok @@ failwith "t_list_cons" ; + | C_LIST_ITER -> ok @@ t_list_iter ; + | C_LIST_MAP -> ok @@ t_list_map ; + | C_LIST_FOLD -> ok @@ t_list_fold ; + (* MAP *) | C_MAP_ADD -> ok @@ t_map_add ; | C_MAP_REMOVE -> ok @@ t_map_remove ; @@ -454,14 +479,14 @@ module Typer = struct | C_CONTRACT -> ok @@ t_get_contract ; | C_CONTRACT_ENTRYPOINT -> ok @@ failwith "t_get_entrypoint" ; | C_AMOUNT -> ok @@ t_amount ; - | C_BALANCE -> ok @@ failwith "t_balance" ; + | C_BALANCE -> ok @@ t_balance ; | C_CALL -> ok @@ t_transaction ; | C_SENDER -> ok @@ t_sender ; | C_SOURCE -> ok @@ t_source ; | C_ADDRESS -> ok @@ t_address ; - | C_SELF_ADDRESS -> ok @@ failwith "t_self_address"; - | C_IMPLICIT_ACCOUNT -> ok @@ failwith "t_implicit_account"; - | C_SET_DELEGATE -> ok @@ failwith "t_set_delegate" ; + | C_SELF_ADDRESS -> ok @@ t_self_address; + | C_IMPLICIT_ACCOUNT -> ok @@ t_implicit_account; + | C_SET_DELEGATE -> ok @@ t_set_delegate ; | c -> simple_fail @@ Format.asprintf "Typer not implemented for consant %a" Stage_common.PP.constant c end @@ -489,11 +514,6 @@ module Typer = struct let some = typer_1 "SOME" @@ fun a -> ok @@ t_option a () - let list_cons : typer = typer_2 "CONS" @@ fun hd tl -> - let%bind tl' = get_t_list tl in - let%bind () = assert_type_expression_eq (hd , tl') in - ok tl - let map_remove : typer = typer_2 "MAP_REMOVE" @@ fun k m -> let%bind (src , _) = bind_map_or (get_t_map , get_t_big_map) m in let%bind () = assert_type_expression_eq (src , k) in @@ -1031,7 +1051,6 @@ module Typer = struct | C_LIST_ITER -> ok @@ list_iter ; | C_LIST_MAP -> ok @@ list_map ; | C_LIST_FOLD -> ok @@ list_fold ; - | C_LIST_CONS -> ok @@ list_cons ; (* MAP *) | C_MAP_ADD -> ok @@ map_add ; | C_MAP_REMOVE -> ok @@ map_remove ; diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index d14ada03f..7235c9472 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -105,7 +105,6 @@ let constant ppf : constant' -> unit = function | C_LIST_ITER -> fprintf ppf "LIST_ITER" | C_LIST_MAP -> fprintf ppf "LIST_MAP" | C_LIST_FOLD -> fprintf ppf "LIST_FOLD" - | C_LIST_CONS -> fprintf ppf "LIST_CONS" (* Maps *) | C_MAP -> fprintf ppf "MAP" | C_MAP_EMPTY -> fprintf ppf "MAP_EMPTY" diff --git a/src/stages/common/types.ml b/src/stages/common/types.ml index 9cc8f2998..d390d1d46 100644 --- a/src/stages/common/types.ml +++ b/src/stages/common/types.ml @@ -247,7 +247,6 @@ and constant' = | C_LIST_ITER | C_LIST_MAP | C_LIST_FOLD - | C_LIST_CONS (* Maps *) | C_MAP | C_MAP_EMPTY diff --git a/src/stages/mini_c/PP.ml b/src/stages/mini_c/PP.ml index c9655dc24..fb607db79 100644 --- a/src/stages/mini_c/PP.ml +++ b/src/stages/mini_c/PP.ml @@ -201,7 +201,6 @@ and constant ppf : constant' -> unit = function | C_LIST_ITER -> fprintf ppf "LIST_ITER" | C_LIST_MAP -> fprintf ppf "LIST_MAP" | C_LIST_FOLD -> fprintf ppf "LIST_FOLD" - | C_LIST_CONS -> fprintf ppf "LIST_CONS" (* Maps *) | C_MAP -> fprintf ppf "MAP" | C_MAP_EMPTY -> fprintf ppf "MAP_EMPTY" diff --git a/src/stages/typesystem/shorthands.ml b/src/stages/typesystem/shorthands.ml index 15e1bdca0..81a341b32 100644 --- a/src/stages/typesystem/shorthands.ml +++ b/src/stages/typesystem/shorthands.ml @@ -39,6 +39,11 @@ let forall3_tc a b c f = forall_tc c @@ fun c' -> f a' b' c' +let forall2_tc a b f = + forall a @@ fun a' -> + forall_tc b @@ fun b' -> + f a' b' + let (=>) tc ty = (tc , ty) let (-->) arg ret = P_constant (C_arrow , [arg; ret]) let option t = P_constant (C_option , [t]) From 87a890164556fe5f2b9543316e2b7f2ded973ecb Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Mon, 10 Feb 2020 20:02:43 +0100 Subject: [PATCH 054/119] review fixes --- src/passes/operators/operators.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 842e32520..d9a5d4a9e 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -382,8 +382,8 @@ module Typer = struct let t_set_remove = forall "a" @@ fun a -> tuple2 a (set a) --> set a let t_not = tuple1 bool --> bool - let t_continuation = forall "a" @@ fun a -> tuple2 bool a - let t_fold_while = forall "a" @@ fun a -> tuple2 (a --> tuple2 bool a) a --> a + let t_continuation = forall "a" @@ fun a -> pair bool a + let t_fold_while = forall "a" @@ fun a -> tuple2 (a --> pair bool a) a --> a let t_neg = tuple1 int --> int let t_and = tuple2 bool bool --> bool let t_or = tuple2 bool bool --> bool @@ -394,10 +394,10 @@ module Typer = struct let t_concat = forall_tc "a" @@ fun a -> [tc_concatable a] => tuple2 a a --> a let t_set_empty = forall_tc "a" @@ fun a -> [tc_comparable a] => tuple0 --> set a let t_set_iter = forall_tc "a" @@ fun a -> [tc_comparable a] => tuple2 (a --> unit) (set a) --> unit - let t_set_fold = forall2_tc "a" "b" @@ fun a b -> [tc_comparable b] => tuple3 (tuple2 a b --> a) (set b) b --> b + let t_set_fold = forall2_tc "a" "b" @@ fun a b -> [tc_comparable b] => tuple3 (pair a b --> a) (set b) a --> a let t_list_iter = forall "a" @@ fun a -> tuple2 (a --> unit) (list a) --> unit let t_list_map = forall "a" @@ fun a -> tuple2 (a --> a) (list a) --> (list a) - let t_list_fold = forall2 "a" "b" @@ fun a b -> tuple3 (tuple2 a b --> a) (list b) a --> a + let t_list_fold = forall2 "a" "b" @@ fun a b -> tuple3 (pair a b --> a) (list b) a --> a let t_self_address = tuple0 --> address let t_implicit_account = forall_tc "a" @@ fun a -> [tc_storable a] => tuple1 key_hash --> contract a let t_set_delegate = tuple1 (option key_hash) --> operation From 1bd9ca9d1e745f925b41809caaff876e262b2d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Sun, 9 Feb 2020 22:12:41 +0100 Subject: [PATCH 055/119] Remove message "tput: No value for $TERM and no -T specified" in gitlab builds --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc95f2f4b..d7beb8dc1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,6 +40,7 @@ dont-merge-to-master: - build-and-package-ubuntu-18-04 - build-and-package-ubuntu-19-04 before_script: + - export TERM=dumb - scripts/install_native_dependencies.sh - scripts/install_opam.sh # TODO: or scripts/install_build_environment.sh ? - export PATH="/usr/local/bin${PATH:+:}${PATH:-}" @@ -86,6 +87,7 @@ dont-merge-to-master: before_script: # Install dependencies # rsync is needed by opam to sync a package installed from a local directory with the copy in ~/.opam + - export TERM=dumb - scripts/install_native_dependencies.sh - scripts/install_opam.sh # TODO: or scripts/install_build_environment.sh ? - export PATH="/usr/local/bin${PATH:+:}${PATH:-}" From 140a0fe0b2d76425ee664c4cada1ff00f85822f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:33:05 +0100 Subject: [PATCH 056/119] Temporary debug prints for build-and-package failure --- .gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc95f2f4b..08275dfc8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,8 +25,8 @@ dont-merge-to-master: # To run in sequence and save CPU usage, use stage: build_and_package_binaries stage: test script: - - $build_binary_script "$target_os_family" "$target_os" "$target_os_version" - - $package_binary_script "$target_os_family" "$target_os" "$target_os_version" + - $build_binary_script "$target_os_family" "$target_os" "$target_os_version" || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) + - $package_binary_script "$target_os_family" "$target_os" "$target_os_version" || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) artifacts: paths: - dist/package/**/* @@ -46,12 +46,12 @@ dont-merge-to-master: - eval $(opam config env) - scripts/setup_switch.sh - eval $(opam config env) - - scripts/setup_repos.sh + - scripts/setup_repos.sh || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) # install deps for internal documentation - - scripts/install_vendors_deps.sh + - scripts/install_vendors_deps.sh || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) - opam install -y odoc - - scripts/build_ligo_local.sh + - scripts/build_ligo_local.sh || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) # build with odoc - dune build @doc From 3969df5a5d17538c03faf9d95ca62a35ee4e4282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:35:05 +0100 Subject: [PATCH 057/119] Fixes in SH scripts --- scripts/build_docker_image.sh | 2 +- scripts/distribution/generic/build.sh | 1 + scripts/distribution/generic/package.sh | 1 + scripts/distribution/generic/parameters.sh | 11 +++++++---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/build_docker_image.sh b/scripts/build_docker_image.sh index 260a530c7..0aaefe8c8 100755 --- a/scripts/build_docker_image.sh +++ b/scripts/build_docker_image.sh @@ -1,3 +1,3 @@ #!/bin/sh set -e -docker build -t "${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next" -f ./docker/distribution/debian/distribute.Dockerfile . \ No newline at end of file +docker build -t "${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next" -f ./docker/distribution/debian/distribute.Dockerfile . diff --git a/scripts/distribution/generic/build.sh b/scripts/distribution/generic/build.sh index 49aba15e1..48971962a 100755 --- a/scripts/distribution/generic/build.sh +++ b/scripts/distribution/generic/build.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e dockerfile_name="build" # Generic dockerfile diff --git a/scripts/distribution/generic/package.sh b/scripts/distribution/generic/package.sh index 79be37d41..266678ec4 100755 --- a/scripts/distribution/generic/package.sh +++ b/scripts/distribution/generic/package.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e dockerfile_name="package" dockerfile="" diff --git a/scripts/distribution/generic/parameters.sh b/scripts/distribution/generic/parameters.sh index 3899711d8..98e35e20c 100644 --- a/scripts/distribution/generic/parameters.sh +++ b/scripts/distribution/generic/parameters.sh @@ -1,11 +1,14 @@ +#!/bin/sh +set -e + # This script accepts three arguments, os family, os and its version, # which are subsequently used to fetch the respective docker # image from the ocaml/infrastructure project. # # https://github.com/ocaml/infrastructure/wiki/Containers#selecting-linux-distributions -target_os_family=$1 -target_os=$2 -target_os_version=$3 +target_os_family="$1" +target_os="$2" +target_os_version="$3" # Variables configured at the CI level dist="$LIGO_DIST_DIR" @@ -29,4 +32,4 @@ fi target_os_specific_dockerfile="./docker/distribution/$target_os_family/$target_os/$dockerfile_name.Dockerfile" if test -f "$target_os_specific_dockerfile"; then dockerfile="$target_os_specific_dockerfile" -fi \ No newline at end of file +fi From 8f03d45ec3abfead4c990e6a09c653c667a26ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:35:31 +0100 Subject: [PATCH 058/119] Make more scripts print their commands, to help debug issues in GitLab --- scripts/build_docker_image.sh | 1 + scripts/build_ligo_local.sh | 1 + scripts/distribution/generic/build.sh | 1 + scripts/distribution/generic/package.sh | 1 + scripts/distribution/generic/parameters.sh | 1 + scripts/install_native_dependencies.sh | 1 + scripts/install_vendors_deps.sh | 1 + 7 files changed, 7 insertions(+) diff --git a/scripts/build_docker_image.sh b/scripts/build_docker_image.sh index 0aaefe8c8..f342b424f 100755 --- a/scripts/build_docker_image.sh +++ b/scripts/build_docker_image.sh @@ -1,3 +1,4 @@ #!/bin/sh set -e +set -x docker build -t "${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next" -f ./docker/distribution/debian/distribute.Dockerfile . diff --git a/scripts/build_ligo_local.sh b/scripts/build_ligo_local.sh index b78e4ffd6..fb556805a 100755 --- a/scripts/build_ligo_local.sh +++ b/scripts/build_ligo_local.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x eval $(opam config env) dune build -p ligo diff --git a/scripts/distribution/generic/build.sh b/scripts/distribution/generic/build.sh index 48971962a..968f55a21 100755 --- a/scripts/distribution/generic/build.sh +++ b/scripts/distribution/generic/build.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x dockerfile_name="build" # Generic dockerfile diff --git a/scripts/distribution/generic/package.sh b/scripts/distribution/generic/package.sh index 266678ec4..d9d047e6d 100755 --- a/scripts/distribution/generic/package.sh +++ b/scripts/distribution/generic/package.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x dockerfile_name="package" dockerfile="" diff --git a/scripts/distribution/generic/parameters.sh b/scripts/distribution/generic/parameters.sh index 98e35e20c..2241b9fb0 100644 --- a/scripts/distribution/generic/parameters.sh +++ b/scripts/distribution/generic/parameters.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x # This script accepts three arguments, os family, os and its version, # which are subsequently used to fetch the respective docker diff --git a/scripts/install_native_dependencies.sh b/scripts/install_native_dependencies.sh index 2a0e56903..191ae5502 100755 --- a/scripts/install_native_dependencies.sh +++ b/scripts/install_native_dependencies.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x . /etc/os-release if [ $ID = arch ] diff --git a/scripts/install_vendors_deps.sh b/scripts/install_vendors_deps.sh index 15f9b47d4..5c870ffdc 100755 --- a/scripts/install_vendors_deps.sh +++ b/scripts/install_vendors_deps.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x # Install local dependencies opam install -y --deps-only --with-test ./ligo.opam $(find vendors -name \*.opam) From 35815ce5b41c371227fcf5fe23c69bcc8a217b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:39:31 +0100 Subject: [PATCH 059/119] Removed vendors/UnionFind/UnionFind.install which is a generated file that was .gitignored but had been added by accident --- vendors/UnionFind/UnionFind.install | 36 ----------------------------- 1 file changed, 36 deletions(-) delete mode 100644 vendors/UnionFind/UnionFind.install diff --git a/vendors/UnionFind/UnionFind.install b/vendors/UnionFind/UnionFind.install deleted file mode 100644 index 692984e20..000000000 --- a/vendors/UnionFind/UnionFind.install +++ /dev/null @@ -1,36 +0,0 @@ -lib: [ - "_build/install/default/lib/UnionFind/META" - "_build/install/default/lib/UnionFind/Partition.cmi" - "_build/install/default/lib/UnionFind/Partition.cmti" - "_build/install/default/lib/UnionFind/Partition.mli" - "_build/install/default/lib/UnionFind/Partition0.cmi" - "_build/install/default/lib/UnionFind/Partition0.cmt" - "_build/install/default/lib/UnionFind/Partition0.cmx" - "_build/install/default/lib/UnionFind/Partition0.ml" - "_build/install/default/lib/UnionFind/Partition1.cmi" - "_build/install/default/lib/UnionFind/Partition1.cmt" - "_build/install/default/lib/UnionFind/Partition1.cmx" - "_build/install/default/lib/UnionFind/Partition1.ml" - "_build/install/default/lib/UnionFind/Partition2.cmi" - "_build/install/default/lib/UnionFind/Partition2.cmt" - "_build/install/default/lib/UnionFind/Partition2.cmx" - "_build/install/default/lib/UnionFind/Partition2.ml" - "_build/install/default/lib/UnionFind/Partition3.cmi" - "_build/install/default/lib/UnionFind/Partition3.cmt" - "_build/install/default/lib/UnionFind/Partition3.cmx" - "_build/install/default/lib/UnionFind/Partition3.ml" - "_build/install/default/lib/UnionFind/UnionFind.a" - "_build/install/default/lib/UnionFind/UnionFind.cma" - "_build/install/default/lib/UnionFind/UnionFind.cmxa" - "_build/install/default/lib/UnionFind/UnionFind.cmxs" - "_build/install/default/lib/UnionFind/dune-package" - "_build/install/default/lib/UnionFind/opam" - "_build/install/default/lib/UnionFind/unionFind.cmi" - "_build/install/default/lib/UnionFind/unionFind.cmt" - "_build/install/default/lib/UnionFind/unionFind.cmx" - "_build/install/default/lib/UnionFind/unionFind.ml" -] -doc: [ - "_build/install/default/doc/UnionFind/LICENSE" - "_build/install/default/doc/UnionFind/README.md" -] From 42699256e5bdb936b2653c9d8b491daff5931b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:50:28 +0100 Subject: [PATCH 060/119] Run adt_generator.exe as part of dune runtest --- src/stages/adt_generator/dune | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stages/adt_generator/dune b/src/stages/adt_generator/dune index 4a52c6088..b47ce3191 100644 --- a/src/stages/adt_generator/dune +++ b/src/stages/adt_generator/dune @@ -16,3 +16,8 @@ (libraries ) ) + +(alias + (name runtest) + (action (run ./adt_generator.exe)) +) From 76ad9c47ec724e03d218ab688a1f366db9de6c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:42:32 +0100 Subject: [PATCH 061/119] cleanup --- src/passes/4-typer-old/typer.ml | 1 - src/stages/adt_generator/README | 4 ++-- src/stages/ast_typed/types.ml | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/passes/4-typer-old/typer.ml b/src/passes/4-typer-old/typer.ml index 87f4b2477..7c1cd41a4 100644 --- a/src/passes/4-typer-old/typer.ml +++ b/src/passes/4-typer-old/typer.ml @@ -649,7 +649,6 @@ and type_expression' : environment -> ?tv_opt:O.type_expression -> I.expression let wtype = Format.asprintf "Loops over collections expect lists, sets or maps, got type %a" O.PP.type_expression tv_col in fail @@ simple_error wtype in - let lname = lname in let e' = Environment.add_ez_binder lname input_type e in let%bind body = type_expression' ?tv_opt:(Some tv_out) e' result in let output_type = body.type_expression in diff --git a/src/stages/adt_generator/README b/src/stages/adt_generator/README index 20ecdfd43..2d1b53c3d 100644 --- a/src/stages/adt_generator/README +++ b/src/stages/adt_generator/README @@ -1,6 +1,6 @@ -Build with: +Build & test with: - dune build adt_generator.a + dune build adt_generator.exe && ../../../_build/default/src/stages/adt_generator/adt_generator.exe Run with diff --git a/src/stages/ast_typed/types.ml b/src/stages/ast_typed/types.ml index 5aa323c9b..8804e49e7 100644 --- a/src/stages/ast_typed/types.ml +++ b/src/stages/ast_typed/types.ml @@ -95,7 +95,6 @@ and matching = and ascription = {anno_expr: expression; type_annotation: type_expression} - and environment_element_definition = | ED_binder | ED_declaration of (expression * free_variables) From c3b1c1ac0f2182392ef3947a8c092f10791e6fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:49:13 +0100 Subject: [PATCH 062/119] Removed promote-until-clean because it moves the file out of _build instead of copying it, which causes issues for the gitlab build --- src/stages/adt_generator/dune | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stages/adt_generator/dune b/src/stages/adt_generator/dune index b47ce3191..1729a9aba 100644 --- a/src/stages/adt_generator/dune +++ b/src/stages/adt_generator/dune @@ -2,7 +2,8 @@ (target fold.ml) (deps generator.py) (action (with-stdout-to fold.ml (run python3 ./generator.py))) - (mode (promote (until-clean)))) +; (mode (promote (until-clean))) ; If this is uncommented, then "dune build -p ligo" can't find the file (but "dune build" can) +) ; (library ; (name adt_generator) ; (public_name ligo.adt_generator) From 2588de23951ee90102c3b453451ba56ec71acbd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:49:54 +0100 Subject: [PATCH 063/119] Remove generated file fold.ml --- src/stages/adt_generator/.gitignore | 2 + src/stages/adt_generator/dune | 4 +- src/stages/adt_generator/fold.ml | 185 +--------------------------- 3 files changed, 5 insertions(+), 186 deletions(-) create mode 100644 src/stages/adt_generator/.gitignore diff --git a/src/stages/adt_generator/.gitignore b/src/stages/adt_generator/.gitignore new file mode 100644 index 000000000..9ec2ad34e --- /dev/null +++ b/src/stages/adt_generator/.gitignore @@ -0,0 +1,2 @@ +# This is an auto-generated test file +/generated_fold.ml diff --git a/src/stages/adt_generator/dune b/src/stages/adt_generator/dune index 1729a9aba..d70d8647e 100644 --- a/src/stages/adt_generator/dune +++ b/src/stages/adt_generator/dune @@ -1,7 +1,7 @@ (rule - (target fold.ml) + (target generated_fold.ml) (deps generator.py) - (action (with-stdout-to fold.ml (run python3 ./generator.py))) + (action (with-stdout-to generated_fold.ml (run python3 ./generator.py))) ; (mode (promote (until-clean))) ; If this is uncommented, then "dune build -p ligo" can't find the file (but "dune build" can) ) ; (library diff --git a/src/stages/adt_generator/fold.ml b/src/stages/adt_generator/fold.ml index 4e4c41357..271974820 100644 --- a/src/stages/adt_generator/fold.ml +++ b/src/stages/adt_generator/fold.ml @@ -1,184 +1 @@ -open A - -type root' = - | A' of a' - | B' of int - | C' of string -and a' = - { - a1' : ta1' ; - a2' : ta2' ; - } -and ta1' = - | X' of root' - | Y' of ta2' -and ta2' = - | Z' of ta2' - | W' of unit - -type 'state continue_fold = - { - root : root -> 'state -> (root' * 'state) ; - root_A : a -> 'state -> (a' * 'state) ; - root_B : int -> 'state -> (int * 'state) ; - root_C : string -> 'state -> (string * 'state) ; - a : a -> 'state -> (a' * 'state) ; - a_a1 : ta1 -> 'state -> (ta1' * 'state) ; - a_a2 : ta2 -> 'state -> (ta2' * 'state) ; - ta1 : ta1 -> 'state -> (ta1' * 'state) ; - ta1_X : root -> 'state -> (root' * 'state) ; - ta1_Y : ta2 -> 'state -> (ta2' * 'state) ; - ta2 : ta2 -> 'state -> (ta2' * 'state) ; - ta2_Z : ta2 -> 'state -> (ta2' * 'state) ; - ta2_W : unit -> 'state -> (unit * 'state) ; - } - -type 'state fold_config = - { - root : root -> 'state -> ('state continue_fold) -> (root' * 'state) ; - root_pre_state : root -> 'state -> 'state ; - root_post_state : root -> root' -> 'state -> 'state ; - root_A : a -> 'state -> ('state continue_fold) -> (a' * 'state) ; - root_B : int -> 'state -> ('state continue_fold) -> (int * 'state) ; - root_C : string -> 'state -> ('state continue_fold) -> (string * 'state) ; - a : a -> 'state -> ('state continue_fold) -> (a' * 'state) ; - a_pre_state : a -> 'state -> 'state ; - a_post_state : a -> a' -> 'state -> 'state ; - a_a1 : ta1 -> 'state -> ('state continue_fold) -> (ta1' * 'state) ; - a_a2 : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; - ta1 : ta1 -> 'state -> ('state continue_fold) -> (ta1' * 'state) ; - ta1_pre_state : ta1 -> 'state -> 'state ; - ta1_post_state : ta1 -> ta1' -> 'state -> 'state ; - ta1_X : root -> 'state -> ('state continue_fold) -> (root' * 'state) ; - ta1_Y : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; - ta2 : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; - ta2_pre_state : ta2 -> 'state -> 'state ; - ta2_post_state : ta2 -> ta2' -> 'state -> 'state ; - ta2_Z : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; - ta2_W : unit -> 'state -> ('state continue_fold) -> (unit * 'state) ; - } - -(* Curries the "visitor" argument to the folds (non-customizable traversal functions). *) -let rec mk_continue_fold : type state . state fold_config -> state continue_fold = fun visitor -> - { - root = fold_root visitor ; - root_A = fold_root_A visitor ; - root_B = fold_root_B visitor ; - root_C = fold_root_C visitor ; - a = fold_a visitor ; - a_a1 = fold_a_a1 visitor ; - a_a2 = fold_a_a2 visitor ; - ta1 = fold_ta1 visitor ; - ta1_X = fold_ta1_X visitor ; - ta1_Y = fold_ta1_Y visitor ; - ta2 = fold_ta2 visitor ; - ta2_Z = fold_ta2_Z visitor ; - ta2_W = fold_ta2_W visitor ; -} - -and fold_root : type state . state fold_config -> root -> state -> (root' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - let state = visitor.root_pre_state x state in - let (new_x, state) = visitor.root x state continue_fold in - let state = visitor.root_post_state x new_x state in - (new_x, state) - -and fold_root_A : type state . state fold_config -> a -> state -> (a' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.root_A x state continue_fold - -and fold_root_B : type state . state fold_config -> int -> state -> (int * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.root_B x state continue_fold - -and fold_root_C : type state . state fold_config -> string -> state -> (string * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.root_C x state continue_fold - -and fold_a : type state . state fold_config -> a -> state -> (a' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - let state = visitor.a_pre_state x state in - let (new_x, state) = visitor.a x state continue_fold in - let state = visitor.a_post_state x new_x state in - (new_x, state) - -and fold_a_a1 : type state . state fold_config -> ta1 -> state -> (ta1' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.a_a1 x state continue_fold - -and fold_a_a2 : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.a_a2 x state continue_fold - -and fold_ta1 : type state . state fold_config -> ta1 -> state -> (ta1' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - let state = visitor.ta1_pre_state x state in - let (new_x, state) = visitor.ta1 x state continue_fold in - let state = visitor.ta1_post_state x new_x state in - (new_x, state) - -and fold_ta1_X : type state . state fold_config -> root -> state -> (root' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.ta1_X x state continue_fold - -and fold_ta1_Y : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.ta1_Y x state continue_fold - -and fold_ta2 : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - let state = visitor.ta2_pre_state x state in - let (new_x, state) = visitor.ta2 x state continue_fold in - let state = visitor.ta2_post_state x new_x state in - (new_x, state) - -and fold_ta2_Z : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.ta2_Z x state continue_fold - -and fold_ta2_W : type state . state fold_config -> unit -> state -> (unit * state) = fun visitor x state -> - let continue_fold : state continue_fold = mk_continue_fold visitor in - visitor.ta2_W x state continue_fold - -let no_op : 'a fold_config = { - root = (fun v state continue -> - match v with - | A v -> let (v, state) = continue.root_A v state in (A' v, state) - | B v -> let (v, state) = continue.root_B v state in (B' v, state) - | C v -> let (v, state) = continue.root_C v state in (C' v, state) - ); - root_pre_state = (fun v state -> ignore v; state) ; - root_post_state = (fun v new_v state -> ignore (v, new_v); state) ; - root_A = (fun v state continue -> continue.a v state ) ; - root_B = (fun v state continue -> ignore continue; (v, state) ) ; - root_C = (fun v state continue -> ignore continue; (v, state) ) ; - a = (fun v state continue -> - match v with - { a1; a2; } -> - let (a1', state) = continue.a_a1 a1 state in - let (a2', state) = continue.a_a2 a2 state in - ({ a1'; a2'; }, state) - ); - a_pre_state = (fun v state -> ignore v; state) ; - a_post_state = (fun v new_v state -> ignore (v, new_v); state) ; - a_a1 = (fun v state continue -> continue.ta1 v state ) ; - a_a2 = (fun v state continue -> continue.ta2 v state ) ; - ta1 = (fun v state continue -> - match v with - | X v -> let (v, state) = continue.ta1_X v state in (X' v, state) - | Y v -> let (v, state) = continue.ta1_Y v state in (Y' v, state) - ); - ta1_pre_state = (fun v state -> ignore v; state) ; - ta1_post_state = (fun v new_v state -> ignore (v, new_v); state) ; - ta1_X = (fun v state continue -> continue.root v state ) ; - ta1_Y = (fun v state continue -> continue.ta2 v state ) ; - ta2 = (fun v state continue -> - match v with - | Z v -> let (v, state) = continue.ta2_Z v state in (Z' v, state) - | W v -> let (v, state) = continue.ta2_W v state in (W' v, state) - ); - ta2_pre_state = (fun v state -> ignore v; state) ; - ta2_post_state = (fun v new_v state -> ignore (v, new_v); state) ; - ta2_Z = (fun v state continue -> continue.ta2 v state ) ; - ta2_W = (fun v state continue -> ignore continue; (v, state) ) ; -} +include Generated_fold From 5151a0fd92586af5d899b4ce1d889380aa5b3fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 11:45:44 +0100 Subject: [PATCH 064/119] =?UTF-8?q?ADT=20generator:=20polymorphic=20types?= =?UTF-8?q?=20(list,=20option=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stages/adt_generator/a.ml | 21 +++++++++- src/stages/adt_generator/generator.py | 58 +++++++++++++++++++------- src/stages/adt_generator/use_a_fold.ml | 6 +-- 3 files changed, 65 insertions(+), 20 deletions(-) diff --git a/src/stages/adt_generator/a.ml b/src/stages/adt_generator/a.ml index f1d8b2fb1..34b611dc1 100644 --- a/src/stages/adt_generator/a.ml +++ b/src/stages/adt_generator/a.ml @@ -1,6 +1,6 @@ type root = -| A of a -| B of int +| A of rootA +| B of rootB | C of string and a = { @@ -15,3 +15,20 @@ and ta1 = and ta2 = | Z of ta2 | W of unit + +and rootA = + a list + +and rootB = + int list + +let fold_list v state continue = + let aux = fun (lst', state) elt -> + let (elt', state) = continue elt state in + (elt' :: lst' , state) in + List.fold_left aux ([], state) v + +let fold_option v state continue = + match v with + Some x -> continue x state + | None -> None diff --git a/src/stages/adt_generator/generator.py b/src/stages/adt_generator/generator.py index 65fe21878..48b8c5fd4 100644 --- a/src/stages/adt_generator/generator.py +++ b/src/stages/adt_generator/generator.py @@ -1,34 +1,49 @@ moduleName = "A" +variant="_ _variant" +record="_ _record" +def poly(x): return x adts = [ - # typename, variant?, fields_or_ctors - ("root", True, [ - # ctor, builtin, type - ("A", False, "a"), - ("B", True, "int"), + # typename, kind, fields_or_ctors + ("root", variant, [ + # ctor, builtin?, type + ("A", False, "rootA"), + ("B", False, "rootB"), ("C", True, "string"), ]), - ("a", False, [ + ("a", record, [ + # field, builtin?, type ("a1", False, "ta1"), ("a2", False, "ta2"), ]), - ("ta1", True, [ + ("ta1", variant, [ ("X", False, "root"), ("Y", False, "ta2"), ]), - ("ta2", True, [ + ("ta2", variant, [ ("Z", False, "ta2"), ("W", True, "unit"), ]), + # polymorphic type + ("rootA", poly("list"), + [ + # Position (0..n-1), builtin?, type argument + (0, False, "a") + ]), + ("rootB", poly("list"), + [ + # Position (0..n-1), builtin?, type argument + (0, True, "int") + ]), ] from collections import namedtuple -adt = namedtuple('adt', ['name', 'newName', 'isVariant', 'ctorsOrFields']) +adt = namedtuple('adt', ['name', 'newName', 'kind', 'ctorsOrFields']) ctorOrField = namedtuple('ctorOrField', ['name', 'newName', 'isBuiltin', 'type_', 'newType']) adts = [ adt( name = name, newName = f"{name}'", - isVariant = isVariant, + kind = kind, ctorsOrFields = [ ctorOrField( name = cf, @@ -40,23 +55,32 @@ adts = [ for (cf, isBuiltin, type_) in ctors ], ) - for (name, isVariant, ctors) in adts + for (name, kind, ctors) in adts ] +print("(* This is an auto-generated file. Do not edit. *)") + +print("") print("open %s" % moduleName) print("") for (index, t) in enumerate(adts): typeOrAnd = "type" if index == 0 else "and" print(f"{typeOrAnd} {t.newName} =") - if t.isVariant: + if t.kind == variant: for c in t.ctorsOrFields: print(f" | {c.newName} of {c.newType}") - else: + elif t.kind == record: print(" {") for f in t.ctorsOrFields: print(f" {f.newName} : {f.newType} ;") print(" }") + else: + print(" ", end='') + for a in t.ctorsOrFields: + print(f"{a.newType}", end=' ') + print(t.kind, end='') + print("") print("") print(f"type 'state continue_fold =") @@ -107,10 +131,10 @@ print("let no_op : 'a fold_config = {") for t in adts: print(f" {t.name} = (fun v state continue ->") print(" match v with") - if t.isVariant: + if t.kind == variant: for c in t.ctorsOrFields: print(f" | {c.name} v -> let (v, state) = continue.{t.name}_{c.name} v state in ({c.newName} v, state)") - else: + elif t.kind == record: print(" {", end=' ') for f in t.ctorsOrFields: print(f"{f.name};", end=' ') @@ -121,6 +145,10 @@ for t in adts: for f in t.ctorsOrFields: print(f"{f.newName};", end=' ') print("}, state)") + else: + print(f" v -> fold_{t.kind} v state (", end=' ') + print(", ".join([f"continue.{t.name}_{f.name}" for f in t.ctorsOrFields]), end='') + print(" )") print(" );") print(f" {t.name}_pre_state = (fun v state -> ignore v; state) ;") print(f" {t.name}_post_state = (fun v new_v state -> ignore (v, new_v); state) ;") diff --git a/src/stages/adt_generator/use_a_fold.ml b/src/stages/adt_generator/use_a_fold.ml index 6a73f4782..0fe476d42 100644 --- a/src/stages/adt_generator/use_a_fold.ml +++ b/src/stages/adt_generator/use_a_fold.ml @@ -4,7 +4,7 @@ open Fold (* TODO: how should we plug these into our test framework? *) let () = - let some_root : root = A { a1 = X (A { a1 = X (B 1) ; a2 = W () ; }) ; a2 = Z (W ()) ; } in + let some_root : root = A [{ a1 = X (A [{ a1 = X (B [1;2;3]) ; a2 = W () ; }]) ; a2 = Z (W ()) ; }] in let op = { no_op with a = fun the_a state continue_fold -> @@ -23,7 +23,7 @@ let () = () let () = - let some_root : root = A { a1 = X (A { a1 = X (B 1) ; a2 = W () ; }) ; a2 = Z (W ()) ; } in + let some_root : root = A [{ a1 = X (A [{ a1 = X (B [1;2;3]) ; a2 = W () ; }]) ; a2 = Z (W ()) ; }] in let op = { no_op with a_pre_state = fun _the_a state -> state + 1 } in let state = 0 in let (_, state) = fold_root op some_root state in @@ -33,7 +33,7 @@ let () = () let () = - let some_root : root = A { a1 = X (A { a1 = X (B 1) ; a2 = W () ; }) ; a2 = Z (W ()) ; } in + let some_root : root = A [{ a1 = X (A [{ a1 = X (B [1;2;3]) ; a2 = W () ; }]) ; a2 = Z (W ()) ; }] in let op = { no_op with a_post_state = fun _the_a _new_a state -> state + 1 } in let state = 0 in let (_, state) = fold_root op some_root state in From c71e47f252d9238007a7584b8050e1159fabde5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 19:01:26 +0100 Subject: [PATCH 065/119] Make menhir less verbose, to see error messages in gitlab. --- src/passes/1-parser/cameligo/dune | 2 +- src/passes/1-parser/pascaligo/dune | 2 +- src/passes/1-parser/reasonligo/dune | 2 +- vendors/Preproc/build.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/passes/1-parser/cameligo/dune b/src/passes/1-parser/cameligo/dune index 8824fdcd4..4e6829f1e 100644 --- a/src/passes/1-parser/cameligo/dune +++ b/src/passes/1-parser/cameligo/dune @@ -7,7 +7,7 @@ (menhir (merge_into Parser) (modules ParToken Parser) - (flags -la 1 --table --strict --explain --external-tokens LexToken)) + (flags --table --strict --external-tokens LexToken)) ;; Build of the parser as a library diff --git a/src/passes/1-parser/pascaligo/dune b/src/passes/1-parser/pascaligo/dune index d0d43f02f..e7b9a9a73 100644 --- a/src/passes/1-parser/pascaligo/dune +++ b/src/passes/1-parser/pascaligo/dune @@ -7,7 +7,7 @@ (menhir (merge_into Parser) (modules ParToken Parser) - (flags -la 1 --table --strict --explain --external-tokens LexToken)) + (flags --table --strict --external-tokens LexToken)) ;; Build of the parser as a library diff --git a/src/passes/1-parser/reasonligo/dune b/src/passes/1-parser/reasonligo/dune index 6eb7304b8..a1408af91 100644 --- a/src/passes/1-parser/reasonligo/dune +++ b/src/passes/1-parser/reasonligo/dune @@ -7,7 +7,7 @@ (menhir (merge_into Parser) (modules ParToken Parser) - (flags -la 1 --table --strict --explain --external-tokens LexToken)) + (flags --table --strict --external-tokens LexToken)) ;; Build of the parser as a library diff --git a/vendors/Preproc/build.sh b/vendors/Preproc/build.sh index e9d6546be..30e3ba705 100755 --- a/vendors/Preproc/build.sh +++ b/vendors/Preproc/build.sh @@ -2,7 +2,7 @@ set -x ocamllex.opt Escan.mll ocamllex.opt Preproc.mll -menhir -la 1 Eparser.mly +menhir Eparser.mly ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Etree.ml ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Error.ml ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Etree.ml From e84b739fbc21e87ba1f30588ccb85c537aa18c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 19:07:39 +0100 Subject: [PATCH 066/119] try to debug inside docker --- docker/distribution/generic/build.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/distribution/generic/build.Dockerfile b/docker/distribution/generic/build.Dockerfile index f6c9358e9..bd1ee920a 100644 --- a/docker/distribution/generic/build.Dockerfile +++ b/docker/distribution/generic/build.Dockerfile @@ -29,7 +29,7 @@ RUN opam update # Install ligo RUN sh scripts/install_vendors_deps.sh -RUN opam install -y . +RUN opam install -y . || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) # Use the ligo binary as a default command ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ] From 7bad718135d1bac1cec162904d6f4430dde22088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 19:42:35 +0100 Subject: [PATCH 067/119] Add missing dependency on Python 3 --- scripts/install_build_environment.sh | 3 +++ scripts/install_native_dependencies.sh | 2 ++ tools/webide/Dockerfile | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh index 0dd33f068..628235e70 100755 --- a/scripts/install_build_environment.sh +++ b/scripts/install_build_environment.sh @@ -22,6 +22,7 @@ echo "Installing dependencies.." if [ -n "`uname -a | grep -i arch`" ] then sudo pacman -Sy --noconfirm \ + python \ make \ m4 \ gcc \ @@ -34,6 +35,8 @@ fi if [ -n "`uname -a | grep -i ubuntu`" ] then sudo apt-get install -y make \ + python3 \ + make \ m4 \ gcc \ patch \ diff --git a/scripts/install_native_dependencies.sh b/scripts/install_native_dependencies.sh index 191ae5502..f12e76cb2 100755 --- a/scripts/install_native_dependencies.sh +++ b/scripts/install_native_dependencies.sh @@ -7,6 +7,7 @@ if [ $ID = arch ] then pacman -Sy sudo pacman -S --noconfirm \ + python \ libevdev \ perl \ pkg-config \ @@ -21,6 +22,7 @@ then else apt-get update -qq apt-get -y -qq install \ + python3 \ libev-dev \ perl \ pkg-config \ diff --git a/tools/webide/Dockerfile b/tools/webide/Dockerfile index 4dfa9963a..212b12130 100644 --- a/tools/webide/Dockerfile +++ b/tools/webide/Dockerfile @@ -17,7 +17,7 @@ FROM node:12-buster WORKDIR /app -RUN apt-get update && apt-get -y install libev-dev perl pkg-config libgmp-dev libhidapi-dev m4 libcap-dev bubblewrap rsync +RUN apt-get update && apt-get -y install python3 libev-dev perl pkg-config libgmp-dev libhidapi-dev m4 libcap-dev bubblewrap rsync COPY ligo_deb10.deb /tmp/ligo_deb10.deb RUN dpkg -i /tmp/ligo_deb10.deb && rm /tmp/ligo_deb10.deb From e6dbe60c2cb6e41906eb1884cc51ee59a79771e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 19:54:26 +0100 Subject: [PATCH 068/119] Revert "try to debug inside docker" This reverts commit 37daa934d5e7ba60614a92cf0dfa9d4ebfac59d2. --- docker/distribution/generic/build.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/distribution/generic/build.Dockerfile b/docker/distribution/generic/build.Dockerfile index bd1ee920a..f6c9358e9 100644 --- a/docker/distribution/generic/build.Dockerfile +++ b/docker/distribution/generic/build.Dockerfile @@ -29,7 +29,7 @@ RUN opam update # Install ligo RUN sh scripts/install_vendors_deps.sh -RUN opam install -y . || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) +RUN opam install -y . # Use the ligo binary as a default command ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ] From 76fa4b0549906960b134ca0ac0524120fd850c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 19:54:35 +0100 Subject: [PATCH 069/119] Revert "Make menhir less verbose, to see error messages in gitlab." This reverts commit b5f3ae76b049d4e712bd539b39d771191bc8978b. --- src/passes/1-parser/cameligo/dune | 2 +- src/passes/1-parser/pascaligo/dune | 2 +- src/passes/1-parser/reasonligo/dune | 2 +- vendors/Preproc/build.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/passes/1-parser/cameligo/dune b/src/passes/1-parser/cameligo/dune index 4e6829f1e..8824fdcd4 100644 --- a/src/passes/1-parser/cameligo/dune +++ b/src/passes/1-parser/cameligo/dune @@ -7,7 +7,7 @@ (menhir (merge_into Parser) (modules ParToken Parser) - (flags --table --strict --external-tokens LexToken)) + (flags -la 1 --table --strict --explain --external-tokens LexToken)) ;; Build of the parser as a library diff --git a/src/passes/1-parser/pascaligo/dune b/src/passes/1-parser/pascaligo/dune index e7b9a9a73..d0d43f02f 100644 --- a/src/passes/1-parser/pascaligo/dune +++ b/src/passes/1-parser/pascaligo/dune @@ -7,7 +7,7 @@ (menhir (merge_into Parser) (modules ParToken Parser) - (flags --table --strict --external-tokens LexToken)) + (flags -la 1 --table --strict --explain --external-tokens LexToken)) ;; Build of the parser as a library diff --git a/src/passes/1-parser/reasonligo/dune b/src/passes/1-parser/reasonligo/dune index a1408af91..6eb7304b8 100644 --- a/src/passes/1-parser/reasonligo/dune +++ b/src/passes/1-parser/reasonligo/dune @@ -7,7 +7,7 @@ (menhir (merge_into Parser) (modules ParToken Parser) - (flags --table --strict --external-tokens LexToken)) + (flags -la 1 --table --strict --explain --external-tokens LexToken)) ;; Build of the parser as a library diff --git a/vendors/Preproc/build.sh b/vendors/Preproc/build.sh index 30e3ba705..e9d6546be 100755 --- a/vendors/Preproc/build.sh +++ b/vendors/Preproc/build.sh @@ -2,7 +2,7 @@ set -x ocamllex.opt Escan.mll ocamllex.opt Preproc.mll -menhir Eparser.mly +menhir -la 1 Eparser.mly ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Etree.ml ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Error.ml ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Etree.ml From 0e5002fbeba508e947df119c3ce41732fdb00ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 20:03:47 +0100 Subject: [PATCH 070/119] Revert "Temporary debug prints for build-and-package failure" This reverts commit 81690394b0a6d5194b3f8603a1b066ce856ebfae. --- .gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08275dfc8..fc95f2f4b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,8 +25,8 @@ dont-merge-to-master: # To run in sequence and save CPU usage, use stage: build_and_package_binaries stage: test script: - - $build_binary_script "$target_os_family" "$target_os" "$target_os_version" || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) - - $package_binary_script "$target_os_family" "$target_os" "$target_os_version" || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) + - $build_binary_script "$target_os_family" "$target_os" "$target_os_version" + - $package_binary_script "$target_os_family" "$target_os" "$target_os_version" artifacts: paths: - dist/package/**/* @@ -46,12 +46,12 @@ dont-merge-to-master: - eval $(opam config env) - scripts/setup_switch.sh - eval $(opam config env) - - scripts/setup_repos.sh || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) + - scripts/setup_repos.sh # install deps for internal documentation - - scripts/install_vendors_deps.sh || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) + - scripts/install_vendors_deps.sh - opam install -y odoc - - scripts/build_ligo_local.sh || (cat _build/log || true; find || true; tail -n +1 ~/.opam/log/* || true; false) + - scripts/build_ligo_local.sh # build with odoc - dune build @doc From e86f15e5daa4e8a862a36cacad1eeae6cd2f88e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 20:10:34 +0100 Subject: [PATCH 071/119] Show OPAM logs in case of failure inside of Docker --- docker/distribution/generic/build.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/distribution/generic/build.Dockerfile b/docker/distribution/generic/build.Dockerfile index f6c9358e9..ba01c043c 100644 --- a/docker/distribution/generic/build.Dockerfile +++ b/docker/distribution/generic/build.Dockerfile @@ -29,7 +29,7 @@ RUN opam update # Install ligo RUN sh scripts/install_vendors_deps.sh -RUN opam install -y . +RUN opam install -y . || (tail -n +1 ~/.opam/log/* ; false) # Use the ligo binary as a default command ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ] From c71b413bae97ba19b6d2a20b24aaaec77291af95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 13:45:45 +0100 Subject: [PATCH 072/119] Changelog for mutation & list_iter --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1977c3295..b40924f28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +## [9164206ef1fcf3e577820442b5afbad92d03ffa4] - 2020-02-09 +### Changed +- Mutation of variables inside lambdas passed to list_iter do not have effect anymore. Side-effects used to survive iterations of list_iter via a quirk in the Michelson list_iter. Now, either use a list_fold and explicitly pass through the updated variables (e.g. storage) to the next iteration, or use a `for` loop which automatically detects mutations within the loop body and lifts the affected variables to a record that is passed from iteration to iteration. + ## [Add crypto reference page to docs](https://gitlab.com/ligolang/ligo/-/merge_requests/370) ### Changed - Corrected typo in CameLIGO/ReasonLIGO front end where Crypto.blake2b was 'Crypto.black2b' From b6a6eea5d2e38393c940d314363f88d4d779477c Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Mon, 10 Feb 2020 20:51:48 -0800 Subject: [PATCH 073/119] Add map reference page to doc tests and fix bugs --- gitlab-pages/docs/reference/map.md | 88 +++++++++++++++++++++++++----- src/test/md_file_tests.ml | 1 + 2 files changed, 74 insertions(+), 15 deletions(-) diff --git a/gitlab-pages/docs/reference/map.md b/gitlab-pages/docs/reference/map.md index 9d764b824..08e1a457f 100644 --- a/gitlab-pages/docs/reference/map.md +++ b/gitlab-pages/docs/reference/map.md @@ -3,6 +3,61 @@ id: map-reference title: Map --- +## Defining A Map Type + + + +```pascaligo +type move is int * int +type moveset is map(address, move) +``` + + +```cameligo +type move = int * int +type moveset = (address, move) map +``` + + +```reasonligo +type move = (int, int); +type moveset = map(address, move); +``` + + + +## Creating A Map + + + + +```pascaligo +const moves: moveset = map + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1, 2); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0, 3); +end +``` + + + +```cameligo +let moves: moveset = Map.literal + [ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1, 2)) ; + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0, 3)) ; + ] +``` + + + +```reasonligo +let moves : moveset = + Map.literal([ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1, 2)), + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0, 3)), + ]); +``` + + ## Map.find_opt(k: a', m: (a',b') map) : b' option Retrieve the value associated with a particular key. This version returns an option @@ -99,17 +154,20 @@ let updated_map: moveset = Map.update(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": a ```pascaligo -function patch_ (var m: foobar) : foobar is block { - patch m with map [0 -> 5; 1 -> 6; 2 -> 7] +function set_ (var n : int ; var m : map(int, int)) : map(int, int) is block { + m[23] := n ; } with m ``` ```cameligo - +let add (n,m: int * (int, int) map) : foobar = Map.add 23 n m ``` +```reasonligo +let add = (n: int, m: map(int, int)) : foobar => Map.add(23, n, m); +``` @@ -121,19 +179,19 @@ Remove a key and its associated value from the map. ```pascaligo -function rm (var m : foobar) : foobar is block { +function rm (var m : map(int, int)) : map(int, int) is block { remove 42 from map m } with m ``` ```cameligo -let rm (m: foobar) : foobar = Map.remove 42 m +let rm (m: (int, int) map) : (int, int) map = Map.remove 42 m ``` ```reasonligo -let rm = (m: foobar): foobar => Map.remove(42, m); +let rm = (m: map(int, int)): map(int, int) => Map.remove(42, m); ``` @@ -240,16 +298,16 @@ Test whether a particular key `k` exists in a given map `m`. ```pascaligo -function mem (const k: int; const m: foobar) : bool is map_mem(k, m) +function mem (const k: int; const m: map(int, int)) : bool is map_mem(k, m) ``` ```cameligo -let mem (k,m: int * foobar) : bool = Map.mem k m +let mem (k,m: int * (int, int) map) : bool = Map.mem k m ``` ```reasonligo -let mem = (km: (int, foobar)): bool => Map.mem(km[0], km[1]); +let mem = ((k,m): (int, map(int,int))): bool => Map.mem(k, m); ``` @@ -262,16 +320,16 @@ Create an empty map. ```pascaligo -const empty_map : foobar = map end +const empty_map : map(int, int) = map end ``` ```cameligo -let empty_map : foobar = Map.empty +let empty_map : (int, int) map = Map.empty ``` ```reasonligo -let empty_map: foobar = Map.empty; +let empty_map: map(int, int) = Map.empty; ``` @@ -319,16 +377,16 @@ Get the size of a given map `m`. ```pascaligo -function size_ (const m : foobar) : nat is +function size_ (const m : map(int, int)) : nat is block {skip} with (size(m)) ``` ```cameligo -let size_ (m: foobar) : nat = Map.size m +let size_ (m: (int, int) map) : nat = Map.size m ``` ```reasonligo -let size_ = (m: foobar): nat => Map.size(m); +let size_ = (m: map(int, int)): nat => Map.size(m); ``` diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 86aefeb89..a65ba74a5 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -122,6 +122,7 @@ let md_files = [ "/gitlab-pages/docs/advanced/timestamps-addresses.md"; "/gitlab-pages/docs/api/cli-commands.md"; "/gitlab-pages/docs/api/cheat-sheet.md"; + "/gitlab-pages/docs/reference/map.md"; ] let md_root = "../../gitlab-pages/docs/language-basics/" From 39c0f019988cb660af2c71dc9c29a85c5dbf16fb Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Tue, 11 Feb 2020 01:03:46 -0800 Subject: [PATCH 074/119] Add big_map reference page to doc tests and add big_map `add` to test suite --- gitlab-pages/docs/reference/big_map.md | 84 ++++++++++++++++++++++++++ src/test/contracts/big_map.ligo | 2 + src/test/contracts/big_map.mligo | 4 +- src/test/contracts/big_map.religo | 2 + src/test/integration_tests.ml | 5 ++ src/test/md_file_tests.ml | 1 + 6 files changed, 96 insertions(+), 2 deletions(-) diff --git a/gitlab-pages/docs/reference/big_map.md b/gitlab-pages/docs/reference/big_map.md index 861429c34..4dd6ba3af 100644 --- a/gitlab-pages/docs/reference/big_map.md +++ b/gitlab-pages/docs/reference/big_map.md @@ -3,6 +3,67 @@ id: big-map-reference title: Big Map --- +## Defining A Big Map Type + + + +```pascaligo +type move is (int * int) +type moveset is big_map (address, move) +type foo is big_map (int, int) +``` + + +```cameligo +type move = int * int +type moveset = (address, move) big_map +type foo = (int, int) big_map +``` + + +```reasonligo +type move = (int, int); +type moveset = big_map(address, move); +type foo = big_map(int, int); +``` + + + +## Creating A Map + + + + +```pascaligo +const moves: moveset = + big_map + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> (1,2); + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> (0,3); + end +``` + + + +```cameligo +let moves: moveset = + Big_map.literal [ + (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), (1,2)); + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), (0,3)); + ] +``` + + + +```reasonligo +let moves: moveset = + Big_map.literal ([ + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address, (1,2)), + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address, (0,3)), + ]); +``` + + + ## Big_map.find_opt(k: a', m: (a',b') big_map) : b' option Retrieve the value associated with a particular key. This version returns an option @@ -96,6 +157,29 @@ let updated_map : moveset = ## Big_map.add(k: a', v: b', m: (a', b') big_map) : (a', b') big_map +Add a key and its associated value to the big map. + + + + +```pascaligo +function set_ (var n : int ; var m : foo) : foo is block { + m[23] := n ; +} with m +``` + + +```cameligo +let add (n,m : int * foo) : foo = Big_map.add 23 n m +``` + + +```reasonligo +let add = ((n,m): (int, foo)): foo => Big_map.add(23, n, m); +``` + + + ## Big_map.remove(k: a', m: (a', b') big_map) : (a', b') big_map Remove a key and its associated value from the big map. diff --git a/src/test/contracts/big_map.ligo b/src/test/contracts/big_map.ligo index e6ab78c58..a24e09e97 100644 --- a/src/test/contracts/big_map.ligo +++ b/src/test/contracts/big_map.ligo @@ -13,6 +13,8 @@ function set_ (var n : int ; var m : foo) : foo is block { m[23] := n ; } with m +function add (var n : int ; var m : foo) : foo is set_(n,m) + function rm (var m : foo) : foo is block { remove 42 from map m; } with m diff --git a/src/test/contracts/big_map.mligo b/src/test/contracts/big_map.mligo index eb06bd5f4..35a173f82 100644 --- a/src/test/contracts/big_map.mligo +++ b/src/test/contracts/big_map.mligo @@ -1,8 +1,8 @@ type foo = (int, int) big_map -let set_2 (n : int) (m : foo) : foo = Big_map.update 23 (Some n) m +let set_ (n, m: int * foo) : foo = Big_map.update 23 (Some n) m -let set_ (t: int * foo) : foo = set_2 t.0 t.1 +let add (n,m : int * foo) : foo = Big_map.add 23 n m let rm (m : foo) : foo = Big_map.remove 42 m diff --git a/src/test/contracts/big_map.religo b/src/test/contracts/big_map.religo index 03b13b404..92f5431c8 100644 --- a/src/test/contracts/big_map.religo +++ b/src/test/contracts/big_map.religo @@ -4,6 +4,8 @@ let set2 = (n: int, m: foo): foo => Big_map.update(23, Some(n), m); let set_ = (x: (int, foo)): foo => set2(x[0], x[1]); +let add = ((n,m): (int, foo)): foo => Big_map.add(23, n, m); + let rm = (m: foo): foo => Big_map.remove(42, m); let gf = (m: foo): int => Big_map.find(23, m); diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 204d2fc55..4128a301f 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1073,6 +1073,11 @@ let big_map_ type_f path : unit result = let make_expected = fun n -> ez [(23 , n) ; (42 , 0)] in expect_eq_n_pos_small program "set_" make_input make_expected in + let%bind () = + let input = (e_pair (e_int 23) (ez [(42, 42)])) in + let expected = ez [(23, 23) ; (42, 42)] in + expect_eq program "add" input expected + in let%bind () = let make_input = fun n -> ez [(23, n) ; (42, 4)] in let make_expected = fun _ -> e_some @@ e_int 4 in diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 86aefeb89..9d1d3cf0a 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -122,6 +122,7 @@ let md_files = [ "/gitlab-pages/docs/advanced/timestamps-addresses.md"; "/gitlab-pages/docs/api/cli-commands.md"; "/gitlab-pages/docs/api/cheat-sheet.md"; + "/gitlab-pages/docs/reference/big_map.md"; ] let md_root = "../../gitlab-pages/docs/language-basics/" From 702416a0a7bddeb01e9ff1246c5660518a10efd9 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Tue, 11 Feb 2020 11:05:43 +0100 Subject: [PATCH 075/119] fix continuation and add some comments --- src/passes/operators/operators.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index d9a5d4a9e..6c75f1f01 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -382,7 +382,7 @@ module Typer = struct let t_set_remove = forall "a" @@ fun a -> tuple2 a (set a) --> set a let t_not = tuple1 bool --> bool - let t_continuation = forall "a" @@ fun a -> pair bool a + let t_continuation = forall "a" @@ fun a -> tuple2 bool a --> pair bool a let t_fold_while = forall "a" @@ fun a -> tuple2 (a --> pair bool a) a --> a let t_neg = tuple1 int --> int let t_and = tuple2 bool bool --> bool @@ -394,9 +394,11 @@ module Typer = struct let t_concat = forall_tc "a" @@ fun a -> [tc_concatable a] => tuple2 a a --> a let t_set_empty = forall_tc "a" @@ fun a -> [tc_comparable a] => tuple0 --> set a let t_set_iter = forall_tc "a" @@ fun a -> [tc_comparable a] => tuple2 (a --> unit) (set a) --> unit + (* TODO: check that the implementation has this type *) let t_set_fold = forall2_tc "a" "b" @@ fun a b -> [tc_comparable b] => tuple3 (pair a b --> a) (set b) a --> a let t_list_iter = forall "a" @@ fun a -> tuple2 (a --> unit) (list a) --> unit let t_list_map = forall "a" @@ fun a -> tuple2 (a --> a) (list a) --> (list a) + (* TODO: check that the implementation has this type *) let t_list_fold = forall2 "a" "b" @@ fun a b -> tuple3 (pair a b --> a) (list b) a --> a let t_self_address = tuple0 --> address let t_implicit_account = forall_tc "a" @@ fun a -> [tc_storable a] => tuple1 key_hash --> contract a From 8b83e375bd189b3c32629a34e1ab2db787478656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Lesenechal?= Date: Tue, 11 Feb 2020 10:45:08 +0000 Subject: [PATCH 076/119] Revert "Merge branch 'feature/adt-generator-poly-3' into 'dev'" This reverts merge request !403 --- docker/distribution/generic/build.Dockerfile | 2 +- scripts/build_docker_image.sh | 3 +- scripts/build_ligo_local.sh | 1 - scripts/distribution/generic/build.sh | 2 - scripts/distribution/generic/package.sh | 2 - scripts/distribution/generic/parameters.sh | 12 +- scripts/install_build_environment.sh | 3 - scripts/install_native_dependencies.sh | 3 - scripts/install_vendors_deps.sh | 1 - src/passes/4-typer-old/typer.ml | 1 + src/stages/adt_generator/.gitignore | 2 - src/stages/adt_generator/README | 4 +- src/stages/adt_generator/a.ml | 21 +-- src/stages/adt_generator/dune | 12 +- src/stages/adt_generator/fold.ml | 185 ++++++++++++++++++- src/stages/adt_generator/generator.py | 58 ++---- src/stages/adt_generator/use_a_fold.ml | 6 +- src/stages/ast_typed/types.ml | 1 + tools/webide/Dockerfile | 2 +- vendors/UnionFind/UnionFind.install | 36 ++++ 20 files changed, 254 insertions(+), 103 deletions(-) delete mode 100644 src/stages/adt_generator/.gitignore create mode 100644 vendors/UnionFind/UnionFind.install diff --git a/docker/distribution/generic/build.Dockerfile b/docker/distribution/generic/build.Dockerfile index ba01c043c..f6c9358e9 100644 --- a/docker/distribution/generic/build.Dockerfile +++ b/docker/distribution/generic/build.Dockerfile @@ -29,7 +29,7 @@ RUN opam update # Install ligo RUN sh scripts/install_vendors_deps.sh -RUN opam install -y . || (tail -n +1 ~/.opam/log/* ; false) +RUN opam install -y . # Use the ligo binary as a default command ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ] diff --git a/scripts/build_docker_image.sh b/scripts/build_docker_image.sh index f342b424f..260a530c7 100755 --- a/scripts/build_docker_image.sh +++ b/scripts/build_docker_image.sh @@ -1,4 +1,3 @@ #!/bin/sh set -e -set -x -docker build -t "${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next" -f ./docker/distribution/debian/distribute.Dockerfile . +docker build -t "${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next" -f ./docker/distribution/debian/distribute.Dockerfile . \ No newline at end of file diff --git a/scripts/build_ligo_local.sh b/scripts/build_ligo_local.sh index fb556805a..b78e4ffd6 100755 --- a/scripts/build_ligo_local.sh +++ b/scripts/build_ligo_local.sh @@ -1,6 +1,5 @@ #!/bin/sh set -e -set -x eval $(opam config env) dune build -p ligo diff --git a/scripts/distribution/generic/build.sh b/scripts/distribution/generic/build.sh index 968f55a21..49aba15e1 100755 --- a/scripts/distribution/generic/build.sh +++ b/scripts/distribution/generic/build.sh @@ -1,6 +1,4 @@ #!/bin/sh -set -e -set -x dockerfile_name="build" # Generic dockerfile diff --git a/scripts/distribution/generic/package.sh b/scripts/distribution/generic/package.sh index d9d047e6d..79be37d41 100755 --- a/scripts/distribution/generic/package.sh +++ b/scripts/distribution/generic/package.sh @@ -1,6 +1,4 @@ #!/bin/sh -set -e -set -x dockerfile_name="package" dockerfile="" diff --git a/scripts/distribution/generic/parameters.sh b/scripts/distribution/generic/parameters.sh index 2241b9fb0..3899711d8 100644 --- a/scripts/distribution/generic/parameters.sh +++ b/scripts/distribution/generic/parameters.sh @@ -1,15 +1,11 @@ -#!/bin/sh -set -e -set -x - # This script accepts three arguments, os family, os and its version, # which are subsequently used to fetch the respective docker # image from the ocaml/infrastructure project. # # https://github.com/ocaml/infrastructure/wiki/Containers#selecting-linux-distributions -target_os_family="$1" -target_os="$2" -target_os_version="$3" +target_os_family=$1 +target_os=$2 +target_os_version=$3 # Variables configured at the CI level dist="$LIGO_DIST_DIR" @@ -33,4 +29,4 @@ fi target_os_specific_dockerfile="./docker/distribution/$target_os_family/$target_os/$dockerfile_name.Dockerfile" if test -f "$target_os_specific_dockerfile"; then dockerfile="$target_os_specific_dockerfile" -fi +fi \ No newline at end of file diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh index 628235e70..0dd33f068 100755 --- a/scripts/install_build_environment.sh +++ b/scripts/install_build_environment.sh @@ -22,7 +22,6 @@ echo "Installing dependencies.." if [ -n "`uname -a | grep -i arch`" ] then sudo pacman -Sy --noconfirm \ - python \ make \ m4 \ gcc \ @@ -35,8 +34,6 @@ fi if [ -n "`uname -a | grep -i ubuntu`" ] then sudo apt-get install -y make \ - python3 \ - make \ m4 \ gcc \ patch \ diff --git a/scripts/install_native_dependencies.sh b/scripts/install_native_dependencies.sh index f12e76cb2..2a0e56903 100755 --- a/scripts/install_native_dependencies.sh +++ b/scripts/install_native_dependencies.sh @@ -1,13 +1,11 @@ #!/bin/sh set -e -set -x . /etc/os-release if [ $ID = arch ] then pacman -Sy sudo pacman -S --noconfirm \ - python \ libevdev \ perl \ pkg-config \ @@ -22,7 +20,6 @@ then else apt-get update -qq apt-get -y -qq install \ - python3 \ libev-dev \ perl \ pkg-config \ diff --git a/scripts/install_vendors_deps.sh b/scripts/install_vendors_deps.sh index 5c870ffdc..15f9b47d4 100755 --- a/scripts/install_vendors_deps.sh +++ b/scripts/install_vendors_deps.sh @@ -1,6 +1,5 @@ #!/bin/sh set -e -set -x # Install local dependencies opam install -y --deps-only --with-test ./ligo.opam $(find vendors -name \*.opam) diff --git a/src/passes/4-typer-old/typer.ml b/src/passes/4-typer-old/typer.ml index 7c1cd41a4..87f4b2477 100644 --- a/src/passes/4-typer-old/typer.ml +++ b/src/passes/4-typer-old/typer.ml @@ -649,6 +649,7 @@ and type_expression' : environment -> ?tv_opt:O.type_expression -> I.expression let wtype = Format.asprintf "Loops over collections expect lists, sets or maps, got type %a" O.PP.type_expression tv_col in fail @@ simple_error wtype in + let lname = lname in let e' = Environment.add_ez_binder lname input_type e in let%bind body = type_expression' ?tv_opt:(Some tv_out) e' result in let output_type = body.type_expression in diff --git a/src/stages/adt_generator/.gitignore b/src/stages/adt_generator/.gitignore deleted file mode 100644 index 9ec2ad34e..000000000 --- a/src/stages/adt_generator/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# This is an auto-generated test file -/generated_fold.ml diff --git a/src/stages/adt_generator/README b/src/stages/adt_generator/README index 2d1b53c3d..20ecdfd43 100644 --- a/src/stages/adt_generator/README +++ b/src/stages/adt_generator/README @@ -1,6 +1,6 @@ -Build & test with: +Build with: - dune build adt_generator.exe && ../../../_build/default/src/stages/adt_generator/adt_generator.exe + dune build adt_generator.a Run with diff --git a/src/stages/adt_generator/a.ml b/src/stages/adt_generator/a.ml index 34b611dc1..f1d8b2fb1 100644 --- a/src/stages/adt_generator/a.ml +++ b/src/stages/adt_generator/a.ml @@ -1,6 +1,6 @@ type root = -| A of rootA -| B of rootB +| A of a +| B of int | C of string and a = { @@ -15,20 +15,3 @@ and ta1 = and ta2 = | Z of ta2 | W of unit - -and rootA = - a list - -and rootB = - int list - -let fold_list v state continue = - let aux = fun (lst', state) elt -> - let (elt', state) = continue elt state in - (elt' :: lst' , state) in - List.fold_left aux ([], state) v - -let fold_option v state continue = - match v with - Some x -> continue x state - | None -> None diff --git a/src/stages/adt_generator/dune b/src/stages/adt_generator/dune index d70d8647e..4a52c6088 100644 --- a/src/stages/adt_generator/dune +++ b/src/stages/adt_generator/dune @@ -1,9 +1,8 @@ (rule - (target generated_fold.ml) + (target fold.ml) (deps generator.py) - (action (with-stdout-to generated_fold.ml (run python3 ./generator.py))) -; (mode (promote (until-clean))) ; If this is uncommented, then "dune build -p ligo" can't find the file (but "dune build" can) -) + (action (with-stdout-to fold.ml (run python3 ./generator.py))) + (mode (promote (until-clean)))) ; (library ; (name adt_generator) ; (public_name ligo.adt_generator) @@ -17,8 +16,3 @@ (libraries ) ) - -(alias - (name runtest) - (action (run ./adt_generator.exe)) -) diff --git a/src/stages/adt_generator/fold.ml b/src/stages/adt_generator/fold.ml index 271974820..4e4c41357 100644 --- a/src/stages/adt_generator/fold.ml +++ b/src/stages/adt_generator/fold.ml @@ -1 +1,184 @@ -include Generated_fold +open A + +type root' = + | A' of a' + | B' of int + | C' of string +and a' = + { + a1' : ta1' ; + a2' : ta2' ; + } +and ta1' = + | X' of root' + | Y' of ta2' +and ta2' = + | Z' of ta2' + | W' of unit + +type 'state continue_fold = + { + root : root -> 'state -> (root' * 'state) ; + root_A : a -> 'state -> (a' * 'state) ; + root_B : int -> 'state -> (int * 'state) ; + root_C : string -> 'state -> (string * 'state) ; + a : a -> 'state -> (a' * 'state) ; + a_a1 : ta1 -> 'state -> (ta1' * 'state) ; + a_a2 : ta2 -> 'state -> (ta2' * 'state) ; + ta1 : ta1 -> 'state -> (ta1' * 'state) ; + ta1_X : root -> 'state -> (root' * 'state) ; + ta1_Y : ta2 -> 'state -> (ta2' * 'state) ; + ta2 : ta2 -> 'state -> (ta2' * 'state) ; + ta2_Z : ta2 -> 'state -> (ta2' * 'state) ; + ta2_W : unit -> 'state -> (unit * 'state) ; + } + +type 'state fold_config = + { + root : root -> 'state -> ('state continue_fold) -> (root' * 'state) ; + root_pre_state : root -> 'state -> 'state ; + root_post_state : root -> root' -> 'state -> 'state ; + root_A : a -> 'state -> ('state continue_fold) -> (a' * 'state) ; + root_B : int -> 'state -> ('state continue_fold) -> (int * 'state) ; + root_C : string -> 'state -> ('state continue_fold) -> (string * 'state) ; + a : a -> 'state -> ('state continue_fold) -> (a' * 'state) ; + a_pre_state : a -> 'state -> 'state ; + a_post_state : a -> a' -> 'state -> 'state ; + a_a1 : ta1 -> 'state -> ('state continue_fold) -> (ta1' * 'state) ; + a_a2 : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; + ta1 : ta1 -> 'state -> ('state continue_fold) -> (ta1' * 'state) ; + ta1_pre_state : ta1 -> 'state -> 'state ; + ta1_post_state : ta1 -> ta1' -> 'state -> 'state ; + ta1_X : root -> 'state -> ('state continue_fold) -> (root' * 'state) ; + ta1_Y : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; + ta2 : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; + ta2_pre_state : ta2 -> 'state -> 'state ; + ta2_post_state : ta2 -> ta2' -> 'state -> 'state ; + ta2_Z : ta2 -> 'state -> ('state continue_fold) -> (ta2' * 'state) ; + ta2_W : unit -> 'state -> ('state continue_fold) -> (unit * 'state) ; + } + +(* Curries the "visitor" argument to the folds (non-customizable traversal functions). *) +let rec mk_continue_fold : type state . state fold_config -> state continue_fold = fun visitor -> + { + root = fold_root visitor ; + root_A = fold_root_A visitor ; + root_B = fold_root_B visitor ; + root_C = fold_root_C visitor ; + a = fold_a visitor ; + a_a1 = fold_a_a1 visitor ; + a_a2 = fold_a_a2 visitor ; + ta1 = fold_ta1 visitor ; + ta1_X = fold_ta1_X visitor ; + ta1_Y = fold_ta1_Y visitor ; + ta2 = fold_ta2 visitor ; + ta2_Z = fold_ta2_Z visitor ; + ta2_W = fold_ta2_W visitor ; +} + +and fold_root : type state . state fold_config -> root -> state -> (root' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + let state = visitor.root_pre_state x state in + let (new_x, state) = visitor.root x state continue_fold in + let state = visitor.root_post_state x new_x state in + (new_x, state) + +and fold_root_A : type state . state fold_config -> a -> state -> (a' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.root_A x state continue_fold + +and fold_root_B : type state . state fold_config -> int -> state -> (int * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.root_B x state continue_fold + +and fold_root_C : type state . state fold_config -> string -> state -> (string * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.root_C x state continue_fold + +and fold_a : type state . state fold_config -> a -> state -> (a' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + let state = visitor.a_pre_state x state in + let (new_x, state) = visitor.a x state continue_fold in + let state = visitor.a_post_state x new_x state in + (new_x, state) + +and fold_a_a1 : type state . state fold_config -> ta1 -> state -> (ta1' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.a_a1 x state continue_fold + +and fold_a_a2 : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.a_a2 x state continue_fold + +and fold_ta1 : type state . state fold_config -> ta1 -> state -> (ta1' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + let state = visitor.ta1_pre_state x state in + let (new_x, state) = visitor.ta1 x state continue_fold in + let state = visitor.ta1_post_state x new_x state in + (new_x, state) + +and fold_ta1_X : type state . state fold_config -> root -> state -> (root' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.ta1_X x state continue_fold + +and fold_ta1_Y : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.ta1_Y x state continue_fold + +and fold_ta2 : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + let state = visitor.ta2_pre_state x state in + let (new_x, state) = visitor.ta2 x state continue_fold in + let state = visitor.ta2_post_state x new_x state in + (new_x, state) + +and fold_ta2_Z : type state . state fold_config -> ta2 -> state -> (ta2' * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.ta2_Z x state continue_fold + +and fold_ta2_W : type state . state fold_config -> unit -> state -> (unit * state) = fun visitor x state -> + let continue_fold : state continue_fold = mk_continue_fold visitor in + visitor.ta2_W x state continue_fold + +let no_op : 'a fold_config = { + root = (fun v state continue -> + match v with + | A v -> let (v, state) = continue.root_A v state in (A' v, state) + | B v -> let (v, state) = continue.root_B v state in (B' v, state) + | C v -> let (v, state) = continue.root_C v state in (C' v, state) + ); + root_pre_state = (fun v state -> ignore v; state) ; + root_post_state = (fun v new_v state -> ignore (v, new_v); state) ; + root_A = (fun v state continue -> continue.a v state ) ; + root_B = (fun v state continue -> ignore continue; (v, state) ) ; + root_C = (fun v state continue -> ignore continue; (v, state) ) ; + a = (fun v state continue -> + match v with + { a1; a2; } -> + let (a1', state) = continue.a_a1 a1 state in + let (a2', state) = continue.a_a2 a2 state in + ({ a1'; a2'; }, state) + ); + a_pre_state = (fun v state -> ignore v; state) ; + a_post_state = (fun v new_v state -> ignore (v, new_v); state) ; + a_a1 = (fun v state continue -> continue.ta1 v state ) ; + a_a2 = (fun v state continue -> continue.ta2 v state ) ; + ta1 = (fun v state continue -> + match v with + | X v -> let (v, state) = continue.ta1_X v state in (X' v, state) + | Y v -> let (v, state) = continue.ta1_Y v state in (Y' v, state) + ); + ta1_pre_state = (fun v state -> ignore v; state) ; + ta1_post_state = (fun v new_v state -> ignore (v, new_v); state) ; + ta1_X = (fun v state continue -> continue.root v state ) ; + ta1_Y = (fun v state continue -> continue.ta2 v state ) ; + ta2 = (fun v state continue -> + match v with + | Z v -> let (v, state) = continue.ta2_Z v state in (Z' v, state) + | W v -> let (v, state) = continue.ta2_W v state in (W' v, state) + ); + ta2_pre_state = (fun v state -> ignore v; state) ; + ta2_post_state = (fun v new_v state -> ignore (v, new_v); state) ; + ta2_Z = (fun v state continue -> continue.ta2 v state ) ; + ta2_W = (fun v state continue -> ignore continue; (v, state) ) ; +} diff --git a/src/stages/adt_generator/generator.py b/src/stages/adt_generator/generator.py index 48b8c5fd4..65fe21878 100644 --- a/src/stages/adt_generator/generator.py +++ b/src/stages/adt_generator/generator.py @@ -1,49 +1,34 @@ moduleName = "A" -variant="_ _variant" -record="_ _record" -def poly(x): return x adts = [ - # typename, kind, fields_or_ctors - ("root", variant, [ - # ctor, builtin?, type - ("A", False, "rootA"), - ("B", False, "rootB"), + # typename, variant?, fields_or_ctors + ("root", True, [ + # ctor, builtin, type + ("A", False, "a"), + ("B", True, "int"), ("C", True, "string"), ]), - ("a", record, [ - # field, builtin?, type + ("a", False, [ ("a1", False, "ta1"), ("a2", False, "ta2"), ]), - ("ta1", variant, [ + ("ta1", True, [ ("X", False, "root"), ("Y", False, "ta2"), ]), - ("ta2", variant, [ + ("ta2", True, [ ("Z", False, "ta2"), ("W", True, "unit"), ]), - # polymorphic type - ("rootA", poly("list"), - [ - # Position (0..n-1), builtin?, type argument - (0, False, "a") - ]), - ("rootB", poly("list"), - [ - # Position (0..n-1), builtin?, type argument - (0, True, "int") - ]), ] from collections import namedtuple -adt = namedtuple('adt', ['name', 'newName', 'kind', 'ctorsOrFields']) +adt = namedtuple('adt', ['name', 'newName', 'isVariant', 'ctorsOrFields']) ctorOrField = namedtuple('ctorOrField', ['name', 'newName', 'isBuiltin', 'type_', 'newType']) adts = [ adt( name = name, newName = f"{name}'", - kind = kind, + isVariant = isVariant, ctorsOrFields = [ ctorOrField( name = cf, @@ -55,32 +40,23 @@ adts = [ for (cf, isBuiltin, type_) in ctors ], ) - for (name, kind, ctors) in adts + for (name, isVariant, ctors) in adts ] -print("(* This is an auto-generated file. Do not edit. *)") - -print("") print("open %s" % moduleName) print("") for (index, t) in enumerate(adts): typeOrAnd = "type" if index == 0 else "and" print(f"{typeOrAnd} {t.newName} =") - if t.kind == variant: + if t.isVariant: for c in t.ctorsOrFields: print(f" | {c.newName} of {c.newType}") - elif t.kind == record: + else: print(" {") for f in t.ctorsOrFields: print(f" {f.newName} : {f.newType} ;") print(" }") - else: - print(" ", end='') - for a in t.ctorsOrFields: - print(f"{a.newType}", end=' ') - print(t.kind, end='') - print("") print("") print(f"type 'state continue_fold =") @@ -131,10 +107,10 @@ print("let no_op : 'a fold_config = {") for t in adts: print(f" {t.name} = (fun v state continue ->") print(" match v with") - if t.kind == variant: + if t.isVariant: for c in t.ctorsOrFields: print(f" | {c.name} v -> let (v, state) = continue.{t.name}_{c.name} v state in ({c.newName} v, state)") - elif t.kind == record: + else: print(" {", end=' ') for f in t.ctorsOrFields: print(f"{f.name};", end=' ') @@ -145,10 +121,6 @@ for t in adts: for f in t.ctorsOrFields: print(f"{f.newName};", end=' ') print("}, state)") - else: - print(f" v -> fold_{t.kind} v state (", end=' ') - print(", ".join([f"continue.{t.name}_{f.name}" for f in t.ctorsOrFields]), end='') - print(" )") print(" );") print(f" {t.name}_pre_state = (fun v state -> ignore v; state) ;") print(f" {t.name}_post_state = (fun v new_v state -> ignore (v, new_v); state) ;") diff --git a/src/stages/adt_generator/use_a_fold.ml b/src/stages/adt_generator/use_a_fold.ml index 0fe476d42..6a73f4782 100644 --- a/src/stages/adt_generator/use_a_fold.ml +++ b/src/stages/adt_generator/use_a_fold.ml @@ -4,7 +4,7 @@ open Fold (* TODO: how should we plug these into our test framework? *) let () = - let some_root : root = A [{ a1 = X (A [{ a1 = X (B [1;2;3]) ; a2 = W () ; }]) ; a2 = Z (W ()) ; }] in + let some_root : root = A { a1 = X (A { a1 = X (B 1) ; a2 = W () ; }) ; a2 = Z (W ()) ; } in let op = { no_op with a = fun the_a state continue_fold -> @@ -23,7 +23,7 @@ let () = () let () = - let some_root : root = A [{ a1 = X (A [{ a1 = X (B [1;2;3]) ; a2 = W () ; }]) ; a2 = Z (W ()) ; }] in + let some_root : root = A { a1 = X (A { a1 = X (B 1) ; a2 = W () ; }) ; a2 = Z (W ()) ; } in let op = { no_op with a_pre_state = fun _the_a state -> state + 1 } in let state = 0 in let (_, state) = fold_root op some_root state in @@ -33,7 +33,7 @@ let () = () let () = - let some_root : root = A [{ a1 = X (A [{ a1 = X (B [1;2;3]) ; a2 = W () ; }]) ; a2 = Z (W ()) ; }] in + let some_root : root = A { a1 = X (A { a1 = X (B 1) ; a2 = W () ; }) ; a2 = Z (W ()) ; } in let op = { no_op with a_post_state = fun _the_a _new_a state -> state + 1 } in let state = 0 in let (_, state) = fold_root op some_root state in diff --git a/src/stages/ast_typed/types.ml b/src/stages/ast_typed/types.ml index 8804e49e7..5aa323c9b 100644 --- a/src/stages/ast_typed/types.ml +++ b/src/stages/ast_typed/types.ml @@ -95,6 +95,7 @@ and matching = and ascription = {anno_expr: expression; type_annotation: type_expression} + and environment_element_definition = | ED_binder | ED_declaration of (expression * free_variables) diff --git a/tools/webide/Dockerfile b/tools/webide/Dockerfile index 212b12130..4dfa9963a 100644 --- a/tools/webide/Dockerfile +++ b/tools/webide/Dockerfile @@ -17,7 +17,7 @@ FROM node:12-buster WORKDIR /app -RUN apt-get update && apt-get -y install python3 libev-dev perl pkg-config libgmp-dev libhidapi-dev m4 libcap-dev bubblewrap rsync +RUN apt-get update && apt-get -y install libev-dev perl pkg-config libgmp-dev libhidapi-dev m4 libcap-dev bubblewrap rsync COPY ligo_deb10.deb /tmp/ligo_deb10.deb RUN dpkg -i /tmp/ligo_deb10.deb && rm /tmp/ligo_deb10.deb diff --git a/vendors/UnionFind/UnionFind.install b/vendors/UnionFind/UnionFind.install new file mode 100644 index 000000000..692984e20 --- /dev/null +++ b/vendors/UnionFind/UnionFind.install @@ -0,0 +1,36 @@ +lib: [ + "_build/install/default/lib/UnionFind/META" + "_build/install/default/lib/UnionFind/Partition.cmi" + "_build/install/default/lib/UnionFind/Partition.cmti" + "_build/install/default/lib/UnionFind/Partition.mli" + "_build/install/default/lib/UnionFind/Partition0.cmi" + "_build/install/default/lib/UnionFind/Partition0.cmt" + "_build/install/default/lib/UnionFind/Partition0.cmx" + "_build/install/default/lib/UnionFind/Partition0.ml" + "_build/install/default/lib/UnionFind/Partition1.cmi" + "_build/install/default/lib/UnionFind/Partition1.cmt" + "_build/install/default/lib/UnionFind/Partition1.cmx" + "_build/install/default/lib/UnionFind/Partition1.ml" + "_build/install/default/lib/UnionFind/Partition2.cmi" + "_build/install/default/lib/UnionFind/Partition2.cmt" + "_build/install/default/lib/UnionFind/Partition2.cmx" + "_build/install/default/lib/UnionFind/Partition2.ml" + "_build/install/default/lib/UnionFind/Partition3.cmi" + "_build/install/default/lib/UnionFind/Partition3.cmt" + "_build/install/default/lib/UnionFind/Partition3.cmx" + "_build/install/default/lib/UnionFind/Partition3.ml" + "_build/install/default/lib/UnionFind/UnionFind.a" + "_build/install/default/lib/UnionFind/UnionFind.cma" + "_build/install/default/lib/UnionFind/UnionFind.cmxa" + "_build/install/default/lib/UnionFind/UnionFind.cmxs" + "_build/install/default/lib/UnionFind/dune-package" + "_build/install/default/lib/UnionFind/opam" + "_build/install/default/lib/UnionFind/unionFind.cmi" + "_build/install/default/lib/UnionFind/unionFind.cmt" + "_build/install/default/lib/UnionFind/unionFind.cmx" + "_build/install/default/lib/UnionFind/unionFind.ml" +] +doc: [ + "_build/install/default/doc/UnionFind/LICENSE" + "_build/install/default/doc/UnionFind/README.md" +] From 8c0a25bdb5951c27e6ee41008f99d9bd18dbd9df Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Tue, 11 Feb 2020 22:29:12 +0100 Subject: [PATCH 077/119] Fixes after writing the slides. --- .../docs/advanced/entrypoints-contracts.md | 120 +++++++++--------- gitlab-pages/docs/advanced/include.md | 16 +-- .../docs/advanced/timestamps-addresses.md | 8 +- gitlab-pages/docs/intro/what-and-why.md | 2 +- .../docs/language-basics/boolean-if-else.md | 23 ++++ .../docs/language-basics/functions.md | 35 +++-- gitlab-pages/docs/language-basics/loops.md | 61 +++++---- .../docs/language-basics/maps-records.md | 67 +++++----- .../docs/language-basics/math-numbers-tez.md | 17 ++- .../docs/language-basics/sets-lists-tuples.md | 120 ++++++++++-------- gitlab-pages/docs/language-basics/strings.md | 18 +-- .../docs/language-basics/tezos-specific.md | 22 ++-- gitlab-pages/docs/language-basics/types.md | 3 +- .../variables-and-constants.md | 3 +- .../version-next/contributors/origin.md | 10 +- .../version-next/contributors/philosophy.md | 75 +++-------- 16 files changed, 309 insertions(+), 291 deletions(-) diff --git a/gitlab-pages/docs/advanced/entrypoints-contracts.md b/gitlab-pages/docs/advanced/entrypoints-contracts.md index 07bb7ee0c..15fa7cb75 100644 --- a/gitlab-pages/docs/advanced/entrypoints-contracts.md +++ b/gitlab-pages/docs/advanced/entrypoints-contracts.md @@ -18,9 +18,9 @@ is provided, but the type of an access function contains both. The type of the contract parameter and the storage are up to the contract designer, but the type for list operations is not. The return -type of an entrypoint is as follows, assuming that the type `storage` -has been defined elsewhere. (Note that you can use any type with any -name for the storage.) +type of an access function is as follows, assuming that the type +`storage` has been defined elsewhere. (Note that you can use any type +with any name for the storage.) @@ -45,9 +45,10 @@ type return = (list (operation), storage); The contract storage can only be modified by activating an access function. It is important to understand what that means. What it does *not* mean is that some global variable holding the storage is -modified by the entrypoint. Instead, what it *does* mean is that, -given the state of the storage *on-chain*, an entrypoint specifies how -to create another state for it, depending on a parameter. +modified by the access function. Instead, what it *does* mean is that, +given the state of the storage *on-chain*, an access function +specifies how to create another state for it, depending on a +parameter. Here is an example where the storage is a single natural number that is updated by the parameter. @@ -57,28 +58,32 @@ is updated by the parameter. ```pascaligo group=a +type parameter is nat type storage is nat type return is list (operation) * storage -function save (const parameter : nat; const store : storage) : return is - ((nil : list (operation)), parameter) +function save (const action : parameter; const store : storage) : return is + ((nil : list (operation)), store) ``` ```cameligo group=a +type parameter = nat type storage = nat +type return = operation list * storage -let save (parameter, store: nat * storage) : return = - (([] : operation list), parameter) +let save (action, store: parameter * storage) : return = + (([] : operation list), store) ``` ```reasonligo group=a +type parameter = nat; type storage = nat; +type return = (list (operation), storage); -let main = ((parameter, store): (nat, storage)) : return => { - (([] : list (operation)), parameter); -}; +let main = ((action, store): (parameter, storage)) : return => + (([] : list (operation)), store); ``` @@ -107,8 +112,8 @@ contract, either the counter or the name is updated. ```pascaligo group=b type parameter is - Entrypoint_A of nat -| Entrypoint_B of string + Action_A of nat +| Action_B of string type storage is record [ counter : nat; @@ -117,24 +122,24 @@ type storage is record [ type return is list (operation) * storage -function handle_A (const n : nat; const store : storage) : return is +function entry_A (const n : nat; const store : storage) : return is ((nil : list (operation)), store with record [counter = n]) -function handle_B (const s : string; const store : storage) : return is +function entry_B (const s : string; const store : storage) : return is ((nil : list (operation)), store with record [name = s]) -function main (const param : parameter; const store : storage): return is - case param of - Entrypoint_A (n) -> handle_A (n, store) - | Entrypoint_B (s) -> handle_B (s, store) +function access (const action : parameter; const store : storage): return is + case action of + Action_A (n) -> entry_A (n, store) + | Action_B (s) -> entry_B (s, store) end ``` ```cameligo group=b type parameter = - Entrypoint_A of nat -| Entrypoint_B of string + Action_A of nat +| Action_B of string type storage = { counter : nat; @@ -143,23 +148,23 @@ type storage = { type return = operation list * storage -let handle_A (n, store : nat * storage) : return = +let entry_A (n, store : nat * storage) : return = ([] : operation list), {store with counter = n} -let handle_B (s, store : string * storage) : return = +let entry_B (s, store : string * storage) : return = ([] : operation list), {store with name = s} -let main (param, store: parameter * storage) : return = - match param with - Entrypoint_A n -> handle_A (n, store) - | Entrypoint_B s -> handle_B (s, store) +let access (action, store: parameter * storage) : return = + match action with + Action_A n -> entry_A (n, store) + | Action_B s -> entry_B (s, store) ``` ```reasonligo group=b type parameter = -| Entrypoint_A (nat) -| Entrypoint_B (string); +| Action_A (nat) +| Action_B (string); type storage = { counter : nat, @@ -168,18 +173,17 @@ type storage = { type return = (list (operation), storage); -let handle_A = ((n, store): (nat, storage)) : return => { - (([] : list (operation)), {...store, counter : n}); }; +let entry_A = ((n, store): (nat, storage)) : return => + (([] : list (operation)), {...store, counter : n}); -let handle_B = ((s, store): (string, storage)) : return => { - (([] : list (operation)), {...store, name : s}); }; +let entry_B = ((s, store): (string, storage)) : return => + (([] : list (operation)), {...store, name : s}); -let main = ((param, store): (parameter, storage)) : return => { - switch (param) { - | Entrypoint_A (n) => handle_A ((n, store)) - | Entrypoint_B (s) => handle_B ((s, store)) - } -}; +let access = ((action, store): (parameter, storage)) : return => + switch (action) { + | Action_A (n) => entry_A ((n, store)) + | Action_B (s) => entry_B ((s, store)) + }; ``` @@ -203,7 +207,7 @@ type parameter is unit type storage is unit type return is list (operation) * storage -function deny (const param : parameter; const store : storage) : return is +function deny (const action : parameter; const store : storage) : return is if amount > 0mutez then (failwith ("This contract does not accept tokens.") : return) else ((nil : list (operation)), store) @@ -215,7 +219,7 @@ type parameter = unit type storage = unit type return = operation list * storage -let deny (param, store : parameter * storage) : return = +let deny (action, store : parameter * storage) : return = if amount > 0mutez then (failwith "This contract does not accept tokens.": return) else (([] : operation list), store) @@ -227,7 +231,7 @@ type parameter = unit; type storage = unit; type return = (list (operation), storage); -let deny = ((param, store): (parameter, storage)) : return => { +let deny = ((action, store): (parameter, storage)) : return => { if (amount > 0mutez) { (failwith("This contract does not accept tokens."): return); } else { (([] : list (operation)), store); }; @@ -245,7 +249,7 @@ This example shows how `sender` or `source` can be used to deny access to an ent ```pascaligo group=c const owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); -function filter (const param : parameter; const store : storage) : return is +function filter (const action : parameter; const store : storage) : return is if source =/= owner then (failwith ("Access denied.") : return) else ((nil : list(operation)), store) ``` @@ -254,7 +258,7 @@ function filter (const param : parameter; const store : storage) : return is ```cameligo group=c let owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -let filter (param, store: parameter * storage) : return = +let filter (action, store: parameter * storage) : return = if source <> owner then (failwith "Access denied." : return) else (([] : operation list), store) ``` @@ -263,7 +267,7 @@ let filter (param, store: parameter * storage) : return = ```reasonligo group=c let owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address); -let main = ((param, store): (parameter, storage)) : storage => { +let access = ((action, store): (parameter, storage)) : storage => { if (source != owner) { (failwith ("Access denied.") : return); } else { (([] : list (operation)), store); }; }; @@ -289,10 +293,10 @@ emiting a transaction operation at the end of an entrypoint. > account (tz1, ...): all you have to do is use a unit value as the > parameter of the smart contract. -In our case, we have a `counter.ligo` contract that accepts a -parameter of type `action`, and we have a `proxy.ligo` contract that -accepts the same parameter type, and forwards the call to the deployed -counter contract. +In our case, we have a `counter.ligo` contract that accepts an action +of type `parameter`, and we have a `proxy.ligo` contract that accepts +the same parameter type, and forwards the call to the deployed counter +contract. @@ -323,13 +327,13 @@ type return is list (operation) * storage const dest : address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3" : address) -function proxy (const param : parameter; const store : storage): return is +function proxy (const action : parameter; const store : storage): return is block { const counter : contract (parameter) = get_contract (dest); (* Reuse the parameter in the subsequent transaction or use another one, `mock_param`. *) const mock_param : parameter = Increment (5n); - const op : operation = transaction (param, 0mutez, counter); + const op : operation = transaction (action, 0mutez, counter); const ops : list (operation) = list [op] } with (ops, store) ``` @@ -338,7 +342,7 @@ function proxy (const param : parameter; const store : storage): return is ```cameligo skip // counter.mligo -type paramater = +type parameter = Increment of nat | Decrement of nat | Reset @@ -360,12 +364,12 @@ type return = operation list * storage let dest : address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3" : address) -let proxy (param, store : parameter * storage) : return = +let proxy (action, store : parameter * storage) : return = let counter : parameter contract = Operation.get_contract dest in (* Reuse the parameter in the subsequent transaction or use another one, `mock_param`. *) let mock_param : parameter = Increment (5n) in - let op : operation = Operation.transaction param 0mutez counter + let op : operation = Operation.transaction action 0mutez counter in [op], store ``` @@ -395,12 +399,12 @@ type return = (list (operation), storage); let dest : address = ("KT19wgxcuXG9VH4Af5Tpm1vqEKdaMFpznXT3" : address); -let proxy = ((param, store): (parameter, storage)) : return => { +let proxy = ((action, store): (parameter, storage)) : return => { let counter : contract (parameter) = Operation.get_contract (dest); (* Reuse the parameter in the subsequent transaction or use another one, `mock_param`. *) let mock_param : parameter = Increment (5n); - let op : operation = Operation.transaction (param, 0mutez, counter); + let op : operation = Operation.transaction (action, 0mutez, counter); ([op], store) }; ``` diff --git a/gitlab-pages/docs/advanced/include.md b/gitlab-pages/docs/advanced/include.md index 956d4a80e..21094102e 100644 --- a/gitlab-pages/docs/advanced/include.md +++ b/gitlab-pages/docs/advanced/include.md @@ -3,13 +3,12 @@ id: include title: Including Other Contracts --- -Lets say we have a contract that's getting a bit too big. If it has a modular -structure, you might find it useful to use the `#include` statement to split the -contract up over multiple files. +Let us say that we have a contract that is getting a too large. If it +has a modular structure, you might find it useful to use the +`#include` statement to split the contract up over multiple files. - -You take the code that you want to include and put it in a separate file, for -example `included.ligo`: +You take the code that you want to include and put it in a separate +file, for example `included.ligo`: @@ -23,7 +22,6 @@ const foo : int = 144 ```cameligo - // Demonstrate CameLIGO inclusion statements, see includer.mligo let foo : int = 144 @@ -31,7 +29,6 @@ let foo : int = 144 ```reasonligo - // Demonstrate ReasonLIGO inclusion statements, see includer.religo let foo : int = 144; @@ -46,7 +43,6 @@ And then you can include this code using the `#include` statement like so: ```pascaligo - #include "included.ligo" const bar : int = foo @@ -54,7 +50,6 @@ const bar : int = foo ```cameligo - #include "included.mligo" let bar : int = foo @@ -62,7 +57,6 @@ let bar : int = foo ```reasonligo - #include "included.religo" let bar : int = foo; diff --git a/gitlab-pages/docs/advanced/timestamps-addresses.md b/gitlab-pages/docs/advanced/timestamps-addresses.md index 5174e1cc8..fb2154bc8 100644 --- a/gitlab-pages/docs/advanced/timestamps-addresses.md +++ b/gitlab-pages/docs/advanced/timestamps-addresses.md @@ -33,10 +33,10 @@ let today : timestamp = Current.time; -> When running code with ligo CLI, the option +> When running code, the LIGO CLI option > `--predecessor-timestamp` allows you to control what `now` returns. -### Timestamp Arithmetic +### Timestamp Arithmetics In LIGO, timestamps can be added to integers, allowing you to set time constraints on your smart contracts. Consider the following scenarios. @@ -124,9 +124,9 @@ let not_tomorrow : bool = (Current.time == in_24_hrs); ## Addresses -The type `address` in LIGO denotes Tezos addresses (tz1, tz2, tz3, +The `address` type in LIGO denotes Tezos addresses (tz1, tz2, tz3, KT1, ...). Currently, addresses are created by casting a string to the -type `address`. Beware of failures if the address is invalid. Consider +`address` type. Beware of failures if the address is invalid. Consider the following examples. diff --git a/gitlab-pages/docs/intro/what-and-why.md b/gitlab-pages/docs/intro/what-and-why.md index 2cf50e98c..f195b97a7 100644 --- a/gitlab-pages/docs/intro/what-and-why.md +++ b/gitlab-pages/docs/intro/what-and-why.md @@ -162,7 +162,7 @@ not worry if it is a little confusing at first; we will explain all the syntax in the upcoming sections of the documentation. - + ```pascaligo group=a type storage is int diff --git a/gitlab-pages/docs/language-basics/boolean-if-else.md b/gitlab-pages/docs/language-basics/boolean-if-else.md index 56d565cec..8a872d777 100644 --- a/gitlab-pages/docs/language-basics/boolean-if-else.md +++ b/gitlab-pages/docs/language-basics/boolean-if-else.md @@ -148,6 +148,29 @@ gitlab-pages/docs/language-basics/boolean-if-else/cond.ligo compare 21n' # Outputs: Large (Unit) ``` +When the branches of the conditional are not a single expression, as +above, we need a block: + +```pascaligo skip +if x < y then + block { + const z : nat = x; + x := y; y := z + } +else skip; +``` + +As an exception to the rule, the blocks in a conditional branch do not +need to be introduced by the keywor `block`, so, we could have written +instead: +```pascaligo skip +if x < y then { + const z : nat = x; + x := y; y := z +} +else skip; +``` + ```cameligo group=e type magnitude = Small | Large // See variant types. diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index 9fe1ff4f2..d0344a754 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -3,8 +3,8 @@ id: functions title: Functions --- -LIGO features functions are the basic building block of contracts. For -example, entrypoints are functions. +LIGO functions are the basic building block of contracts. For example, +entrypoints are functions. ## Declaring Functions @@ -119,8 +119,8 @@ parameter, we should gather the arguments in a [tuple](language-basics/sets-lists-tuples.md) and pass the tuple in as a single parameter. -Here is how you define a basic function that accepts two `ints` and -returns an `int` as well: +Here is how you define a basic function that accepts two integers and +returns an integer as well: ```cameligo group=b let add (a, b : int * int) : int = a + b // Uncurried @@ -137,10 +137,11 @@ ligo run-function gitlab-pages/docs/language-basics/src/functions/curry.mligo in The function body is a single expression, whose value is returned. - Functions in ReasonLIGO are defined using the `let` -keyword, like other values. The difference is that a tuple of -parameters is provided after the value name, with its type, then -followed by the return type. + + +Functions in ReasonLIGO are defined using the `let` keyword, like +other values. The difference is that a tuple of parameters is provided +after the value name, with its type, then followed by the return type. Here is how you define a basic function that sums two integers: ```reasonligo group=b @@ -154,7 +155,19 @@ ligo run-function gitlab-pages/docs/language-basics/src/functions/blockless.reli # Outputs: 3 ``` -The function body is a single expression, whose value is returned. +As in CameLIGO and with blockless functions in PascaLIGO, the function +body is a single expression, whose value is returned. + +If the body contains more than a single expression, you use block +between braces: +```reasonligo group=b +let myFun = ((x, y) : (int, int)) : int => { + let doubleX = x + x; + let doubleY = y + y; + doubleX + doubleY +}; +``` + ## Anonymous functions (a.k.a. lambdas) @@ -170,7 +183,6 @@ Here is how to define an anonymous function: ```pascaligo group=c function increment (const b : int) : int is (function (const a : int) : int is a + 1) (b) - const a : int = increment (1); // a = 2 ``` @@ -196,7 +208,7 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.mligo a ```reasonligo group=c -let increment = (b : int) : int => ((a : int) : int => a + 1)(b); +let increment = (b : int) : int => ((a : int) : int => a + 1) (b); let a : int = increment (1); // a == 2 ``` @@ -257,5 +269,4 @@ gitlab-pages/docs/language-basics/src/functions/incr_map.religo incr_map # Outputs: [ 2 ; 3 ; 4 ] ``` - diff --git a/gitlab-pages/docs/language-basics/loops.md b/gitlab-pages/docs/language-basics/loops.md index ce656ec86..bb31e124f 100644 --- a/gitlab-pages/docs/language-basics/loops.md +++ b/gitlab-pages/docs/language-basics/loops.md @@ -20,16 +20,15 @@ loops fails to become true, the execution will run out of gas and stop with a failure anyway. Here is how to compute the greatest common divisors of two natural -number by means of Euclid's algorithm: +numbers by means of Euclid's algorithm: ```pascaligo group=a function gcd (var x : nat; var y : nat) : nat is block { - if x < y then - block { - const z : nat = x; - x := y; y := z - } + if x < y then { + const z : nat = x; + x := y; y := z + } else skip; var r : nat := 0n; while y =/= 0n block { @@ -55,18 +54,19 @@ constant, therefore it makes no sense in CameLIGO to feature loops, which we understand as syntactic constructs where the state of a stopping condition is mutated, as with "while" loops in PascaLIGO. -Instead, CameLIGO features a *fold operation* as a predefined function -named `Loop.fold_while`. It takes an initial value of a certain type, -called an *accumulator*, and repeatedly calls a given function, called -*iterated function*, that takes that accumulator and returns the next -value of the accumulator, until a condition is met and the fold stops -with the final value of the accumulator. The iterated function needs -to have a special type: if the type of the accumulator is `t`, then it -must have the type `bool * t` (not simply `t`). It is the boolean -value that denotes whether the stopping condition has been reached. +Instead, CameLIGO implements a *folded operation* by means of a +predefined function named `Loop.fold_while`. It takes an initial value +of a certain type, called an *accumulator*, and repeatedly calls a +given function, called *folded function*, that takes that +accumulator and returns the next value of the accumulator, until a +condition is met and the fold stops with the final value of the +accumulator. The iterated function needs to have a special type: if +the type of the accumulator is `t`, then it must have the type `bool * +t` (not simply `t`). It is the boolean value that denotes whether the +stopping condition has been reached. Here is how to compute the greatest common divisors of two natural -number by means of Euclid's algorithm: +numbers by means of Euclid's algorithm: ```cameligo group=a let iter (x,y : nat * nat) : bool * (nat * nat) = @@ -117,7 +117,7 @@ accumulator is `t`, then it must have the type `bool * t` (not simply condition has been reached. Here is how to compute the greatest common divisors of two natural -number by means of Euclid's algorithm: +numbers by means of Euclid's algorithm: ```reasonligo group=a let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => @@ -149,11 +149,10 @@ let gcd = ((x,y) : (nat, nat)) : nat => { In addition to general loops, PascaLIGO features a specialised kind of *loop to iterate over bounded intervals*. These loops are familiarly -known as "for loops" and they have the form `for to - `, which is familiar for programmers of -imperative languages. +known as "for loops" and they have the form `for +to `, as found in imperative languages. -Consider how to sum integers from `0` to `n`: +Consider how to sum the natural numbers up to `n`: ```pascaligo group=c function sum (var n : nat) : int is block { @@ -177,7 +176,7 @@ gitlab-pages/docs/language-basics/src/loops/sum.ligo sum 7n PascaLIGO "for" loops can also iterate through the contents of a collection, that is, a list, a set or a map. This is done with a loop of the form `for in -`, where ``, where `` is any of the following keywords: `list`, `set` or `map`. Here is an example where the integers in a list are summed up. @@ -202,7 +201,7 @@ gitlab-pages/docs/language-basics/src/loops/collection.ligo sum_list Here is an example where the integers in a set are summed up. -```pascaligo=e +```pascaligo group=d function sum_set (var s : set (int)) : int is block { var total : int := 0; for i in set s block { @@ -222,9 +221,23 @@ gitlab-pages/docs/language-basics/src/loops/collection.ligo sum_set Loops over maps are actually loops over the bindings of the map, that is, a pair key-value noted `key -> value` (or any other -variables). Give a map from strings to integers, here is how to sum +variables). Given a map from strings to integers, here is how to sum all the integers and concatenate all the strings. +Here is an example where the keys are concatenated and the values are +summed up. + +```pascaligo group=d +function sum_map (var m : map (string, int)) : string * int is block { + var string_total : string := ""; + var int_total : int := 0; + for key -> value in map m block { + string_total := string_total ^ key; + int_total := int_total + value + } +} with (string_total, int_total) +``` + You can call the function `sum_map` defined above using the LIGO compiler like so: ```shell diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index 59226b4e3..d691d588e 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -97,7 +97,7 @@ let alice_admin : bool = alice.is_admin ```reasonligo group=a -let alice_admin: bool = alice.is_admin; +let alice_admin : bool = alice.is_admin; ``` @@ -110,9 +110,7 @@ modified. One way to understand the update of record values is the *functional update*. The idea is to have an *expression* whose value is the -updated record. The shape of that expression is ` -with `. The record variable is the record to update and -the record value is the update itself. +updated record. Let us consider defining a function that translates three-dimensional points on a plane. @@ -120,6 +118,11 @@ points on a plane. + +In PascaLIGO, the shape of that expression is ` with +`. The record variable is the record to update and the +record value is the update itself. + ```pascaligo group=b type point is record [x : int; y : int; z : int] type vector is record [dx : int; dy : int] @@ -174,7 +177,7 @@ xy_translate "({x=2;y=3;z=1}, {dx=3;dy=4})" The syntax for the functional updates of record in ReasonLIGO follows -that of OCaml: +that of ReasonML: ```reasonligo group=b type point = {x : int, y : int, z : int}; @@ -199,7 +202,7 @@ xy_translate "({x:2,y:3,z:1}, {dx:3,dy:4})" You have to understand that `p` has not been changed by the functional update: a nameless new version of it has been created and returned. -### Imperative Updates +### Record Patches Another way to understand what it means to update a record value is to make sure that any further reference to the value afterwards will @@ -365,12 +368,13 @@ let moves : register = ### Accessing Map Bindings -We can use the postfix `[]` operator to read the `move` value -associated to a given key (`address` here) in the register. Here is an -example: - + +In PascaLIGO, we can use the postfix `[]` operator to read the `move` +value associated to a given key (`address` here) in the register. Here +is an example: + ```pascaligo group=f const my_balance : option (move) = moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)] @@ -480,10 +484,9 @@ We can update a binding in a map in ReasonLIGO by means of the `Map.update` built-in function: ```reasonligo group=f -let assign = (m : register) : register => { +let assign = (m : register) : register => Map.update - (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), Some ((4,9)), m) -}; + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), Some ((4,9)), m); ``` > Notice the optional value `Some (4,9)` instead of `(4,9)`. If we had @@ -521,9 +524,8 @@ let delete (key, moves : address * register) : register = In ReasonLIGO, we use the predefined function `Map.remove` as follows: ```reasonligo group=f -let delete = ((key, moves) : (address, register)) : register => { +let delete = ((key, moves) : (address, register)) : register => Map.remove (key, moves); -}; ``` @@ -540,7 +542,7 @@ There are three kinds of functional iterations over LIGO maps: the *iterated operation*, the *map operation* (not to be confused with the *map data structure*) and the *fold operation*. -#### Iterated Operation +#### Iterated Operation over Maps The first, the *iterated operation*, is an iteration over the map with no return value: its only use is to produce side-effects. This can be @@ -595,7 +597,7 @@ let iter_op = (m : register) : unit => { ``` -#### Map Operation +#### Map Operations over Maps We may want to change all the bindings of a map by applying to them a function. This is called a *map operation*, not to be confused with @@ -606,7 +608,7 @@ the map data structure. In PascaLIGO, the predefined functional iterator implementing the map -operation over maps is called `map_map`and is used as follows: +operation over maps is called `map_map` and is used as follows: ```pascaligo group=f function map_op (const m : register) : register is @@ -643,9 +645,9 @@ let map_op = (m : register) : register => { ``` -#### Fold Operation +#### Folded Operations over Maps -A *fold operation* is the most general of iterations. The folded +A *folded operation* is the most general of iterations. The folded function takes two arguments: an *accumulator* and the structure *element* at hand, with which it then produces a new accumulator. This enables having a partial result that becomes complete when the @@ -655,14 +657,15 @@ traversal of the data structure is over. -In PascaLIGO, the predefined functional iterator implementing the fold -operation over maps is called `map_fold` and is used as follows: +In PascaLIGO, the predefined functional iterator implementing the +folded operation over maps is called `map_fold` and is used as +follows: ```pascaligo group=f function fold_op (const m : register) : int is block { - function iterated (const j : int; const cur : address * move) : int is + function folded (const j : int; const cur : address * move) : int is j + cur.1.1 - } with map_fold (iterated, m, 5) + } with map_fold (folded, m, 5) ``` > The folded function must be pure, that is, it cannot mutate @@ -670,24 +673,26 @@ function fold_op (const m : register) : int is block { -In CameLIGO, the predefined functional iterator implementing the fold -operation over maps is called `Map.fold` and is used as follows: +In CameLIGO, the predefined functional iterator implementing the +folded operation over maps is called `Map.fold` and is used as +follows: ```cameligo group=f let fold_op (m : register) : register = - let iterated = fun (i,j : int * (address * move)) -> i + j.1.1 - in Map.fold iterated m 5 + let folded = fun (i,j : int * (address * move)) -> i + j.1.1 + in Map.fold folded m 5 ``` In ReasonLIGO, the predefined functional iterator implementing the -fold operation over maps is called `Map.fold` and is used as follows: +folded operation over maps is called `Map.fold` and is used as +follows: ```reasonligo group=f let fold_op = (m : register) : register => { - let iterated = ((i,j): (int, (address, move))) => i + j[1][1]; - Map.fold (iterated, m, 5); + let folded = ((i,j): (int, (address, move))) => i + j[1][1]; + Map.fold (folded, m, 5); }; ``` diff --git a/gitlab-pages/docs/language-basics/math-numbers-tez.md b/gitlab-pages/docs/language-basics/math-numbers-tez.md index 11a589c12..41d05ed5d 100644 --- a/gitlab-pages/docs/language-basics/math-numbers-tez.md +++ b/gitlab-pages/docs/language-basics/math-numbers-tez.md @@ -60,13 +60,13 @@ let b : int = 5n + 10 let c : tez = 5mutez + 10mutez // tez + int or tez + nat is invalid -// const d : tez = 5mutez + 10n +// let d : tez = 5mutez + 10n // two nats yield a nat let e : nat = 5n + 10n // nat + int yields an int: invalid -// const f : nat = 5n + 10 +// let f : nat = 5n + 10 let g : int = 1_000_000 ``` @@ -136,7 +136,7 @@ let a : int = 5 - 10 let b : int = 5n - 2n // Therefore the following is invalid -// const c : nat = 5n - 2n +// let c : nat = 5n - 2n let d : tez = 5mutez - 1mutez ``` @@ -167,15 +167,17 @@ You can multiply values of the same type, such as: ```pascaligo group=c const a : int = 5 * 5 const b : nat = 5n * 5n -// You can also multiply `nat` and `tez` in any order -const c : tez = 5n * 5mutez; + +// You can also multiply `nat` and `tez` +const c : tez = 5n * 5mutez ``` ```cameligo group=c let a : int = 5 * 5 let b : nat = 5n * 5n -// You can also multiply `nat` and `tez` in any order + +// You can also multiply `nat` and `tez` let c : tez = 5n * 5mutez ``` @@ -183,7 +185,8 @@ let c : tez = 5n * 5mutez ```reasonligo group=c let a : int = 5 * 5; let b : nat = 5n * 5n; -// You can also multiply `nat` and `tez` in any order + +// You can also multiply `nat` and `tez` let c : tez = 5n * 5mutez; ``` diff --git a/gitlab-pages/docs/language-basics/sets-lists-tuples.md b/gitlab-pages/docs/language-basics/sets-lists-tuples.md index 02c915928..a3db92b6d 100644 --- a/gitlab-pages/docs/language-basics/sets-lists-tuples.md +++ b/gitlab-pages/docs/language-basics/sets-lists-tuples.md @@ -13,10 +13,10 @@ values, called *components*, can be retrieved by their index (position). Probably the most common tuple is the *pair*. For example, if we were storing coordinates on a two dimensional grid we might use a pair `(x,y)` to store the coordinates `x` and `y`. There -is a *specific order*, so `(y,x)` is not equal to `(x,y)`. The number -of components is part of the type of a tuple, so, for example, we -cannot add an extra component to a pair and obtain a triple of the -same type, so, for instance, `(x,y)` has always a different type from +is a *specific order*, so `(y,x)` is not equal to `(x,y)` in +general. The number of components is part of the type of a tuple, so, +for example, we cannot add an extra component to a pair and obtain a +triple of the same type: `(x,y)` has always a different type from `(x,y,z)`, whereas `(y,x)` might have the same type as `(x,y)`. Like records, tuple components can be of arbitrary types. @@ -68,10 +68,10 @@ position in their tuple, which cannot be done in OCaml. -Tuple components are one-indexed like so: +Tuple components are one-indexed and accessed like so: ```pascaligo group=tuple -const first_name : string = full_name.1; +const first_name : string = full_name.1 ``` @@ -84,7 +84,7 @@ let first_name : string = full_name.0 -Tuple components are one-indexed like so: +Tuple components are one-indexed and accessed like so: ```reasonligo group=tuple let first_name : string = full_name[1]; @@ -102,24 +102,27 @@ called the *head*, and the sub-list after the head is called the *tail*. For those familiar with algorithmic data structure, you can think of a list a *stack*, where the top is written on the left. -> 💡 Lists are useful when returning operations from a smart -> contract's entrypoint. +> 💡 Lists are needed when returning operations from a smart +> contract's access function. ### Defining Lists ```pascaligo group=lists +const empty_list : list (int) = nil // Or list [] const my_list : list (int) = list [1; 2; 2] // The head is 1 ``` ```cameligo group=lists +let empty_list : int list = [] let my_list : int list = [1; 2; 2] // The head is 1 ``` ```reasonligo group=lists +let empty_list : list (int) = []; let my_list : list (int) = [1, 2, 2]; // The head is 1 ``` @@ -128,7 +131,6 @@ let my_list : list (int) = [1, 2, 2]; // The head is 1 ### Adding to Lists - Lists can be augmented by adding an element before the head (or, in terms of stack, by *pushing an element on top*). This operation is usually called *consing* in functional languages. @@ -167,12 +169,6 @@ let larger_list : list (int) = [5, ...my_list]; // [5,1,2,2] ``` -> 💡 Lists can be iterated, folded or mapped to different values. You -> can find additional examples -> [here](https://gitlab.com/ligolang/ligo/tree/dev/src/test/contracts) -> and other built-in operators -> [here](https://gitlab.com/ligolang/ligo/blob/dev/src/passes/operators/operators.ml#L59) - ### Functional Iteration over Lists A *functional iterator* is a function that traverses a data structure @@ -180,16 +176,23 @@ and calls in turn a given function over the elements of that structure to compute some value. Another approach is possible in PascaLIGO: *loops* (see the relevant section). -There are three kinds of functional iterations over LIGO maps: the +There are three kinds of functional iterations over LIGO lists: the *iterated operation*, the *map operation* (not to be confused with the *map data structure*) and the *fold operation*. -#### Iterated Operation +> 💡 Lists can be iterated, folded or mapped to different values. You +> can find additional examples +> [here](https://gitlab.com/ligolang/ligo/tree/dev/src/test/contracts) +> and other built-in operators +> [here](https://gitlab.com/ligolang/ligo/blob/dev/src/passes/operators/operators.ml#L59) -The first, the *iterated operation*, is an iteration over the map with -no return value: its only use is to produce side-effects. This can be -useful if for example you would like to check that each value inside -of a map is within a certain range, and fail with an error otherwise. +#### Iterated Operation over Lists + +The first, the *iterated operation*, is an iteration over the list +with a unit return value. It is useful to enforce certain invariants +on the element of a list, or fail. For example you might want to check +that each value inside of a list is within a certain range, and fail +otherwise. @@ -244,7 +247,7 @@ let iter_op = (l : list (int)) : unit => { -#### Map Operation +#### Mapped Operation over Lists We may want to change all the elements of a given list by applying to them a function. This is called a *map operation*, not to be confused @@ -254,8 +257,9 @@ with the map data structure. -In PascaLIGO, the predefined functional iterator implementing the map -operation over lists is called `list_map` and is used as follows: +In PascaLIGO, the predefined functional iterator implementing the +mapped operation over lists is called `list_map` and is used as +follows: ```pascaligo group=lists function increment (const i : int): int is i + 1 @@ -264,10 +268,14 @@ function increment (const i : int): int is i + 1 const plus_one : list (int) = list_map (increment, larger_list) ``` +> The mapped function must be pure, that is, it cannot mutate +> variables. + -In CameLIGO, the predefined functional iterator implementing the map -operation over lists is called `List.map` and is used as follows: +In CameLIGO, the predefined functional iterator implementing the +mapped operation over lists is called `List.map` and is used as +follows: ```cameligo group=lists let increment (i : int) : int = i + 1 @@ -278,8 +286,9 @@ let plus_one : int list = List.map increment larger_list -In ReasonLIGO, the predefined functional iterator implementing the map -operation over lists is called `List.map` and is used as follows: +In ReasonLIGO, the predefined functional iterator implementing the +mapped operation over lists is called `List.map` and is used as +follows: ```reasonligo group=lists let increment = (i : int) : int => i + 1; @@ -290,9 +299,9 @@ let plus_one : list (int) = List.map (increment, larger_list); -#### Fold Operation +#### Folded Operation over Lists -A *fold operation* is the most general of iterations. The folded +A *folded operation* is the most general of iterations. The folded function takes two arguments: an *accumulator* and the structure *element* at hand, with which it then produces a new accumulator. This enables having a partial result that becomes complete when the @@ -302,12 +311,12 @@ traversal of the data structure is over. -In PascaLIGO, the predefined functional iterator implementing the fold -operation over lists is called `list_fold` and is used as follows: +In PascaLIGO, the predefined functional iterator implementing the +folded operation over lists is called `list_fold` and is used as +follows: ```pascaligo group=lists function sum (const acc : int; const i : int): int is acc + i - const sum_of_elements : int = list_fold (sum, my_list, 0) ``` @@ -316,7 +325,7 @@ const sum_of_elements : int = list_fold (sum, my_list, 0) -In CameLIGO, the predefined functional iterator implementing the fold +In CameLIGO, the predefined functional iterator implementing the folded operation over lists is called `List.fold` and is used as follows: ```cameligo group=lists @@ -327,7 +336,8 @@ let sum_of_elements : int = List.fold sum my_list 0 In ReasonLIGO, the predefined functional iterator implementing the -fold operation over lists is called `List.fold` and is used as follows: +folded operation over lists is called `List.fold` and is used as +follows: ```reasonligo group=lists let sum = ((result, i): (int, int)): int => result + i; @@ -365,7 +375,7 @@ let my_set : int set = Set.empty -In CameLIGO, the empty set is denoted by the predefined value +In ReasonLIGO, the empty set is denoted by the predefined value `Set.empty`. ```reasonligo group=sets @@ -469,7 +479,7 @@ let contains_3 : bool = Set.mem (3, my_set); -### Cardinal +### Cardinal of Sets @@ -509,7 +519,7 @@ let set_size : nat = Set.size (my_set); In PascaLIGO, there are two ways to update a set, that is to add or remove from it. Either we create a new set from the given one, or we -modify it in-place. First, let us consider the former way +modify it in-place. First, let us consider the former way: ```pascaligo group=sets const larger_set : set (int) = set_add (4, my_set) @@ -568,8 +578,8 @@ to compute some value. Another approach is possible in PascaLIGO: *loops* (see the relevant section). There are three kinds of functional iterations over LIGO maps: the -*iterated operation*, the *map operation* (not to be confused with the -*map data structure*) and the *fold operation*. +*iterated operation*, the *mapped operation* (not to be confused with +the *map data structure*) and the *folded operation*. #### Iterated Operation @@ -631,18 +641,18 @@ let iter_op = (s : set (int)) : unit => { -#### Map Operation +#### Mapped Operation (NOT IMPLEMENTED YET) We may want to change all the elements of a given set by applying to -them a function. This is called a *map operation*, not to be confused -with the map data structure. +them a function. This is called a *mapped operation*, not to be +confused with the map data structure. -In PascaLIGO, the predefined functional iterator implementing the map -operation over sets is called `set_map` and is used as follows: +In PascaLIGO, the predefined functional iterator implementing the +mapped operation over sets is called `set_map` and is used as follows: ```pascaligo skip function increment (const i : int): int is i + 1 @@ -653,8 +663,8 @@ const plus_one : set (int) = set_map (increment, larger_set) -In CameLIGO, the predefined functional iterator implementing the map -operation over sets is called `Set.map` and is used as follows: +In CameLIGO, the predefined functional iterator implementing the +mapped operation over sets is called `Set.map` and is used as follows: ```cameligo skip let increment (i : int) : int = i + 1 @@ -663,11 +673,10 @@ let increment (i : int) : int = i + 1 let plus_one : int set = Set.map increment larger_set ``` - -In ReasonLIGO, the predefined functional iterator implementing the map -operation over sets is called `Set.map` and is used as follows: +In ReasonLIGO, the predefined functional iterator implementing the +mapped operation over sets is called `Set.map` and is used as follows: ```reasonligo skip let increment = (i : int) : int => i + 1; @@ -678,9 +687,9 @@ let plus_one : set (int) = Set.map (increment, larger_set); -#### Fold Operation +#### Folded Operation -A *fold operation* is the most general of iterations. The folded +A *folded operation* is the most general of iterations. The folded function takes two arguments: an *accumulator* and the structure *element* at hand, with which it then produces a new accumulator. This enables having a partial result that becomes complete when the @@ -690,8 +699,9 @@ traversal of the data structure is over. -In PascaLIGO, the predefined functional iterator implementing the fold -operation over sets is called `set_fold` and is used as follows: +In PascaLIGO, the predefined functional iterator implementing the +folded operation over sets is called `set_fold` and is used as +follows: ```pascaligo group=sets function sum (const acc : int; const i : int): int is acc + i diff --git a/gitlab-pages/docs/language-basics/strings.md b/gitlab-pages/docs/language-basics/strings.md index 3ad0d568d..461d0e38d 100644 --- a/gitlab-pages/docs/language-basics/strings.md +++ b/gitlab-pages/docs/language-basics/strings.md @@ -27,7 +27,7 @@ let a : string = "Hello Alice"; Strings can be concatenated using the `^` operator. -```pascaligo +```pascaligo group=a const name : string = "Alice" const greeting : string = "Hello" const full_greeting : string = greeting ^ " " ^ name @@ -35,7 +35,7 @@ const full_greeting : string = greeting ^ " " ^ name Strings can be concatenated using the `^` operator. -```cameligo +```cameligo group=a let name : string = "Alice" let greeting : string = "Hello" let full_greeting : string = greeting ^ " " ^ name @@ -43,7 +43,7 @@ let full_greeting : string = greeting ^ " " ^ name Strings can be concatenated using the `++` operator. -```reasonligo +```reasonligo group=a let name : string = "Alice"; let greeting : string = "Hello"; let full_greeting : string = greeting ++ " " ++ name; @@ -57,17 +57,17 @@ Strings can be sliced using a built-in function: -```pascaligo +```pascaligo group=b const name : string = "Alice" const slice : string = string_slice (0n, 1n, name) ``` -```cameligo +```cameligo group=b let name : string = "Alice" let slice : string = String.slice 0n 1n name ``` -```reasonligo +```reasonligo group=b let name : string = "Alice"; let slice : string = String.slice (0n, 1n, name); ``` @@ -81,18 +81,18 @@ The length of a string can be found using a built-in function: -```pascaligo +```pascaligo group=c const name : string = "Alice" const length : nat = size (name) // length = 5 ``` -```cameligo +```cameligo group=c let name : string = "Alice" let length : nat = String.size name // length = 5 ``` -```reasonligo +```reasonligo group=c let name : string = "Alice"; let length : nat = String.size (name); // length == 5 ``` diff --git a/gitlab-pages/docs/language-basics/tezos-specific.md b/gitlab-pages/docs/language-basics/tezos-specific.md index 2072b499e..e63764b66 100644 --- a/gitlab-pages/docs/language-basics/tezos-specific.md +++ b/gitlab-pages/docs/language-basics/tezos-specific.md @@ -10,16 +10,15 @@ functions. This page will tell you about them. ## Pack and Unpack Michelson provides the `PACK` and `UNPACK` instructions for data -serialization. The instruction `PACK` converts Michelson data -structures into a binary format, and `UNPACK` reverses that -transformation. This functionality can be accessed from within LIGO. +serialization. The former converts Michelson data structures into a +binary format, and the latter reverses that transformation. This +functionality can be accessed from within LIGO. > ⚠️ `PACK` and `UNPACK` are Michelson instructions that are intended > to be used by people that really know what they are doing. There are > several risks and failure cases, such as unpacking a lambda from an -> untrusted source, and most of which are beyond the scope of this -> document. Do not use these functions without doing your homework -> first. +> untrusted source or casting the result to the wrong type. Do not use +> the corresponding LIGO functions without doing your homework first. @@ -27,7 +26,7 @@ transformation. This functionality can be accessed from within LIGO. ```pascaligo group=a function id_string (const p : string) : option (string) is block { const packed : bytes = bytes_pack (p) -} with (bytes_unpack (packed): option (string)) +} with (bytes_unpack (packed) : option (string)) ``` @@ -77,7 +76,7 @@ let check_hash_key (kh1, k2 : key_hash * key) : bool * key_hash = ```reasonligo group=b let check_hash_key = ((kh1, k2) : (key_hash, key)) : (bool, key_hash) => { - let kh2 : key_hash = Crypto.hash_key(k2); + let kh2 : key_hash = Crypto.hash_key (k2); if (kh1 == kh2) { (true, kh2); } else { (false, kh2); } }; ``` @@ -116,9 +115,8 @@ let check_signature (pk, signed, msg : key * signature * bytes) : bool = ```reasonligo group=c let check_signature = - ((pk, signed, msg) : (key, signature, bytes)) : bool => { + ((pk, signed, msg) : (key, signature, bytes)) : bool => Crypto.check (pk, signed, msg); -}; ``` @@ -129,8 +127,8 @@ Often you want to get the address of the contract being executed. You can do it with `self_address`. > ⚠️ Due to limitations in Michelson, `self_address` in a contract is -> only allowed at the entrypoint level, that is, at the -> top-level. Using it in an embedded function will cause an error. +> only allowed at the top-level. Using it in an embedded function will +> cause an error. diff --git a/gitlab-pages/docs/language-basics/types.md b/gitlab-pages/docs/language-basics/types.md index ace3e8794..1ea5eeba0 100644 --- a/gitlab-pages/docs/language-basics/types.md +++ b/gitlab-pages/docs/language-basics/types.md @@ -53,13 +53,12 @@ let dog_breed : breed = "Saluki"; ```pascaligo group=b -// The type accountBalances denotes maps from addresses to tez +// The type account_balances denotes maps from addresses to tez type account_balances is map (address, tez) const ledger : account_balances = map [("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> 10mutez] - ``` diff --git a/gitlab-pages/docs/language-basics/variables-and-constants.md b/gitlab-pages/docs/language-basics/variables-and-constants.md index 5c3c4ede2..3fe31ff18 100644 --- a/gitlab-pages/docs/language-basics/variables-and-constants.md +++ b/gitlab-pages/docs/language-basics/variables-and-constants.md @@ -69,7 +69,8 @@ or as function parameters. function add (const a : int; const b : int) : int is block { - var c : int := a + b + var c : int := a + 2*b; + c := c - b } with c ``` diff --git a/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md b/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md index 089c6ce08..72b6002ac 100644 --- a/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md +++ b/gitlab-pages/website/versioned_docs/version-next/contributors/origin.md @@ -4,14 +4,8 @@ title: Origin original_id: origin --- -LIGO is a programming language that aims to provide developers with an -uncomplicated and safe way to implement smart contracts. Since it is -being implemented for the Tezos blockchain LIGO compiles to Michelson, -the native smart contract language of Tezos. +LIGO is a programming language that aims to provide developers with an uncomplicated and safe way to implement smart contracts. Since it is being implemented for the Tezos blockchain LIGO compiles to Michelson—the native smart contract language of Tezos. > Smart contracts are programs that run within a blockchain network. -LIGO was meant to be a language for developing Marigold on top of a -hacky framework called Meta-Michelson. However, due to the attention -received by the Tezos community, LIGO is now a standalone language -being developed to support Tezos directly. +LIGO was meant to be a language for developing Marigold on top of a hacky framework called Meta-Michelson. However, due to the attention received by the Tezos community, LIGO is now a standalone language being developed to support Tezos directly. \ No newline at end of file diff --git a/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md b/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md index db959a833..99c4d7c00 100644 --- a/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md +++ b/gitlab-pages/website/versioned_docs/version-next/contributors/philosophy.md @@ -4,79 +4,42 @@ title: Philosophy original_id: philosophy --- -To understand LIGO’s design choices it is important to understand its -philosophy. We have two main concerns in mind while building LIGO. +To understand LIGO’s design choices it’s important to understand its philosophy. We have two main concerns in mind while building LIGO. ## Safety - -Once a smart contract is deployed, it will likely be impossible to -change it. You must get it right on the first try, and LIGO should -help as much as possible. There are multiple ways to make LIGO a safer -language for smart contracts. +Once a smart contract is deployed, it will likely be impossible to change it. You must get it right on the first try, and LIGO should help as much as possible. There are multiple ways to make LIGO a safer language for smart contracts. ### Automated Testing +Automated Testing is the process through which a program runs another program, and checks that this other program behaves correctly. -Automated Testing is the process through which a program runs another -program, and checks that this other program behaves correctly. - -There already is a testing library for LIGO programs written in OCaml -that is used to test LIGO itself. Making it accessible to users will -greatly improve safety. A way to do so would be to make it accessible -from within LIGO. +There already is a testing library for LIGO programs written in OCaml that is used to test LIGO itself. Making it accessible to users will greatly improve safety. A way to do so would be to make it accessible from within LIGO. ### Static Analysis - -Static analysis is the process of having a program analyze another -one. For instance, type systems are a kind of static analysis through -which it is possible to find lots of bugs. LIGO already has a simple -type system, and we plan to make it much stronger. +Static analysis is the process of having a program analyze another one. +For instance, type systems are a kind of static analysis through which it is possible to find lots of bugs. LIGO already has a simple type system, and we plan to make it much stronger. ### Conciseness - -Writing less code gives you less room to introduce errors. That is why -LIGO encourages writing lean rather than chunky smart contracts. +Writing less code gives you less room to introduce errors. That's why LIGO encourages writing lean rather than chunky smart contracts. --- ## Ergonomics - -Having an ergonomic product is crucial on multiple levels: Making -features easily accessible ensures they will actually get used. Not -wasting users time on idiosyncrasies frees more time for making -contracts safer or building apps. Keeping users in a Flow state makes -it possible to introduce more complex features in the language. There -are multiple ways to improve ergonomics. +Having an ergonomic product is crucial on multiple levels: +Making features easily accessible ensures they’ll actually get used. +Not wasting users time on idiosyncrasies frees more time for making contracts safer or building apps. +Keeping users in a Flow state makes it possible to introduce more complex features in the language. +There are multiple ways to improve ergonomics. ### The Language +LIGO should contain as few surprises as possible. This is usually known as the principle of least surprise. -LIGO should contain as few surprises as possible. This is usually -known as the principle of least surprise. +Most programmers who will use LIGO have already spent a lot of time learning to develop in an existing language, with its own set of conventions and expectations. These expectations are often the most important to accommodate. This is why C-style syntaxes are especially popular (e.g. JavaScript), C-style is well known and new languages want to take advantage of that familiarity. Therefore as an extension of the principle of least surprise, LIGO supports more than one syntax. The least surprising language for a new developer is the one that they have already learned how to use. It’s probably not practical to replicate the syntax of every programming language, so LIGO takes the approach of replicating the structure used by languages from a particular paradigm. -Most programmers who will use LIGO have already spent a lot of time -learning to develop in an existing language, with its own set of -conventions and expectations. These expectations are often the most -important to accommodate. This is why C-style syntaxes are especially -popular (e.g. JavaScript), C-style is well known and new languages -want to take advantage of that familiarity. Therefore as an extension -of the principle of least surprise, LIGO supports more than one -syntax. The least surprising language for a new developer is the one -that they have already learned how to use. It’s probably not practical -to replicate the syntax of every programming language, so LIGO takes -the approach of replicating the structure used by languages from a -particular paradigm. - -It is packaged in a Docker container, so that no particular -installation instructions are required. +It is packaged in a Docker container, so that no particular installation instructions are required. ### Editor Support +Without editor support, a lot of manipulations are very cumbersome. Checking for errors, testing, examining code, refactoring code, etc. This is why there is ongoing work on editor support, starting with highlighting and code-folding. -Without editor support, a lot of manipulations are very -cumbersome. Checking for errors, testing, examining code, refactoring -code, etc. This is why there is ongoing work on editor support, -starting with highlighting and code-folding. - -### Documentation - -Documentation includes a reference of the languages, tutorials, as -well as examples and design patterns. We are a long way from -there. But having an extensive documentation is part of our goals. +### Docs +Docs include documentation of the languages, tutorials, as well as examples and design patterns. +We’re a long way from there. But having extensive docs is part of our goals. \ No newline at end of file From 93ed763483be8b2dac728887809e341c5c60acb3 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Tue, 11 Feb 2020 17:27:27 -0800 Subject: [PATCH 078/119] Fix type of List.map and clean up its PascaLIGO example in list reference page --- gitlab-pages/docs/reference/list.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitlab-pages/docs/reference/list.md b/gitlab-pages/docs/reference/list.md index 569c7f013..6cabc13d3 100644 --- a/gitlab-pages/docs/reference/list.md +++ b/gitlab-pages/docs/reference/list.md @@ -30,7 +30,7 @@ let size_ = (s: list(int)): nat => List.size(s); Alias of `List.size`. -## List.map(map_function: a' -> a', lst: a' list) : 'a list +## List.map(map_function: a' -> b', lst: a' list) : 'b list Apply an operation defined by `map_function` to each element of a list and return a list of the modified elements. @@ -38,7 +38,7 @@ a list of the modified elements. ```pascaligo group=b -function increment(const i: int): int is block { skip } with i + 1; +function increment(const i: int): int is i + 1; // Creates a new list with elements incremented by 1 const incremented_list: list(int) = list_map(increment, list 1; 2; 3; end ); ``` From e8da2626e44db2532124532721841d7f8ba90331 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Wed, 12 Feb 2020 01:39:41 +0000 Subject: [PATCH 079/119] Add set reference page to the docs Add Set.literal to the test suite --- gitlab-pages/docs/reference/set.md | 201 +++++++++++++++++++++++ src/test/contracts/set_arithmetic.mligo | 3 + src/test/contracts/set_arithmetic.religo | 2 + src/test/integration_tests.ml | 10 ++ src/test/md_file_tests.ml | 1 + 5 files changed, 217 insertions(+) create mode 100644 gitlab-pages/docs/reference/set.md diff --git a/gitlab-pages/docs/reference/set.md b/gitlab-pages/docs/reference/set.md new file mode 100644 index 000000000..a1de140b6 --- /dev/null +++ b/gitlab-pages/docs/reference/set.md @@ -0,0 +1,201 @@ +--- +id: set-reference +title: Set +--- + +## Defining a set + + + +```pascaligo group=a +type int_set is set (int); +const my_set : int_set = set 1; 2; 3 end +``` + + +```cameligo group=a +type int_set = int set +let my_set : int_set = + Set.add 3 (Set.add 2 (Set.add 1 (Set.empty: int set))) +``` + + +```reasonligo group=a +type int_set = set (int); +let my_set : int_set = + Set.add (3, Set.add (2, Set.add (1, Set.empty: set (int)))); +``` + + + + +## Set.mem(is_member: a', s: a' set) : bool + +Check if a set `s` contains the element `is_member`. + + + +```pascaligo group=a +const contains_three : bool = my_set contains 3 +// or alternatively +const contains_three_fn: bool = set_mem (3, my_set); +``` + + +```cameligo group=a +let contains_three: bool = Set.mem 3 my_set +``` + +```reasonligo group=a +let contains_three: bool = Set.mem(3, my_set); +``` + + + + +## Set.empty() : a' set + +Create a new empty set. Needs to be annotated with the set type. + + + +```pascaligo group=a +const my_set: int_set = set end +const my_set_2: int_set = set_empty +``` + +```cameligo group=a +let my_set: int_set = (Set.empty: int set) +``` + +```reasonligo group=a +let my_set: int_set = (Set.empty: set (int)); +``` + + +## Set.literal(element_list_literal: 'a list) : 'a set + +Create a set from the elements of a list. Note that **you must pass a list literal** +to this function, a variable will not work. + + + + +```pascaligo +const s_fb : set(string) = set [ + "foo" ; + "bar" ; +] +``` + + +```cameligo +let literal_op (p: unit) : string set = + Set.literal ["foo"; "bar"; "foobar"] +``` + + +```reasonligo +let literal_op = (p: unit) : set(string) => Set.literal(["foo", "bar", "foobar"]); +``` + + + +## Set.add(addition: a', s: a' set) : a' set + +Add the element `addition` to a set `s`. + + + +```pascaligo group=a +function add_op (const s : set(string)) : set(string) is + begin skip end with set_add("foobar" , s) +``` + + +```cameligo group=a +type int_set = int set +let my_set : int_set = + Set.add 3 (Set.add 2 (Set.add 1 (Set.empty: int set))) +``` + + +```reasonligo group=a +type int_set = set (int); +let my_set : int_set = + Set.add (3, Set.add (2, Set.add (1, Set.empty: set (int)))); +``` + + + +## Set.remove(removal: a', s: a' set) : a' set + +Remove the element `removal` from a set `s`. + + + +```pascaligo group=a +const smaller_set: int_set = set_remove(3, my_set); +``` + + + +```cameligo group=a +let smaller_set: int_set = Set.remove 3 my_set +``` + + + +```reasonligo group=a +let smaller_set: int_set = Set.remove(3, my_set); +``` + + + + +## Set.fold(folding_function: a' -> a' -> a', s: a' set, initial: a') : a' + +Combine the elements of a set into a single value using a folding function. + + + +```pascaligo group=a +function sum(const result: int; const i: int): int is result + i; +// Outputs 6 +const sum_of_a_set: int = set_fold(sum, my_set, 0); +``` + + +```cameligo group=a +let sum (result, i: int * int) : int = result + i +let sum_of_a_set: int = Set.fold sum my_set 0 +``` + + +```reasonligo group=a +let sum = (result_i: (int, int)): int => result_i[0] + result_i[1]; +let sum_of_a_set: int = Set.fold(sum, my_set, 0); +``` + + +## Set.size(s: a' set) : nat + +Get the number of elements in a set. + + + +```pascaligo group=a +const set_size: nat = size (my_set) +``` + + +```cameligo group=a +let set_size: nat = Set.size my_set +``` + + +```reasonligo group=a +let set_size: nat = Set.size (my_set); +``` + + diff --git a/src/test/contracts/set_arithmetic.mligo b/src/test/contracts/set_arithmetic.mligo index 74fdc170f..2713905b3 100644 --- a/src/test/contracts/set_arithmetic.mligo +++ b/src/test/contracts/set_arithmetic.mligo @@ -1,5 +1,8 @@ (* Test set operations in CameLIGO *) +let literal_op (p: unit) : string set = + Set.literal ["foo"; "bar"; "foobar"] + let add_op (s : string set) : string set = Set.add "foobar" s diff --git a/src/test/contracts/set_arithmetic.religo b/src/test/contracts/set_arithmetic.religo index 4e613500d..5aa634333 100644 --- a/src/test/contracts/set_arithmetic.religo +++ b/src/test/contracts/set_arithmetic.religo @@ -1,5 +1,7 @@ /* Test set operations in ReasonLIGO */ +let literal_op = (p: unit) : set(string) => Set.literal(["foo", "bar", "foobar"]); + let add_op = (s: set(string)): set(string) => Set.add("foobar", s); let remove_op = (s: set(string)): set(string) => Set.remove("foobar", s); diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index f384db470..415bb354b 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -582,6 +582,11 @@ let set_arithmetic () : unit result = let set_arithmetic_mligo () : unit result = let%bind program = mtype_file "./contracts/set_arithmetic.mligo" in let%bind program_1 = type_file "./contracts/set_arithmetic-1.ligo" in + let%bind () = + expect_eq program "literal_op" + (e_unit ()) + (e_set [e_string "foo"; e_string "bar"; e_string "foobar"]) + in let%bind () = expect_eq program "size_op" (e_set [e_string "foo"; e_string "bar"; e_string "foobar"]) @@ -612,6 +617,11 @@ let set_arithmetic_mligo () : unit result = let set_arithmetic_religo () : unit result = let%bind program = retype_file "./contracts/set_arithmetic.religo" in let%bind program_1 = type_file "./contracts/set_arithmetic-1.ligo" in + let%bind () = + expect_eq program "literal_op" + (e_unit ()) + (e_set [e_string "foo"; e_string "bar"; e_string "foobar"]) + in let%bind () = expect_eq program "size_op" (e_set [e_string "foo"; e_string "bar"; e_string "foobar"]) diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 247f396f1..908f6ccd0 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -122,6 +122,7 @@ let md_files = [ "/gitlab-pages/docs/advanced/timestamps-addresses.md"; "/gitlab-pages/docs/api/cli-commands.md"; "/gitlab-pages/docs/api/cheat-sheet.md"; + "/gitlab-pages/docs/reference/set.md"; "/gitlab-pages/docs/reference/big_map.md"; "/gitlab-pages/docs/reference/string.md"; ] From d12aa130f71c1bb888f49530bb27ab9b987d731b Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Tue, 11 Feb 2020 18:47:54 -0800 Subject: [PATCH 080/119] Add crypto reference page to doc tests --- src/test/md_file_tests.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/md_file_tests.ml b/src/test/md_file_tests.ml index 908f6ccd0..833769f32 100644 --- a/src/test/md_file_tests.ml +++ b/src/test/md_file_tests.ml @@ -125,6 +125,7 @@ let md_files = [ "/gitlab-pages/docs/reference/set.md"; "/gitlab-pages/docs/reference/big_map.md"; "/gitlab-pages/docs/reference/string.md"; + "/gitlab-pages/docs/reference/crypto.md"; ] let md_root = "../../gitlab-pages/docs/language-basics/" From 953e91bc543c8fd029530d5db9d370ddd0848264 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Wed, 12 Feb 2020 02:24:58 -0800 Subject: [PATCH 081/119] Remove Current.gas from LIGO --- src/passes/operators/operators.ml | 2 -- src/stages/common/PP.ml | 1 - src/stages/common/types.ml | 1 - src/stages/mini_c/PP.ml | 1 - 4 files changed, 5 deletions(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 968b73a1a..94ec09373 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -154,8 +154,6 @@ module Simplify = struct | "time" -> ok C_NOW | "Current.amount" -> ok C_AMOUNT | "amount" -> ok C_AMOUNT - | "Current.gas" -> ok C_STEPS_TO_QUOTA - | "gas" -> ok C_STEPS_TO_QUOTA | "Current.sender" -> ok C_SENDER | "Current.address" -> ok C_ADDRESS | "Current.self_address" -> ok C_SELF_ADDRESS diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index 7235c9472..a3928e26a 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -146,7 +146,6 @@ let constant ppf : constant' -> unit = function | C_SELF_ADDRESS -> fprintf ppf "SELF_ADDRESS" | C_IMPLICIT_ACCOUNT -> fprintf ppf "IMPLICIT_ACCOUNT" | C_SET_DELEGATE -> fprintf ppf "SET_DELEGATE" - | C_STEPS_TO_QUOTA -> fprintf ppf "STEPS_TO_QUOTA" let literal ppf (l : literal) = match l with diff --git a/src/stages/common/types.ml b/src/stages/common/types.ml index d390d1d46..e923bc924 100644 --- a/src/stages/common/types.ml +++ b/src/stages/common/types.ml @@ -288,4 +288,3 @@ and constant' = | C_SELF_ADDRESS | C_IMPLICIT_ACCOUNT | C_SET_DELEGATE - | C_STEPS_TO_QUOTA diff --git a/src/stages/mini_c/PP.ml b/src/stages/mini_c/PP.ml index fb607db79..626b6a23c 100644 --- a/src/stages/mini_c/PP.ml +++ b/src/stages/mini_c/PP.ml @@ -241,7 +241,6 @@ and constant ppf : constant' -> unit = function | C_ADDRESS -> fprintf ppf "ADDRESS" | C_SELF_ADDRESS -> fprintf ppf "SELF_ADDRESS" | C_IMPLICIT_ACCOUNT -> fprintf ppf "IMPLICIT_ACCOUNT" - | C_STEPS_TO_QUOTA -> fprintf ppf "STEPS_TO_QUOTA" | C_SET_DELEGATE -> fprintf ppf "SET_DELEGATE" let%expect_test _ = From a1880b013b1fe60371cdb25eeb2f3b7b00cbefc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Wed, 12 Feb 2020 20:22:59 +0100 Subject: [PATCH 082/119] Fix #147 by allowing comparison of bools --- src/passes/8-compiler/compiler_type.ml | 3 ++- src/passes/operators/helpers.ml | 1 + src/test/contracts/eq_bool.ligo | 5 +++++ src/test/contracts/eq_bool.mligo | 3 +++ src/test/contracts/eq_bool.religo | 8 ++++++++ src/test/integration_tests.ml | 27 ++++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/test/contracts/eq_bool.ligo create mode 100644 src/test/contracts/eq_bool.mligo create mode 100644 src/test/contracts/eq_bool.religo diff --git a/src/passes/8-compiler/compiler_type.ml b/src/passes/8-compiler/compiler_type.ml index 3ff7691ae..3e8690bdc 100644 --- a/src/passes/8-compiler/compiler_type.ml +++ b/src/passes/8-compiler/compiler_type.ml @@ -11,6 +11,7 @@ module Ty = struct open Script_typed_ir + let bool_k = Bool_key None let nat_k = Nat_key None let tez_k = Mutez_key None let int_k = Int_key None @@ -62,7 +63,7 @@ module Ty = struct match tb with | TC_unit -> fail (not_comparable "unit") | TC_void -> fail (not_comparable "void") - | TC_bool -> fail (not_comparable "bool") + | TC_bool -> return bool_k | TC_nat -> return nat_k | TC_mutez -> return tez_k | TC_int -> return int_k diff --git a/src/passes/operators/helpers.ml b/src/passes/operators/helpers.ml index c8e993452..f248b1dc4 100644 --- a/src/passes/operators/helpers.ml +++ b/src/passes/operators/helpers.ml @@ -112,6 +112,7 @@ module Typer = struct List.exists (eq_2 (a , b)) [ t_int () ; t_nat () ; + t_bool () ; t_mutez () ; t_string () ; t_bytes () ; diff --git a/src/test/contracts/eq_bool.ligo b/src/test/contracts/eq_bool.ligo new file mode 100644 index 000000000..92e0e9e1b --- /dev/null +++ b/src/test/contracts/eq_bool.ligo @@ -0,0 +1,5 @@ +function main (const a : bool; const b : bool) : int is + block { + var result : int := 27; + if a = b then result := 999 else result := 1 + } with result diff --git a/src/test/contracts/eq_bool.mligo b/src/test/contracts/eq_bool.mligo new file mode 100644 index 000000000..6869d5dfd --- /dev/null +++ b/src/test/contracts/eq_bool.mligo @@ -0,0 +1,3 @@ +// Test conditional in CameLIGO + +let main (a , b : bool * bool) = if a = b then 999 else 1 diff --git a/src/test/contracts/eq_bool.religo b/src/test/contracts/eq_bool.religo new file mode 100644 index 000000000..5674d49b5 --- /dev/null +++ b/src/test/contracts/eq_bool.religo @@ -0,0 +1,8 @@ +/* Test boolean comparison in ReasonLIGO */ + +let main = ((a , b) : (bool , bool)) => + if (a == b) { + 999; + } else { + 1; + }; diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index bcf47d740..f79d3e8e3 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1205,6 +1205,30 @@ let condition_religo () : unit result = ] in ok () +let eq_bool_common program = + let%bind _ = + bind_map_list (fun ( a , b , expected ) -> + expect_eq program "main" (e_pair (e_bool a) (e_bool b)) (e_int expected)) + [ + ( false , false , 999 ) ; + ( false , true , 1 ) ; + ( true , false , 1 ) ; + ( true , true , 999 ) ; + ] + in + ok () + +let eq_bool () : unit result = + let%bind program = type_file "./contracts/eq_bool.ligo" in + eq_bool_common program + +let eq_bool_mligo () : unit result = + let%bind program = mtype_file "./contracts/eq_bool.mligo" in + eq_bool_common program + +let eq_bool_religo () : unit result = + let%bind program = retype_file "./contracts/eq_bool.religo" in + eq_bool_common program let condition_simple () : unit result = let%bind program = type_file "./contracts/condition-simple.ligo" in @@ -2272,6 +2296,9 @@ let main = test_suite "Integration (End to End)" [ test "condition (ligo)" condition ; test "condition (mligo)" condition_mligo ; test "condition (religo)" condition_religo ; + test "eq bool (ligo)" eq_bool ; + test "eq bool (mligo)" eq_bool_mligo ; + test "eq bool (religo)" eq_bool_religo ; test "shadow" shadow ; test "annotation" annotation ; test "multiple parameters" multiple_parameters ; From f76684031156e7a21627fc92a70bf94ae924132b Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Thu, 13 Feb 2020 04:35:21 -0800 Subject: [PATCH 083/119] Fix commit test for hashlock --- src/test/contracts/hashlock.mligo | 6 ++++-- src/test/hash_lock_tests.ml | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/contracts/hashlock.mligo b/src/test/contracts/hashlock.mligo index 028f0baec..d158bbfd0 100644 --- a/src/test/contracts/hashlock.mligo +++ b/src/test/contracts/hashlock.mligo @@ -22,8 +22,10 @@ type parameter = (* We use hash-commit so that a baker can't steal *) let commit ((p,s): unit * storage) : operation list * storage = - let salted: bytes = Bytes.concat s.hashed (Bytes.pack sender) in - let commit: commit = {date = Current.time + 86400; salted_hash = Crypto.sha256 salted;} in + let salted : bytes = Crypto.sha256 (Bytes.concat + s.hashed + (Bytes.pack sender)) in + let commit: commit = {date = Current.time + 86400; salted_hash = salted;} in let updated_map: commit_set = Big_map.update sender (Some commit) s.commits in let s = {hashed = s.hashed; unused = s.unused; commits = updated_map} in (([]: operation list), s) diff --git a/src/test/hash_lock_tests.ml b/src/test/hash_lock_tests.ml index b82fa5af2..de83d13ca 100644 --- a/src/test/hash_lock_tests.ml +++ b/src/test/hash_lock_tests.ml @@ -56,7 +56,7 @@ let commit () = let%bind lock_time = mk_time "2000-01-02T00:10:11Z" in let test_hash_raw = sha_256_hash (Bytes.of_string "hello world") in let test_hash = e_bytes_raw test_hash_raw in - let%bind packed_sender = pack_payload program (e_bytes_string first_committer) in + let%bind packed_sender = pack_payload program (e_address first_committer) in let salted_hash = e_bytes_raw (sha_256_hash (Bytes.concat Bytes.empty [test_hash_raw; packed_sender])) @@ -72,7 +72,7 @@ let commit () = in let post_commits = e_big_map [((e_address first_committer), commit)] in - let post_storage = storage salted_hash true post_commits in + let post_storage = storage test_hash true post_commits in let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp From 8e9e871d088e30cfcd72833e35d85c48379009cc Mon Sep 17 00:00:00 2001 From: Eowyn Dean Date: Thu, 13 Feb 2020 14:50:35 +0000 Subject: [PATCH 084/119] Update siteConfig.js to collapse docs sidebar categories --- gitlab-pages/website/siteConfig.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gitlab-pages/website/siteConfig.js b/gitlab-pages/website/siteConfig.js index 76e198392..d98334e97 100644 --- a/gitlab-pages/website/siteConfig.js +++ b/gitlab-pages/website/siteConfig.js @@ -150,6 +150,7 @@ const siteConfig = { indexName: 'ligolang', algoliaOptions: {} // Optional, if provided by Algolia }, + docsSideNavCollapsible: true, gaTrackingId: 'UA-153751765-1', gaGtag: true }; From 39fc076c2b58b167439ec3064f2b229914c04ba3 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 13 Feb 2020 16:44:21 +0100 Subject: [PATCH 085/119] fix regression of comparison of key_hash and add a test for it --- src/bin/expect_tests/contract_tests.ml | 7 +++++++ src/passes/8-compiler/compiler_type.ml | 4 ++-- src/test/contracts/key_hash_comparable.ligo | 8 ++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/test/contracts/key_hash_comparable.ligo diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index d68369a3f..2a3c4bd8d 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -1130,3 +1130,10 @@ let%expect_test _ = run_ligo_good [ "compile-storage" ; contract "big_map.ligo" ; "main" ; "(big_map1,unit)" ] ; [%expect {| (Pair { Elt 23 0 ; Elt 42 0 } Unit) |}] + +let%expect_test _ = + run_ligo_good [ "compile-contract" ; contract "key_hash_comparable.ligo" ; "main" ] ; + [%expect {| + { parameter int ; + storage (pair (map %one key_hash nat) (big_map %two key_hash bool)) ; + code { DUP ; CDR ; NIL operation ; PAIR ; DIP { DROP } } } |}] \ No newline at end of file diff --git a/src/passes/8-compiler/compiler_type.ml b/src/passes/8-compiler/compiler_type.ml index 3e8690bdc..9e7d874b0 100644 --- a/src/passes/8-compiler/compiler_type.ml +++ b/src/passes/8-compiler/compiler_type.ml @@ -16,7 +16,7 @@ module Ty = struct let tez_k = Mutez_key None let int_k = Int_key None let string_k = String_key None - let _key_hash_k = Key_hash_key None + let key_hash_k = Key_hash_key None let address_k = Address_key None let timestamp_k = Timestamp_key None let bytes_k = Bytes_key None @@ -74,7 +74,7 @@ module Ty = struct | TC_operation -> fail (not_comparable "operation") | TC_signature -> fail (not_comparable "signature") | TC_key -> fail (not_comparable "key") - | TC_key_hash -> fail (not_comparable "key_hash") + | TC_key_hash -> return key_hash_k | TC_chain_id -> fail (not_comparable "chain_id") let comparable_type : type_value -> ex_comparable_ty result = fun tv -> diff --git a/src/test/contracts/key_hash_comparable.ligo b/src/test/contracts/key_hash_comparable.ligo new file mode 100644 index 000000000..02003b927 --- /dev/null +++ b/src/test/contracts/key_hash_comparable.ligo @@ -0,0 +1,8 @@ +type storage is record + one: map(key_hash, nat); + two: big_map(key_hash, bool); +end + +type return is list (operation) * storage + +function main (const a : int; const store : storage) : return is ((nil: list(operation)), store) \ No newline at end of file From c59be5f7461d431638adf61eefb25774a3310857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jev=20Bj=C3=B6rsell?= Date: Thu, 13 Feb 2020 23:10:02 +0000 Subject: [PATCH 086/119] * Switch to in-line CI for webide over GitLab's child-pipeline feature. There was too many bugs/weirdness with the child-pipeline. Maybe we use it when it matures. * Flatten the build_and_deploy_docker and build_and_deploy_website into one step. They don't appear to be dependent, and if the upstream "test" jobs ran okay, then we can run these jobs in parallel. * Run the webide unit tests in the `test` stage only if there are changes to the tools/webide directory. * Switch to using the new `rules` ([docs](https://docs.gitlab.com/ee/ci/yaml/#rules))property instead of `only` / `except`. `rules` is now the preferred way of setting job policies. `only`/`except` are [candidates for deprecation](https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic). * Build/push docker images only when CI is running on the canonical `ligolang/ligo` repo. Makes hacking on CI in forked repos easier. * Don't push a `latest` tag for the webide. --- .gitlab-ci.yml | 92 +++++++++++++++++++++++++++++++------- tools/webide/webide-ci.yml | 70 ----------------------------- 2 files changed, 76 insertions(+), 86 deletions(-) delete mode 100644 tools/webide/webide-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7beb8dc1..b5b1229ad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,14 +4,16 @@ variables: build_binary_script: "./scripts/distribution/generic/build.sh" package_binary_script: "./scripts/distribution/generic/package.sh" LIGO_REGISTRY_IMAGE_BASE_NAME: "${CI_PROJECT_PATH}/${CI_PROJECT_NAME}" + WEBIDE_IMAGE_NAME: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide" stages: - test - - ide - build_and_package_binaries - build_docker - - build_and_deploy_docker - - build_and_deploy_website + - build_and_deploy + - ide-build + - ide-e2e-test + - ide-deploy # TODO provide sensible CI for master dont-merge-to-master: @@ -32,7 +34,7 @@ dont-merge-to-master: - dist/package/**/* .website_build: &website_build - stage: build_and_deploy_website + stage: build_and_deploy image: node:8 dependencies: - build-and-package-debian-9 @@ -126,17 +128,19 @@ build-current-docker-image: # When a MR/PR is merged to dev # take the previous build and publish it to Docker Hub build-and-publish-latest-docker-image: - stage: build_and_deploy_docker + stage: build_and_deploy <<: *docker dependencies: - build-and-package-debian-10 script: - sh scripts/build_docker_image.sh - sh scripts/test_cli.sh - - docker login -u $LIGO_REGISTRY_USER -p $LIGO_REGISTRY_PASSWORD + - echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next - only: - - dev + rules: + # Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository + - if: '$CI_COMMIT_REF_NAME == "dev" && $CI_PROJECT_PATH == "ligolang/ligo"' + when: always # It'd be a good idea to generate those jobs dynamically, # based on desired targets @@ -192,16 +196,72 @@ build-and-package-ubuntu-19-04: only: - dev - -trigger-webide: - stage: ide - trigger: - include: tools/webide/webide-ci.yml - - # Pages are deployed from dev, be careful not to override 'next' # in case something gets merged into 'dev' while releasing. pages: <<: *website_build + rules: + - if: '$CI_COMMIT_REF_NAME == "dev" && $CI_PROJECT_PATH == "ligolang/ligo"' + when: always + +# WEBIDE jobs + +run-webide-unit-tests: + stage: test + image: node:12-alpine + script: + - cd tools/webide/packages/server + - npm ci + - npm run test only: - - dev + changes: + - tools/webide/** + +build-publish-ide-image: + stage: build_and_deploy + <<: *docker + script: + - ls -F + - find dist/ + - find dist/package/ -name '*ligo_*deb' + - mv $(realpath dist/package/debian-10/*.deb) tools/webide/ligo_deb10.deb + - cd tools/webide + - echo "${CI_BUILD_TOKEN}" | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com + - > + docker build + -t "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}" + --build-arg GIT_TAG="${CI_COMMIT_SHA}" + --build-arg GIT_COMMIT="${CI_COMMIT_SHORT_SHA}" + . + - docker push "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}" + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: always + - if: '$CI_COMMIT_REF_NAME == "dev"' + when: always + +run-webide-e2e-tests: + stage: ide-e2e-test + <<: *docker + image: tmaier/docker-compose + script: + - cd tools/webide/packages/e2e + - export WEBIDE_IMAGE="${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}" + - docker-compose run e2e + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: always + - if: '$CI_COMMIT_REF_NAME == "dev"' + when: always + +deploy-handoff: + # Handoff deployment duties to private repo + stage: ide-deploy + variables: + IDE_DOCKER_IMAGE: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide" + LIGO_COMMIT_REF_NAME: "${CI_COMMIT_SHORT_SHA}" + trigger: ligolang/ligo-webide-deploy + rules: + - if: '$CI_COMMIT_REF_NAME == "dev"' + when: always + diff --git a/tools/webide/webide-ci.yml b/tools/webide/webide-ci.yml deleted file mode 100644 index 3f7d68731..000000000 --- a/tools/webide/webide-ci.yml +++ /dev/null @@ -1,70 +0,0 @@ -# This Gitlab CI config is triggerd by the main ligo gitlab config file -image: docker -services: - - docker:dind - -variables: - CONTAINER_NAME: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide" - -stages: - - unit-test - - build - - e2e-test - - deploy - -run-webide-unit-tests: - stage: unit-test - image: node:12-alpine - script: - - cd tools/webide/packages/server - - npm ci - - npm run test - -build-docker-image: - stage: build - script: - - cd tools/webide - - apk add curl unzip - # Fetch the builid artifact from the upstream debian10 build job, extract the deb - # package file and name it so that the Dockerfile can pick it up during the - # build process. - - > - curl - --fail - --location - --output artifacts.zip - "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_REF_NAME}/download?job=build-and-package-debian-10" - - mv $(unzip -j artifacts.zip| sed -n 's/.*\('ligo_'.*\.deb\).*/\1/p') ligo_deb10.deb - - echo "${CI_BUILD_TOKEN}" | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com - # Pull the last build to use as a cache image to shorten build times when - # possible - - docker pull "${CONTAINER_NAME}:latest" || true - - > - docker build - --cache-from "${CONTAINER_NAME}:latest" - -t "${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}" - -t "${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}" - -t "${CONTAINER_NAME}:latest" - --build-arg GIT_TAG="${CI_COMMIT_SHA}" - --build-arg GIT_COMMIT="${CI_COMMIT_REF_NAME}" - . - - docker push "${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}" - - docker push "${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}" - - docker push "${CONTAINER_NAME}:latest" - -run-webide-e2e-tests: - stage: e2e-test - image: tmaier/docker-compose - script: - - cd tools/webide/packages/e2e - - export WEBIDE_IMAGE="${CONTAINER_NAME}:${CI_COMMIT_SHORT_SHA}" - - docker-compose run e2e - -deploy-handoff: - # Handoff deployment duties to private repo - stage: deploy - variables: - IDE_DOCKER_IMAGE: "registry.gitlab.com/${CI_PROJECT_PATH}/ligo_webide" - LIGO_COMMIT_REF_NAME: "${CI_COMMIT_REF_NAME}" - trigger: ligolang/ligo-webide-deploy - From 2a063a43535947fc1fa43500d94109a80d81c217 Mon Sep 17 00:00:00 2001 From: Maksym Bykovskyy Date: Thu, 13 Feb 2020 17:18:23 -0800 Subject: [PATCH 087/119] Added JSON output to compile command --- .../webide/packages/client/public/index.html | 1 - .../client/src/components/compile-pane.tsx | 26 ++++++++++++++-- .../client/src/redux/actions/compile.ts | 3 +- .../packages/client/src/redux/compile.ts | 25 +++++++++++++--- .../webide/packages/client/src/redux/share.ts | 8 +++-- .../packages/client/src/services/api.ts | 16 ++++++++-- .../server/src/handlers/shared-link.ts | 4 +-- tools/webide/packages/server/src/index.ts | 6 ++-- .../webide/packages/server/src/load-state.ts | 30 +++++++++++++++---- .../packages/server/src/schemas/migration.ts | 4 ++- 10 files changed, 98 insertions(+), 25 deletions(-) diff --git a/tools/webide/packages/client/public/index.html b/tools/webide/packages/client/public/index.html index 1ac8ec87b..ef36e557c 100644 --- a/tools/webide/packages/client/public/index.html +++ b/tools/webide/packages/client/public/index.html @@ -6,7 +6,6 @@ - (Constants.endorsers_per_block c - 1)) + (0 --> (Constants.endorsers_per_block ctxt - 1)) -let check_endorsement_rights ctxt chain_id (op : Kind.endorsement Operation.t) = +let check_endorsement_rights ctxt chain_id (op : Kind.endorsement Operation.t) + = let current_level = Level.current ctxt in - let Single (Endorsement { level ; _ }) = op.protocol_data.contents in - begin - if Raw_level.(succ level = current_level.level) then - return (Alpha_context.allowed_endorsements ctxt) - else - endorsement_rights ctxt (Level.from_raw ctxt level) - end >>=? fun endorsements -> + let (Single (Endorsement {level; _})) = op.protocol_data.contents in + ( if Raw_level.(succ level = current_level.level) then + return (Alpha_context.allowed_endorsements ctxt) + else endorsement_rights ctxt (Level.from_raw ctxt level) ) + >>=? fun endorsements -> match Signature.Public_key_hash.Map.fold (* no find_first *) (fun pkh (pk, slots, used) acc -> - match Operation.check_signature_sync pk chain_id op with - | Error _ -> acc - | Ok () -> Some (pkh, slots, used)) - endorsements None + match Operation.check_signature_sync pk chain_id op with + | Error _ -> + acc + | Ok () -> + Some (pkh, slots, used)) + endorsements + None with - | None -> fail Unexpected_endorsement - | Some v -> return v + | None -> + fail Unexpected_endorsement + | Some v -> + return v let select_delegate delegate delegate_list max_priority = let rec loop acc l n = - if Compare.Int.(n >= max_priority) - then return (List.rev acc) + if Compare.Int.(n >= max_priority) then return (List.rev acc) else - let LCons (pk, t) = l in + let (LCons (pk, t)) = l in let acc = - if Signature.Public_key_hash.equal delegate (Signature.Public_key.hash pk) + if + Signature.Public_key_hash.equal + delegate + (Signature.Public_key.hash pk) then n :: acc - else acc in - t () >>=? fun t -> - loop acc t (succ n) + else acc + in + t () >>=? fun t -> loop acc t (succ n) in loop [] delegate_list 0 -let first_baking_priorities - ctxt - ?(max_priority = 32) - delegate level = - baking_priorities ctxt level >>=? fun delegate_list -> - select_delegate delegate delegate_list max_priority +let first_baking_priorities ctxt ?(max_priority = 32) delegate level = + baking_priorities ctxt level + >>=? fun delegate_list -> select_delegate delegate delegate_list max_priority let check_hash hash stamp_threshold = let bytes = Block_hash.to_bytes hash in @@ -273,84 +319,89 @@ let check_hash hash stamp_threshold = let check_header_proof_of_work_stamp shell contents stamp_threshold = let hash = Block_header.hash - { shell ; protocol_data = { contents ; signature = Signature.zero } } in + {shell; protocol_data = {contents; signature = Signature.zero}} + in check_hash hash stamp_threshold let check_proof_of_work_stamp ctxt block = let proof_of_work_threshold = Constants.proof_of_work_threshold ctxt in - if check_header_proof_of_work_stamp + if + check_header_proof_of_work_stamp block.Block_header.shell block.protocol_data.contents - proof_of_work_threshold then - return_unit - else - fail Invalid_stamp + proof_of_work_threshold + then return_unit + else fail Invalid_stamp let check_signature block chain_id key = let check_signature key - { Block_header.shell ; protocol_data = { contents ; signature } } = + {Block_header.shell; protocol_data = {contents; signature}} = let unsigned_header = Data_encoding.Binary.to_bytes_exn Block_header.unsigned_encoding - (shell, contents) in - Signature.check ~watermark:(Block_header chain_id) key signature unsigned_header in - if check_signature key block then - return_unit + (shell, contents) + in + Signature.check + ~watermark:(Block_header chain_id) + key + signature + unsigned_header + in + if check_signature key block then return_unit else - fail (Invalid_block_signature (Block_header.hash block, - Signature.Public_key.hash key)) + fail + (Invalid_block_signature + (Block_header.hash block, Signature.Public_key.hash key)) let max_fitness_gap _ctxt = 1L let check_fitness_gap ctxt (block : Block_header.t) = let current_fitness = Fitness.current ctxt in - Lwt.return (Fitness.to_int64 block.shell.fitness) >>=? fun announced_fitness -> + Lwt.return (Fitness.to_int64 block.shell.fitness) + >>=? fun announced_fitness -> let gap = Int64.sub announced_fitness current_fitness in if Compare.Int64.(gap <= 0L || max_fitness_gap ctxt < gap) then fail (Invalid_fitness_gap (max_fitness_gap ctxt, gap)) - else - return_unit + else return_unit let last_of_a_cycle ctxt l = - Compare.Int32.(Int32.succ l.Level.cycle_position = - Constants.blocks_per_cycle ctxt) + Compare.Int32.( + Int32.succ l.Level.cycle_position = Constants.blocks_per_cycle ctxt) let dawn_of_a_new_cycle ctxt = let level = Level.current ctxt in - if last_of_a_cycle ctxt level then - return_some level.cycle - else - return_none + if last_of_a_cycle ctxt level then return_some level.cycle else return_none let minimum_allowed_endorsements ctxt ~block_delay = let minimum = Constants.initial_endorsers ctxt in let delay_per_missing_endorsement = Int64.to_int - (Period.to_seconds - (Constants.delay_per_missing_endorsement ctxt)) + (Period.to_seconds (Constants.delay_per_missing_endorsement ctxt)) in let reduced_time_constraint = let delay = Int64.to_int (Period.to_seconds block_delay) in - if Compare.Int.(delay_per_missing_endorsement = 0) then - delay - else - delay / delay_per_missing_endorsement + if Compare.Int.(delay_per_missing_endorsement = 0) then delay + else delay / delay_per_missing_endorsement in Compare.Int.max 0 (minimum - reduced_time_constraint) let minimal_valid_time ctxt ~priority ~endorsing_power = let predecessor_timestamp = Timestamp.current ctxt in - minimal_time ctxt - priority predecessor_timestamp >>=? fun minimal_time -> + minimal_time ctxt priority predecessor_timestamp + >>=? fun minimal_time -> let minimal_required_endorsements = Constants.initial_endorsers ctxt in let delay_per_missing_endorsement = Constants.delay_per_missing_endorsement ctxt in let missing_endorsements = - Compare.Int.max 0 (minimal_required_endorsements - endorsing_power) in - match Period.mult - (Int32.of_int missing_endorsements) - delay_per_missing_endorsement with + Compare.Int.max 0 (minimal_required_endorsements - endorsing_power) + in + match + Period.mult + (Int32.of_int missing_endorsements) + delay_per_missing_endorsement + with | Ok delay -> return (Time.add minimal_time (Period.to_seconds delay)) - | Error _ as err -> Lwt.return err + | Error _ as err -> + Lwt.return err diff --git a/vendors/ligo-utils/tezos-protocol-alpha/baking.mli b/vendors/ligo-utils/tezos-protocol-alpha/baking.mli index 39cc2e8e2..eb6f1f6fe 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/baking.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/baking.mli @@ -23,67 +23,81 @@ (* *) (*****************************************************************************) - open Alpha_context open Misc type error += Invalid_fitness_gap of int64 * int64 (* `Permanent *) -type error += Timestamp_too_early of Timestamp.t * Timestamp.t (* `Permanent *) -type error += Invalid_block_signature of Block_hash.t * Signature.Public_key_hash.t (* `Permanent *) + +type error += Timestamp_too_early of Timestamp.t * Timestamp.t + +(* `Permanent *) + +type error += + | Invalid_block_signature of Block_hash.t * Signature.Public_key_hash.t + +(* `Permanent *) + type error += Unexpected_endorsement -type error += Invalid_signature (* `Permanent *) -type error += Invalid_stamp (* `Permanent *) + +type error += Invalid_signature (* `Permanent *) + +type error += Invalid_stamp (* `Permanent *) (** [minimal_time ctxt priority pred_block_time] returns the minimal time, given the predecessor block timestamp [pred_block_time], after which a baker with priority [priority] is allowed to bake. Fail with [Invalid_time_between_blocks_constant] if the minimal time cannot be computed. *) -val minimal_time: context -> int -> Time.t -> Time.t tzresult Lwt.t +val minimal_time : context -> int -> Time.t -> Time.t tzresult Lwt.t (** [check_baking_rights ctxt block pred_timestamp] verifies that: * the contract that owned the roll at cycle start has the block signer as delegate. * the timestamp is coherent with the announced slot. *) -val check_baking_rights: - context -> Block_header.contents -> Time.t -> +val check_baking_rights : + context -> + Block_header.contents -> + Time.t -> (public_key * Period.t) tzresult Lwt.t (** For a given level computes who has the right to include an endorsement in the next block. The result can be stored in Alpha_context.allowed_endorsements *) -val endorsement_rights: +val endorsement_rights : context -> Level.t -> (public_key * int list * bool) Signature.Public_key_hash.Map.t tzresult Lwt.t (** Check that the operation was signed by a delegate allowed to endorse at the level specified by the endorsement. *) -val check_endorsement_rights: - context -> Chain_id.t -> Kind.endorsement Operation.t -> +val check_endorsement_rights : + context -> + Chain_id.t -> + Kind.endorsement Operation.t -> (public_key_hash * int list * bool) tzresult Lwt.t (** Returns the baking reward calculated w.r.t a given priority [p] and a - number [e] of included endorsements as follows: - (block_reward / (p+1)) * (0.8 + 0.2 * e / endorsers_per_block) -*) -val baking_reward: context -> - block_priority:int -> included_endorsements:int -> Tez.t tzresult Lwt.t + number [e] of included endorsements *) +val baking_reward : + context -> + block_priority:int -> + included_endorsements:int -> + Tez.t tzresult Lwt.t (** Returns the endorsing reward calculated w.r.t a given priority. *) -val endorsing_reward: context -> block_priority:int -> int -> Tez.t tzresult Lwt.t +val endorsing_reward : + context -> block_priority:int -> int -> Tez.t tzresult Lwt.t (** [baking_priorities ctxt level] is the lazy list of contract's public key hashes that are allowed to bake for [level]. *) -val baking_priorities: - context -> Level.t -> public_key lazy_list +val baking_priorities : context -> Level.t -> public_key lazy_list (** [first_baking_priorities ctxt ?max_priority contract_hash level] is a list of priorities of max [?max_priority] elements, where the delegate of [contract_hash] is allowed to bake for [level]. If [?max_priority] is [None], a sensible number of priorities is returned. *) -val first_baking_priorities: +val first_baking_priorities : context -> ?max_priority:int -> public_key_hash -> @@ -92,27 +106,28 @@ val first_baking_priorities: (** [check_signature ctxt chain_id block id] check if the block is signed with the given key, and belongs to the given [chain_id] *) -val check_signature: Block_header.t -> Chain_id.t -> public_key -> unit tzresult Lwt.t +val check_signature : + Block_header.t -> Chain_id.t -> public_key -> unit tzresult Lwt.t (** Checks if the header that would be built from the given components is valid for the given diffculty. The signature is not passed as it is does not impact the proof-of-work stamp. The stamp is checked on the hash of a block header whose signature has been zeroed-out. *) -val check_header_proof_of_work_stamp: +val check_header_proof_of_work_stamp : Block_header.shell_header -> Block_header.contents -> int64 -> bool (** verify if the proof of work stamp is valid *) -val check_proof_of_work_stamp: +val check_proof_of_work_stamp : context -> Block_header.t -> unit tzresult Lwt.t (** check if the gap between the fitness of the current context and the given block is within the protocol parameters *) -val check_fitness_gap: - context -> Block_header.t -> unit tzresult Lwt.t +val check_fitness_gap : context -> Block_header.t -> unit tzresult Lwt.t -val dawn_of_a_new_cycle: context -> Cycle.t option tzresult Lwt.t +val dawn_of_a_new_cycle : context -> Cycle.t option tzresult Lwt.t -val earlier_predecessor_timestamp: context -> Level.t -> Timestamp.t tzresult Lwt.t +val earlier_predecessor_timestamp : + context -> Level.t -> Timestamp.t tzresult Lwt.t (** Since Emmy+ @@ -138,14 +153,11 @@ val earlier_predecessor_timestamp: context -> Level.t -> Timestamp.t tzresult Lw time to bake at the block's priority (as returned by `minimum_time`), it returns the minimum number of endorsements that the block has to contain *) -val minimum_allowed_endorsements: context -> block_delay:Period.t -> int +val minimum_allowed_endorsements : context -> block_delay:Period.t -> int (** This is the somehow the dual of the previous function. Given a block priority and a number of endorsement slots (given by the `endorsing_power` argument), it returns the minimum time at which the next block can be baked. *) -val minimal_valid_time: - context -> - priority:int -> - endorsing_power: int -> - Time.t tzresult Lwt.t +val minimal_valid_time : + context -> priority:int -> endorsing_power:int -> Time.t tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.ml b/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.ml index b18824748..4152c33e9 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.ml @@ -23,24 +23,30 @@ (* *) (*****************************************************************************) -module H = Blake2B.Make(Base58)(struct - let name = "Blinded public key hash" - let title = "A blinded public key hash" - let b58check_prefix = "\001\002\049\223" - let size = Some Ed25519.Public_key_hash.size - end) +module H = + Blake2B.Make + (Base58) + (struct + let name = "Blinded public key hash" + + let title = "A blinded public key hash" + + let b58check_prefix = "\001\002\049\223" + + let size = Some Ed25519.Public_key_hash.size + end) include H -let () = - Base58.check_encoded_prefix b58check_encoding "btz1" 37 +let () = Base58.check_encoded_prefix b58check_encoding "btz1" 37 let of_ed25519_pkh activation_code pkh = - hash_bytes ~key:activation_code [ Ed25519.Public_key_hash.to_bytes pkh ] + hash_bytes ~key:activation_code [Ed25519.Public_key_hash.to_bytes pkh] type activation_code = MBytes.t let activation_code_size = Ed25519.Public_key_hash.size + let activation_code_encoding = Data_encoding.Fixed.bytes activation_code_size let activation_code_of_hex h = diff --git a/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.mli b/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.mli index c9306c867..75cd58758 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/blinded_public_key_hash.mli @@ -26,9 +26,11 @@ include S.HASH val encoding : t Data_encoding.t + val rpc_arg : t RPC_arg.t type activation_code + val activation_code_encoding : activation_code Data_encoding.t val of_ed25519_pkh : activation_code -> Ed25519.Public_key_hash.t -> t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.ml index 7fb78dedf..b75ba5d6d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.ml @@ -25,114 +25,106 @@ (** Block header *) -type t = { - shell: Block_header.shell_header ; - protocol_data: protocol_data ; -} +type t = {shell : Block_header.shell_header; protocol_data : protocol_data} -and protocol_data = { - contents: contents ; - signature: Signature.t ; -} +and protocol_data = {contents : contents; signature : Signature.t} and contents = { - priority: int ; - seed_nonce_hash: Nonce_hash.t option ; - proof_of_work_nonce: MBytes.t ; + priority : int; + seed_nonce_hash : Nonce_hash.t option; + proof_of_work_nonce : MBytes.t; } type block_header = t type raw = Block_header.t + type shell_header = Block_header.shell_header let raw_encoding = Block_header.encoding + let shell_header_encoding = Block_header.shell_header_encoding let contents_encoding = let open Data_encoding in - def "block_header.alpha.unsigned_contents" @@ - conv - (fun { priority ; seed_nonce_hash ; proof_of_work_nonce } -> - (priority, proof_of_work_nonce, seed_nonce_hash)) - (fun (priority, proof_of_work_nonce, seed_nonce_hash) -> - { priority ; seed_nonce_hash ; proof_of_work_nonce }) - (obj3 - (req "priority" uint16) - (req "proof_of_work_nonce" - (Fixed.bytes Constants_repr.proof_of_work_nonce_size)) - (opt "seed_nonce_hash" Nonce_hash.encoding)) + def "block_header.alpha.unsigned_contents" + @@ conv + (fun {priority; seed_nonce_hash; proof_of_work_nonce} -> + (priority, proof_of_work_nonce, seed_nonce_hash)) + (fun (priority, proof_of_work_nonce, seed_nonce_hash) -> + {priority; seed_nonce_hash; proof_of_work_nonce}) + (obj3 + (req "priority" uint16) + (req + "proof_of_work_nonce" + (Fixed.bytes Constants_repr.proof_of_work_nonce_size)) + (opt "seed_nonce_hash" Nonce_hash.encoding)) let protocol_data_encoding = let open Data_encoding in - def "block_header.alpha.signed_contents" @@ - conv - (fun { contents ; signature } -> (contents, signature)) - (fun (contents, signature) -> { contents ; signature }) - (merge_objs - contents_encoding - (obj1 (req "signature" Signature.encoding))) + def "block_header.alpha.signed_contents" + @@ conv + (fun {contents; signature} -> (contents, signature)) + (fun (contents, signature) -> {contents; signature}) + (merge_objs + contents_encoding + (obj1 (req "signature" Signature.encoding))) -let raw { shell ; protocol_data ; } = +let raw {shell; protocol_data} = let protocol_data = - Data_encoding.Binary.to_bytes_exn - protocol_data_encoding - protocol_data in - { Block_header.shell ; protocol_data } + Data_encoding.Binary.to_bytes_exn protocol_data_encoding protocol_data + in + {Block_header.shell; protocol_data} let unsigned_encoding = let open Data_encoding in - merge_objs - Block_header.shell_header_encoding - contents_encoding + merge_objs Block_header.shell_header_encoding contents_encoding let encoding = let open Data_encoding in - def "block_header.alpha.full_header" @@ - conv - (fun { shell ; protocol_data } -> - (shell, protocol_data)) - (fun (shell, protocol_data) -> - { shell ; protocol_data }) - (merge_objs - Block_header.shell_header_encoding - protocol_data_encoding) + def "block_header.alpha.full_header" + @@ conv + (fun {shell; protocol_data} -> (shell, protocol_data)) + (fun (shell, protocol_data) -> {shell; protocol_data}) + (merge_objs Block_header.shell_header_encoding protocol_data_encoding) (** Constants *) let max_header_length = - let fake_shell = { - Block_header.level = 0l ; - proto_level = 0 ; - predecessor = Block_hash.zero ; - timestamp = Time.of_seconds 0L ; - validation_passes = 0 ; - operations_hash = Operation_list_list_hash.zero ; - fitness = Fitness_repr.from_int64 0L ; - context = Context_hash.zero ; - } + let fake_shell = + { + Block_header.level = 0l; + proto_level = 0; + predecessor = Block_hash.zero; + timestamp = Time.of_seconds 0L; + validation_passes = 0; + operations_hash = Operation_list_list_hash.zero; + fitness = Fitness_repr.from_int64 0L; + context = Context_hash.zero; + } and fake_contents = - { priority = 0 ; + { + priority = 0; proof_of_work_nonce = - MBytes.create Constants_repr.proof_of_work_nonce_size ; - seed_nonce_hash = Some Nonce_hash.zero - } in + MBytes.create Constants_repr.proof_of_work_nonce_size; + seed_nonce_hash = Some Nonce_hash.zero; + } + in Data_encoding.Binary.length encoding - { shell = fake_shell ; - protocol_data = { - contents = fake_contents ; - signature = Signature.zero ; - } + { + shell = fake_shell; + protocol_data = {contents = fake_contents; signature = Signature.zero}; } (** Header parsing entry point *) let hash_raw = Block_header.hash -let hash { shell ; protocol_data } = + +let hash {shell; protocol_data} = Block_header.hash - { shell ; + { + shell; protocol_data = - Data_encoding.Binary.to_bytes_exn - protocol_data_encoding - protocol_data } + Data_encoding.Binary.to_bytes_exn protocol_data_encoding protocol_data; + } diff --git a/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.mli index 9ce44a3d5..bbbcae80c 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/block_header_repr.mli @@ -23,38 +23,39 @@ (* *) (*****************************************************************************) -type t = { - shell: Block_header.shell_header ; - protocol_data: protocol_data ; -} +type t = {shell : Block_header.shell_header; protocol_data : protocol_data} -and protocol_data = { - contents: contents ; - signature: Signature.t ; -} +and protocol_data = {contents : contents; signature : Signature.t} and contents = { - priority: int ; - seed_nonce_hash: Nonce_hash.t option ; - proof_of_work_nonce: MBytes.t ; + priority : int; + seed_nonce_hash : Nonce_hash.t option; + proof_of_work_nonce : MBytes.t; } type block_header = t type raw = Block_header.t + type shell_header = Block_header.shell_header -val raw: block_header -> raw +val raw : block_header -> raw -val encoding: block_header Data_encoding.encoding -val raw_encoding: raw Data_encoding.t -val contents_encoding: contents Data_encoding.t -val unsigned_encoding: (Block_header.shell_header * contents) Data_encoding.t -val protocol_data_encoding: protocol_data Data_encoding.encoding -val shell_header_encoding: shell_header Data_encoding.encoding +val encoding : block_header Data_encoding.encoding + +val raw_encoding : raw Data_encoding.t + +val contents_encoding : contents Data_encoding.t + +val unsigned_encoding : (Block_header.shell_header * contents) Data_encoding.t + +val protocol_data_encoding : protocol_data Data_encoding.encoding + +val shell_header_encoding : shell_header Data_encoding.encoding -val max_header_length: int (** The maximum size of block headers in bytes *) +val max_header_length : int -val hash: block_header -> Block_hash.t -val hash_raw: raw -> Block_hash.t +val hash : block_header -> Block_hash.t + +val hash_raw : raw -> Block_hash.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.ml index 8e0b46abc..f21ebc257 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.ml @@ -26,100 +26,128 @@ open Misc let init_account ctxt - ({ public_key_hash ; public_key ; amount }: Parameters_repr.bootstrap_account) = + ({public_key_hash; public_key; amount} : Parameters_repr.bootstrap_account) + = let contract = Contract_repr.implicit_contract public_key_hash in - Contract_storage.credit ctxt contract amount >>=? fun ctxt -> + Contract_storage.credit ctxt contract amount + >>=? fun ctxt -> match public_key with | Some public_key -> - Contract_storage.reveal_manager_key ctxt public_key_hash public_key >>=? fun ctxt -> - Delegate_storage.set ctxt contract (Some public_key_hash) >>=? fun ctxt -> + Contract_storage.reveal_manager_key ctxt public_key_hash public_key + >>=? fun ctxt -> + Delegate_storage.set ctxt contract (Some public_key_hash) + >>=? fun ctxt -> return ctxt + | None -> return ctxt - | None -> return ctxt let init_contract ~typecheck ctxt - ({ delegate ; amount ; script }: Parameters_repr.bootstrap_contract) = - Contract_storage.fresh_contract_from_current_nonce ctxt >>=? fun (ctxt, contract) -> - typecheck ctxt script >>=? fun (script, ctxt) -> - Contract_storage.originate ctxt contract + ({delegate; amount; script} : Parameters_repr.bootstrap_contract) = + Contract_storage.fresh_contract_from_current_nonce ctxt + >>=? fun (ctxt, contract) -> + typecheck ctxt script + >>=? fun (script, ctxt) -> + Contract_storage.originate + ctxt + contract ~balance:amount ~prepaid_bootstrap_storage:true ~script - ~delegate:(Some delegate) >>=? fun ctxt -> - return ctxt + ~delegate:(Some delegate) + >>=? fun ctxt -> return ctxt let init ctxt ~typecheck ?ramp_up_cycles ?no_reward_cycles accounts contracts = let nonce = - Operation_hash.hash_bytes - [ MBytes.of_string "Un festival de GADT." ] in + Operation_hash.hash_bytes [MBytes.of_string "Un festival de GADT."] + in let ctxt = Raw_context.init_origination_nonce ctxt nonce in - fold_left_s init_account ctxt accounts >>=? fun ctxt -> - fold_left_s (init_contract ~typecheck) ctxt contracts >>=? fun ctxt -> - begin - match no_reward_cycles with - | None -> return ctxt - | Some cycles -> - (* Store pending ramp ups. *) - let constants = Raw_context.constants ctxt in - (* Start without reward *) - Raw_context.patch_constants ctxt - (fun c -> - { c with - block_reward = Tez_repr.zero ; - endorsement_reward = Tez_repr.zero }) >>= fun ctxt -> - (* Store the final reward. *) - Storage.Ramp_up.Rewards.init ctxt - (Cycle_repr.of_int32_exn (Int32.of_int cycles)) - (constants.block_reward, - constants.endorsement_reward) - end >>=? fun ctxt -> - match ramp_up_cycles with - | None -> return ctxt + fold_left_s init_account ctxt accounts + >>=? fun ctxt -> + fold_left_s (init_contract ~typecheck) ctxt contracts + >>=? fun ctxt -> + ( match no_reward_cycles with + | None -> + return ctxt | Some cycles -> (* Store pending ramp ups. *) let constants = Raw_context.constants ctxt in - Lwt.return Tez_repr.(constants.block_security_deposit /? Int64.of_int cycles) >>=? fun block_step -> - Lwt.return Tez_repr.(constants.endorsement_security_deposit /? Int64.of_int cycles) >>=? fun endorsement_step -> + (* Start without rewards *) + Raw_context.patch_constants ctxt (fun c -> + { + c with + baking_reward_per_endorsement = [Tez_repr.zero]; + endorsement_reward = [Tez_repr.zero]; + }) + >>= fun ctxt -> + (* Store the final reward. *) + Storage.Ramp_up.Rewards.init + ctxt + (Cycle_repr.of_int32_exn (Int32.of_int cycles)) + (constants.baking_reward_per_endorsement, constants.endorsement_reward) + ) + >>=? fun ctxt -> + match ramp_up_cycles with + | None -> + return ctxt + | Some cycles -> + (* Store pending ramp ups. *) + let constants = Raw_context.constants ctxt in + Lwt.return + Tez_repr.(constants.block_security_deposit /? Int64.of_int cycles) + >>=? fun block_step -> + Lwt.return + Tez_repr.( + constants.endorsement_security_deposit /? Int64.of_int cycles) + >>=? fun endorsement_step -> (* Start without security_deposit *) - Raw_context.patch_constants ctxt - (fun c -> - { c with - block_security_deposit = Tez_repr.zero ; - endorsement_security_deposit = Tez_repr.zero }) >>= fun ctxt -> + Raw_context.patch_constants ctxt (fun c -> + { + c with + block_security_deposit = Tez_repr.zero; + endorsement_security_deposit = Tez_repr.zero; + }) + >>= fun ctxt -> fold_left_s (fun ctxt cycle -> - Lwt.return Tez_repr.(block_step *? Int64.of_int cycle) >>=? fun block_security_deposit -> - Lwt.return Tez_repr.(endorsement_step *? Int64.of_int cycle) >>=? fun endorsement_security_deposit -> - let cycle = Cycle_repr.of_int32_exn (Int32.of_int cycle) in - Storage.Ramp_up.Security_deposits.init ctxt cycle - (block_security_deposit, endorsement_security_deposit)) + Lwt.return Tez_repr.(block_step *? Int64.of_int cycle) + >>=? fun block_security_deposit -> + Lwt.return Tez_repr.(endorsement_step *? Int64.of_int cycle) + >>=? fun endorsement_security_deposit -> + let cycle = Cycle_repr.of_int32_exn (Int32.of_int cycle) in + Storage.Ramp_up.Security_deposits.init + ctxt + cycle + (block_security_deposit, endorsement_security_deposit)) ctxt - (1 --> (cycles - 1)) >>=? fun ctxt -> + (1 --> (cycles - 1)) + >>=? fun ctxt -> (* Store the final security deposits. *) - Storage.Ramp_up.Security_deposits.init ctxt + Storage.Ramp_up.Security_deposits.init + ctxt (Cycle_repr.of_int32_exn (Int32.of_int cycles)) - (constants.block_security_deposit, - constants.endorsement_security_deposit) >>=? fun ctxt -> - return ctxt + ( constants.block_security_deposit, + constants.endorsement_security_deposit ) + >>=? fun ctxt -> return ctxt let cycle_end ctxt last_cycle = let next_cycle = Cycle_repr.succ last_cycle in - begin - Storage.Ramp_up.Rewards.get_option ctxt next_cycle >>=? function - | None -> return ctxt - | Some (block_reward, endorsement_reward) -> - Storage.Ramp_up.Rewards.delete ctxt next_cycle >>=? fun ctxt -> - Raw_context.patch_constants ctxt - (fun c -> - { c with block_reward ; - endorsement_reward }) >>= fun ctxt -> - return ctxt - end >>=? fun ctxt -> - Storage.Ramp_up.Security_deposits.get_option ctxt next_cycle >>=? function - | None -> return ctxt - | Some (block_security_deposit, endorsement_security_deposit) -> - Storage.Ramp_up.Security_deposits.delete ctxt next_cycle >>=? fun ctxt -> - Raw_context.patch_constants ctxt - (fun c -> - { c with block_security_deposit ; - endorsement_security_deposit }) >>= fun ctxt -> + Storage.Ramp_up.Rewards.get_option ctxt next_cycle + >>=? (function + | None -> + return ctxt + | Some (baking_reward_per_endorsement, endorsement_reward) -> + Storage.Ramp_up.Rewards.delete ctxt next_cycle + >>=? fun ctxt -> + Raw_context.patch_constants ctxt (fun c -> + {c with baking_reward_per_endorsement; endorsement_reward}) + >>= fun ctxt -> return ctxt) + >>=? fun ctxt -> + Storage.Ramp_up.Security_deposits.get_option ctxt next_cycle + >>=? function + | None -> return ctxt + | Some (block_security_deposit, endorsement_security_deposit) -> + Storage.Ramp_up.Security_deposits.delete ctxt next_cycle + >>=? fun ctxt -> + Raw_context.patch_constants ctxt (fun c -> + {c with block_security_deposit; endorsement_security_deposit}) + >>= fun ctxt -> return ctxt diff --git a/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.mli index b489228a4..1b4cf8cf8 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/bootstrap_storage.mli @@ -23,18 +23,18 @@ (* *) (*****************************************************************************) -val init: +val init : Raw_context.t -> - typecheck:(Raw_context.t -> Script_repr.t -> - ((Script_repr.t * Contract_storage.big_map_diff option) * Raw_context.t) - tzresult Lwt.t) -> + typecheck:(Raw_context.t -> + Script_repr.t -> + ( (Script_repr.t * Contract_storage.big_map_diff option) + * Raw_context.t ) + tzresult + Lwt.t) -> ?ramp_up_cycles:int -> ?no_reward_cycles:int -> Parameters_repr.bootstrap_account list -> Parameters_repr.bootstrap_contract list -> Raw_context.t tzresult Lwt.t -val cycle_end: - Raw_context.t -> - Cycle_repr.t -> - Raw_context.t tzresult Lwt.t +val cycle_end : Raw_context.t -> Cycle_repr.t -> Raw_context.t tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.ml index 89b9272de..e64be9c01 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.ml @@ -24,17 +24,15 @@ (*****************************************************************************) type t = { - blinded_public_key_hash : Blinded_public_key_hash.t ; - amount : Tez_repr.t + blinded_public_key_hash : Blinded_public_key_hash.t; + amount : Tez_repr.t; } let encoding = let open Data_encoding in conv - (fun { blinded_public_key_hash ; amount } -> - ( blinded_public_key_hash, amount )) - (fun ( blinded_public_key_hash, amount) -> - { blinded_public_key_hash ; amount }) - (tup2 - Blinded_public_key_hash.encoding - Tez_repr.encoding) + (fun {blinded_public_key_hash; amount} -> + (blinded_public_key_hash, amount)) + (fun (blinded_public_key_hash, amount) -> + {blinded_public_key_hash; amount}) + (tup2 Blinded_public_key_hash.encoding Tez_repr.encoding) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.mli index 4bd74810a..edca4134d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/commitment_repr.mli @@ -24,8 +24,8 @@ (*****************************************************************************) type t = { - blinded_public_key_hash : Blinded_public_key_hash.t ; - amount : Tez_repr.t ; + blinded_public_key_hash : Blinded_public_key_hash.t; + amount : Tez_repr.t; } val encoding : t Data_encoding.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.ml index a8680b976..21a500b62 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.ml @@ -24,10 +24,11 @@ (*****************************************************************************) let get_opt = Storage.Commitments.get_option + let delete = Storage.Commitments.delete -let init ctxt commitments = - let init_commitment ctxt Commitment_repr.{ blinded_public_key_hash ; amount } = - Storage.Commitments.init ctxt blinded_public_key_hash amount in - fold_left_s init_commitment ctxt commitments >>=? fun ctxt -> - return ctxt +let init ctxt commitments = + let init_commitment ctxt Commitment_repr.{blinded_public_key_hash; amount} = + Storage.Commitments.init ctxt blinded_public_key_hash amount + in + fold_left_s init_commitment ctxt commitments >>=? fun ctxt -> return ctxt diff --git a/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.mli index 1e5be6dc5..1591cbebb 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/commitment_storage.mli @@ -23,15 +23,13 @@ (* *) (*****************************************************************************) -val init: - Raw_context.t -> - Commitment_repr.t list -> - Raw_context.t tzresult Lwt.t +val init : + Raw_context.t -> Commitment_repr.t list -> Raw_context.t tzresult Lwt.t -val get_opt: - Raw_context.t -> Blinded_public_key_hash.t -> +val get_opt : + Raw_context.t -> + Blinded_public_key_hash.t -> Tez_repr.t option tzresult Lwt.t -val delete: - Raw_context.t -> Blinded_public_key_hash.t -> - Raw_context.t tzresult Lwt.t +val delete : + Raw_context.t -> Blinded_public_key_hash.t -> Raw_context.t tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/constants_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/constants_repr.ml index 6ad7b1526..d1b8246f9 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/constants_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/constants_repr.ml @@ -24,41 +24,48 @@ (*****************************************************************************) let version_number_004 = "\000" + let version_number = "\001" + let proof_of_work_nonce_size = 8 + let nonce_length = 32 + let max_revelations_per_block = 32 + let max_proposals_per_delegate = 20 + let max_operation_data_length = 16 * 1024 (* 16kB *) type fixed = { - proof_of_work_nonce_size : int ; - nonce_length : int ; - max_revelations_per_block : int ; - max_operation_data_length : int ; - max_proposals_per_delegate : int ; + proof_of_work_nonce_size : int; + nonce_length : int; + max_revelations_per_block : int; + max_operation_data_length : int; + max_proposals_per_delegate : int; } let fixed_encoding = let open Data_encoding in conv (fun c -> - (c.proof_of_work_nonce_size, + ( c.proof_of_work_nonce_size, c.nonce_length, c.max_revelations_per_block, c.max_operation_data_length, - c.max_proposals_per_delegate)) - (fun (proof_of_work_nonce_size, - nonce_length, - max_revelations_per_block, - max_operation_data_length, - max_proposals_per_delegate) -> - { proof_of_work_nonce_size ; - nonce_length ; - max_revelations_per_block ; - max_operation_data_length ; - max_proposals_per_delegate ; - } ) + c.max_proposals_per_delegate )) + (fun ( proof_of_work_nonce_size, + nonce_length, + max_revelations_per_block, + max_operation_data_length, + max_proposals_per_delegate ) -> + { + proof_of_work_nonce_size; + nonce_length; + max_revelations_per_block; + max_operation_data_length; + max_proposals_per_delegate; + }) (obj5 (req "proof_of_work_nonce_size" uint8) (req "nonce_length" uint8) @@ -66,48 +73,50 @@ let fixed_encoding = (req "max_operation_data_length" int31) (req "max_proposals_per_delegate" uint8)) -let fixed = { - proof_of_work_nonce_size ; - nonce_length ; - max_revelations_per_block ; - max_operation_data_length ; - max_proposals_per_delegate ; -} +let fixed = + { + proof_of_work_nonce_size; + nonce_length; + max_revelations_per_block; + max_operation_data_length; + max_proposals_per_delegate; + } type parametric = { - preserved_cycles: int ; - blocks_per_cycle: int32 ; - blocks_per_commitment: int32 ; - blocks_per_roll_snapshot: int32 ; - blocks_per_voting_period: int32 ; - time_between_blocks: Period_repr.t list ; - endorsers_per_block: int ; - hard_gas_limit_per_operation: Z.t ; - hard_gas_limit_per_block: Z.t ; - proof_of_work_threshold: int64 ; - tokens_per_roll: Tez_repr.t ; - michelson_maximum_type_size: int; - seed_nonce_revelation_tip: Tez_repr.t ; - origination_size: int ; - block_security_deposit: Tez_repr.t ; - endorsement_security_deposit: Tez_repr.t ; - block_reward: Tez_repr.t ; - endorsement_reward: Tez_repr.t ; - cost_per_byte: Tez_repr.t ; - hard_storage_limit_per_operation: Z.t ; - test_chain_duration: int64 ; (* in seconds *) - quorum_min: int32 ; - quorum_max: int32 ; - min_proposal_quorum: int32 ; - initial_endorsers: int ; - delay_per_missing_endorsement: Period_repr.t ; + preserved_cycles : int; + blocks_per_cycle : int32; + blocks_per_commitment : int32; + blocks_per_roll_snapshot : int32; + blocks_per_voting_period : int32; + time_between_blocks : Period_repr.t list; + endorsers_per_block : int; + hard_gas_limit_per_operation : Z.t; + hard_gas_limit_per_block : Z.t; + proof_of_work_threshold : int64; + tokens_per_roll : Tez_repr.t; + michelson_maximum_type_size : int; + seed_nonce_revelation_tip : Tez_repr.t; + origination_size : int; + block_security_deposit : Tez_repr.t; + endorsement_security_deposit : Tez_repr.t; + baking_reward_per_endorsement : Tez_repr.t list; + endorsement_reward : Tez_repr.t list; + cost_per_byte : Tez_repr.t; + hard_storage_limit_per_operation : Z.t; + test_chain_duration : int64; + (* in seconds *) + quorum_min : int32; + quorum_max : int32; + min_proposal_quorum : int32; + initial_endorsers : int; + delay_per_missing_endorsement : Period_repr.t; } let parametric_encoding = let open Data_encoding in conv (fun c -> - (( c.preserved_cycles, + ( ( c.preserved_cycles, c.blocks_per_cycle, c.blocks_per_commitment, c.blocks_per_roll_snapshot, @@ -115,78 +124,78 @@ let parametric_encoding = c.time_between_blocks, c.endorsers_per_block, c.hard_gas_limit_per_operation, - c.hard_gas_limit_per_block), - ((c.proof_of_work_threshold, - c.tokens_per_roll, - c.michelson_maximum_type_size, - c.seed_nonce_revelation_tip, - c.origination_size, - c.block_security_deposit, - c.endorsement_security_deposit, - c.block_reward), - (c.endorsement_reward, - c.cost_per_byte, - c.hard_storage_limit_per_operation, - c.test_chain_duration, - c.quorum_min, - c.quorum_max, - c.min_proposal_quorum, - c.initial_endorsers, - c.delay_per_missing_endorsement - ))) ) - (fun (( preserved_cycles, - blocks_per_cycle, - blocks_per_commitment, - blocks_per_roll_snapshot, - blocks_per_voting_period, - time_between_blocks, - endorsers_per_block, - hard_gas_limit_per_operation, - hard_gas_limit_per_block), - ((proof_of_work_threshold, - tokens_per_roll, - michelson_maximum_type_size, - seed_nonce_revelation_tip, - origination_size, - block_security_deposit, - endorsement_security_deposit, - block_reward), - (endorsement_reward, - cost_per_byte, - hard_storage_limit_per_operation, - test_chain_duration, - quorum_min, - quorum_max, - min_proposal_quorum, - initial_endorsers, - delay_per_missing_endorsement))) -> - { preserved_cycles ; - blocks_per_cycle ; - blocks_per_commitment ; - blocks_per_roll_snapshot ; - blocks_per_voting_period ; - time_between_blocks ; - endorsers_per_block ; - hard_gas_limit_per_operation ; - hard_gas_limit_per_block ; - proof_of_work_threshold ; - tokens_per_roll ; - michelson_maximum_type_size ; - seed_nonce_revelation_tip ; - origination_size ; - block_security_deposit ; - endorsement_security_deposit ; - block_reward ; - endorsement_reward ; - cost_per_byte ; - hard_storage_limit_per_operation ; - test_chain_duration ; - quorum_min ; - quorum_max ; - min_proposal_quorum ; - initial_endorsers ; - delay_per_missing_endorsement ; - } ) + c.hard_gas_limit_per_block ), + ( ( c.proof_of_work_threshold, + c.tokens_per_roll, + c.michelson_maximum_type_size, + c.seed_nonce_revelation_tip, + c.origination_size, + c.block_security_deposit, + c.endorsement_security_deposit, + c.baking_reward_per_endorsement ), + ( c.endorsement_reward, + c.cost_per_byte, + c.hard_storage_limit_per_operation, + c.test_chain_duration, + c.quorum_min, + c.quorum_max, + c.min_proposal_quorum, + c.initial_endorsers, + c.delay_per_missing_endorsement ) ) )) + (fun ( ( preserved_cycles, + blocks_per_cycle, + blocks_per_commitment, + blocks_per_roll_snapshot, + blocks_per_voting_period, + time_between_blocks, + endorsers_per_block, + hard_gas_limit_per_operation, + hard_gas_limit_per_block ), + ( ( proof_of_work_threshold, + tokens_per_roll, + michelson_maximum_type_size, + seed_nonce_revelation_tip, + origination_size, + block_security_deposit, + endorsement_security_deposit, + baking_reward_per_endorsement ), + ( endorsement_reward, + cost_per_byte, + hard_storage_limit_per_operation, + test_chain_duration, + quorum_min, + quorum_max, + min_proposal_quorum, + initial_endorsers, + delay_per_missing_endorsement ) ) ) -> + { + preserved_cycles; + blocks_per_cycle; + blocks_per_commitment; + blocks_per_roll_snapshot; + blocks_per_voting_period; + time_between_blocks; + endorsers_per_block; + hard_gas_limit_per_operation; + hard_gas_limit_per_block; + proof_of_work_threshold; + tokens_per_roll; + michelson_maximum_type_size; + seed_nonce_revelation_tip; + origination_size; + block_security_deposit; + endorsement_security_deposit; + baking_reward_per_endorsement; + endorsement_reward; + cost_per_byte; + hard_storage_limit_per_operation; + test_chain_duration; + quorum_min; + quorum_max; + min_proposal_quorum; + initial_endorsers; + delay_per_missing_endorsement; + }) (merge_objs (obj9 (req "preserved_cycles" uint8) @@ -207,9 +216,9 @@ let parametric_encoding = (req "origination_size" int31) (req "block_security_deposit" Tez_repr.encoding) (req "endorsement_security_deposit" Tez_repr.encoding) - (req "block_reward" Tez_repr.encoding)) + (req "baking_reward_per_endorsement" (list Tez_repr.encoding))) (obj9 - (req "endorsement_reward" Tez_repr.encoding) + (req "endorsement_reward" (list Tez_repr.encoding)) (req "cost_per_byte" Tez_repr.encoding) (req "hard_storage_limit_per_operation" z) (req "test_chain_duration" int64) @@ -217,17 +226,161 @@ let parametric_encoding = (req "quorum_max" int32) (req "min_proposal_quorum" int32) (req "initial_endorsers" uint16) - (req "delay_per_missing_endorsement" Period_repr.encoding) - ))) + (req "delay_per_missing_endorsement" Period_repr.encoding)))) -type t = { - fixed : fixed ; - parametric : parametric ; -} +type t = {fixed : fixed; parametric : parametric} let encoding = let open Data_encoding in conv - (fun { fixed ; parametric } -> (fixed, parametric)) - (fun (fixed , parametric) -> { fixed ; parametric }) + (fun {fixed; parametric} -> (fixed, parametric)) + (fun (fixed, parametric) -> {fixed; parametric}) (merge_objs fixed_encoding parametric_encoding) + +module Proto_005 = struct + type parametric = { + preserved_cycles : int; + blocks_per_cycle : int32; + blocks_per_commitment : int32; + blocks_per_roll_snapshot : int32; + blocks_per_voting_period : int32; + time_between_blocks : Period_repr.t list; + endorsers_per_block : int; + hard_gas_limit_per_operation : Z.t; + hard_gas_limit_per_block : Z.t; + proof_of_work_threshold : int64; + tokens_per_roll : Tez_repr.t; + michelson_maximum_type_size : int; + seed_nonce_revelation_tip : Tez_repr.t; + origination_size : int; + block_security_deposit : Tez_repr.t; + endorsement_security_deposit : Tez_repr.t; + block_reward : Tez_repr.t; + endorsement_reward : Tez_repr.t; + cost_per_byte : Tez_repr.t; + hard_storage_limit_per_operation : Z.t; + test_chain_duration : int64; + (* in seconds *) + quorum_min : int32; + quorum_max : int32; + min_proposal_quorum : int32; + initial_endorsers : int; + delay_per_missing_endorsement : Period_repr.t; + } + + let parametric_encoding = + let open Data_encoding in + conv + (fun c -> + ( ( c.preserved_cycles, + c.blocks_per_cycle, + c.blocks_per_commitment, + c.blocks_per_roll_snapshot, + c.blocks_per_voting_period, + c.time_between_blocks, + c.endorsers_per_block, + c.hard_gas_limit_per_operation, + c.hard_gas_limit_per_block ), + ( ( c.proof_of_work_threshold, + c.tokens_per_roll, + c.michelson_maximum_type_size, + c.seed_nonce_revelation_tip, + c.origination_size, + c.block_security_deposit, + c.endorsement_security_deposit, + c.block_reward ), + ( c.endorsement_reward, + c.cost_per_byte, + c.hard_storage_limit_per_operation, + c.test_chain_duration, + c.quorum_min, + c.quorum_max, + c.min_proposal_quorum, + c.initial_endorsers, + c.delay_per_missing_endorsement ) ) )) + (fun ( ( preserved_cycles, + blocks_per_cycle, + blocks_per_commitment, + blocks_per_roll_snapshot, + blocks_per_voting_period, + time_between_blocks, + endorsers_per_block, + hard_gas_limit_per_operation, + hard_gas_limit_per_block ), + ( ( proof_of_work_threshold, + tokens_per_roll, + michelson_maximum_type_size, + seed_nonce_revelation_tip, + origination_size, + block_security_deposit, + endorsement_security_deposit, + block_reward ), + ( endorsement_reward, + cost_per_byte, + hard_storage_limit_per_operation, + test_chain_duration, + quorum_min, + quorum_max, + min_proposal_quorum, + initial_endorsers, + delay_per_missing_endorsement ) ) ) -> + { + preserved_cycles; + blocks_per_cycle; + blocks_per_commitment; + blocks_per_roll_snapshot; + blocks_per_voting_period; + time_between_blocks; + endorsers_per_block; + hard_gas_limit_per_operation; + hard_gas_limit_per_block; + proof_of_work_threshold; + tokens_per_roll; + michelson_maximum_type_size; + seed_nonce_revelation_tip; + origination_size; + block_security_deposit; + endorsement_security_deposit; + block_reward; + endorsement_reward; + cost_per_byte; + hard_storage_limit_per_operation; + test_chain_duration; + quorum_min; + quorum_max; + min_proposal_quorum; + initial_endorsers; + delay_per_missing_endorsement; + }) + (merge_objs + (obj9 + (req "preserved_cycles" uint8) + (req "blocks_per_cycle" int32) + (req "blocks_per_commitment" int32) + (req "blocks_per_roll_snapshot" int32) + (req "blocks_per_voting_period" int32) + (req "time_between_blocks" (list Period_repr.encoding)) + (req "endorsers_per_block" uint16) + (req "hard_gas_limit_per_operation" z) + (req "hard_gas_limit_per_block" z)) + (merge_objs + (obj8 + (req "proof_of_work_threshold" int64) + (req "tokens_per_roll" Tez_repr.encoding) + (req "michelson_maximum_type_size" uint16) + (req "seed_nonce_revelation_tip" Tez_repr.encoding) + (req "origination_size" int31) + (req "block_security_deposit" Tez_repr.encoding) + (req "endorsement_security_deposit" Tez_repr.encoding) + (req "block_reward" Tez_repr.encoding)) + (obj9 + (req "endorsement_reward" Tez_repr.encoding) + (req "cost_per_byte" Tez_repr.encoding) + (req "hard_storage_limit_per_operation" z) + (req "test_chain_duration" int64) + (req "quorum_min" int32) + (req "quorum_max" int32) + (req "min_proposal_quorum" int32) + (req "initial_endorsers" uint16) + (req "delay_per_missing_endorsement" Period_repr.encoding)))) +end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/constants_services.ml b/vendors/ligo-utils/tezos-protocol-alpha/constants_services.ml index 8e07c7a87..f2b92f91c 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/constants_services.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/constants_services.ml @@ -26,40 +26,35 @@ open Alpha_context let custom_root = - (RPC_path.(open_root / "context" / "constants") : RPC_context.t RPC_path.context) + ( RPC_path.(open_root / "context" / "constants") + : RPC_context.t RPC_path.context ) module S = struct - open Data_encoding let errors = RPC_service.get_service - ~description: "Schema for all the RPC errors from this protocol version" - ~query: RPC_query.empty - ~output: json_schema + ~description:"Schema for all the RPC errors from this protocol version" + ~query:RPC_query.empty + ~output:json_schema RPC_path.(custom_root / "errors") let all = RPC_service.get_service - ~description: "All constants" - ~query: RPC_query.empty - ~output: Alpha_context.Constants.encoding + ~description:"All constants" + ~query:RPC_query.empty + ~output:Alpha_context.Constants.encoding custom_root - end let register () = let open Services_registration in - register0_noctxt S.errors begin fun () () -> - return (Data_encoding.Json.(schema error_encoding)) - end ; - register0 S.all begin fun ctxt () () -> - let open Constants in - return { fixed = fixed ; - parametric = parametric ctxt } - end + register0_noctxt S.errors (fun () () -> + return Data_encoding.Json.(schema error_encoding)) ; + register0 S.all (fun ctxt () () -> + let open Constants in + return {fixed; parametric = parametric ctxt}) -let errors ctxt block = - RPC_context.make_call0 S.errors ctxt block () () -let all ctxt block = - RPC_context.make_call0 S.all ctxt block () () +let errors ctxt block = RPC_context.make_call0 S.errors ctxt block () () + +let all ctxt block = RPC_context.make_call0 S.all ctxt block () () diff --git a/vendors/ligo-utils/tezos-protocol-alpha/constants_services.mli b/vendors/ligo-utils/tezos-protocol-alpha/constants_services.mli index 5234cd843..243adcb1d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/constants_services.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/constants_services.mli @@ -25,11 +25,12 @@ open Alpha_context -val errors: - 'a #RPC_context.simple -> 'a -> Data_encoding.json_schema shell_tzresult Lwt.t +val errors : + 'a #RPC_context.simple -> + 'a -> + Data_encoding.json_schema shell_tzresult Lwt.t (** Returns all the constants of the protocol *) -val all: - 'a #RPC_context.simple -> 'a -> Constants.t shell_tzresult Lwt.t +val all : 'a #RPC_context.simple -> 'a -> Constants.t shell_tzresult Lwt.t -val register: unit -> unit +val register : unit -> unit diff --git a/vendors/ligo-utils/tezos-protocol-alpha/constants_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/constants_storage.ml index c6b1dfd2a..65a1cc81d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/constants_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/constants_storage.ml @@ -26,80 +26,105 @@ let preserved_cycles c = let constants = Raw_context.constants c in constants.preserved_cycles + let blocks_per_cycle c = let constants = Raw_context.constants c in constants.blocks_per_cycle + let blocks_per_commitment c = let constants = Raw_context.constants c in constants.blocks_per_commitment + let blocks_per_roll_snapshot c = let constants = Raw_context.constants c in constants.blocks_per_roll_snapshot + let blocks_per_voting_period c = let constants = Raw_context.constants c in constants.blocks_per_voting_period + let time_between_blocks c = let constants = Raw_context.constants c in constants.time_between_blocks + let endorsers_per_block c = let constants = Raw_context.constants c in constants.endorsers_per_block + let initial_endorsers c = let constants = Raw_context.constants c in constants.initial_endorsers + let delay_per_missing_endorsement c = let constants = Raw_context.constants c in constants.delay_per_missing_endorsement + let hard_gas_limit_per_operation c = let constants = Raw_context.constants c in constants.hard_gas_limit_per_operation + let hard_gas_limit_per_block c = let constants = Raw_context.constants c in constants.hard_gas_limit_per_block + let cost_per_byte c = let constants = Raw_context.constants c in constants.cost_per_byte + let hard_storage_limit_per_operation c = let constants = Raw_context.constants c in constants.hard_storage_limit_per_operation + let proof_of_work_threshold c = let constants = Raw_context.constants c in constants.proof_of_work_threshold + let tokens_per_roll c = let constants = Raw_context.constants c in constants.tokens_per_roll + let michelson_maximum_type_size c = let constants = Raw_context.constants c in constants.michelson_maximum_type_size + let seed_nonce_revelation_tip c = let constants = Raw_context.constants c in constants.seed_nonce_revelation_tip + let origination_size c = let constants = Raw_context.constants c in constants.origination_size + let block_security_deposit c = let constants = Raw_context.constants c in constants.block_security_deposit + let endorsement_security_deposit c = let constants = Raw_context.constants c in constants.endorsement_security_deposit -let block_reward c = + +let baking_reward_per_endorsement c = let constants = Raw_context.constants c in - constants.block_reward + constants.baking_reward_per_endorsement + let endorsement_reward c = let constants = Raw_context.constants c in constants.endorsement_reward + let test_chain_duration c = let constants = Raw_context.constants c in constants.test_chain_duration + let quorum_min c = let constants = Raw_context.constants c in constants.quorum_min + let quorum_max c = let constants = Raw_context.constants c in constants.quorum_max + let min_proposal_quorum c = let constants = Raw_context.constants c in constants.min_proposal_quorum -let parametric c = - Raw_context.constants c + +let parametric c = Raw_context.constants c diff --git a/vendors/ligo-utils/tezos-protocol-alpha/contract_hash.ml b/vendors/ligo-utils/tezos-protocol-alpha/contract_hash.ml index 74b2bbf54..40d94808d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/contract_hash.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/contract_hash.ml @@ -26,12 +26,16 @@ (* 20 *) let contract_hash = "\002\090\121" (* KT1(36) *) -include Blake2B.Make(Base58)(struct - let name = "Contract_hash" - let title = "A contract ID" - let b58check_prefix = contract_hash - let size = Some 20 - end) +include Blake2B.Make + (Base58) + (struct + let name = "Contract_hash" -let () = - Base58.check_encoded_prefix b58check_encoding "KT1" 36 + let title = "A contract ID" + + let b58check_prefix = contract_hash + + let size = Some 20 + end) + +let () = Base58.check_encoded_prefix b58check_encoding "KT1" 36 diff --git a/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.ml index 89632c77a..f286a1bae 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.ml @@ -27,80 +27,98 @@ type t = | Implicit of Signature.Public_key_hash.t | Originated of Contract_hash.t -include Compare.Make(struct - type nonrec t = t - let compare l1 l2 = - match l1, l2 with - | Implicit pkh1, Implicit pkh2 -> - Signature.Public_key_hash.compare pkh1 pkh2 - | Originated h1, Originated h2 -> - Contract_hash.compare h1 h2 - | Implicit _, Originated _ -> -1 - | Originated _, Implicit _ -> 1 - end) +include Compare.Make (struct + type nonrec t = t + + let compare l1 l2 = + match (l1, l2) with + | (Implicit pkh1, Implicit pkh2) -> + Signature.Public_key_hash.compare pkh1 pkh2 + | (Originated h1, Originated h2) -> + Contract_hash.compare h1 h2 + | (Implicit _, Originated _) -> + -1 + | (Originated _, Implicit _) -> + 1 +end) type contract = t type error += Invalid_contract_notation of string (* `Permanent *) let to_b58check = function - | Implicit pbk -> Signature.Public_key_hash.to_b58check pbk - | Originated h -> Contract_hash.to_b58check h + | Implicit pbk -> + Signature.Public_key_hash.to_b58check pbk + | Originated h -> + Contract_hash.to_b58check h let of_b58check s = match Base58.decode s with - | Some (Ed25519.Public_key_hash.Data h) -> ok (Implicit (Signature.Ed25519 h)) - | Some (Secp256k1.Public_key_hash.Data h) -> ok (Implicit (Signature.Secp256k1 h)) - | Some (P256.Public_key_hash.Data h) -> ok (Implicit (Signature.P256 h)) - | Some (Contract_hash.Data h) -> ok (Originated h) - | _ -> error (Invalid_contract_notation s) + | Some (Ed25519.Public_key_hash.Data h) -> + ok (Implicit (Signature.Ed25519 h)) + | Some (Secp256k1.Public_key_hash.Data h) -> + ok (Implicit (Signature.Secp256k1 h)) + | Some (P256.Public_key_hash.Data h) -> + ok (Implicit (Signature.P256 h)) + | Some (Contract_hash.Data h) -> + ok (Originated h) + | _ -> + error (Invalid_contract_notation s) let pp ppf = function - | Implicit pbk -> Signature.Public_key_hash.pp ppf pbk - | Originated h -> Contract_hash.pp ppf h + | Implicit pbk -> + Signature.Public_key_hash.pp ppf pbk + | Originated h -> + Contract_hash.pp ppf h let pp_short ppf = function - | Implicit pbk -> Signature.Public_key_hash.pp_short ppf pbk - | Originated h -> Contract_hash.pp_short ppf h + | Implicit pbk -> + Signature.Public_key_hash.pp_short ppf pbk + | Originated h -> + Contract_hash.pp_short ppf h let encoding = let open Data_encoding in - def "contract_id" - ~title: - "A contract handle" + def + "contract_id" + ~title:"A contract handle" ~description: - "A contract notation as given to an RPC or inside scripts. \ - Can be a base58 implicit contract hash \ - or a base58 originated contract hash." @@ - splitted - ~binary: - (union ~tag_size:`Uint8 [ - case (Tag 0) - ~title:"Implicit" - Signature.Public_key_hash.encoding - (function Implicit k -> Some k | _ -> None) - (fun k -> Implicit k) ; - case (Tag 1) (Fixed.add_padding Contract_hash.encoding 1) - ~title:"Originated" - (function Originated k -> Some k | _ -> None) - (fun k -> Originated k) ; - ]) - ~json: - (conv - to_b58check - (fun s -> - match of_b58check s with - | Ok s -> s - | Error _ -> Json.cannot_destruct "Invalid contract notation.") - string) + "A contract notation as given to an RPC or inside scripts. Can be a \ + base58 implicit contract hash or a base58 originated contract hash." + @@ splitted + ~binary: + (union + ~tag_size:`Uint8 + [ case + (Tag 0) + ~title:"Implicit" + Signature.Public_key_hash.encoding + (function Implicit k -> Some k | _ -> None) + (fun k -> Implicit k); + case + (Tag 1) + (Fixed.add_padding Contract_hash.encoding 1) + ~title:"Originated" + (function Originated k -> Some k | _ -> None) + (fun k -> Originated k) ]) + ~json: + (conv + to_b58check + (fun s -> + match of_b58check s with + | Ok s -> + s + | Error _ -> + Json.cannot_destruct "Invalid contract notation.") + string) let () = let open Data_encoding in register_error_kind `Permanent ~id:"contract.invalid_contract_notation" - ~title: "Invalid contract notation" - ~pp: (fun ppf x -> Format.fprintf ppf "Invalid contract notation %S" x) + ~title:"Invalid contract notation" + ~pp:(fun ppf x -> Format.fprintf ppf "Invalid contract notation %S" x) ~description: "A malformed contract notation was given to an RPC or in a script." (obj1 (req "notation" string)) @@ -109,106 +127,104 @@ let () = let implicit_contract id = Implicit id -let originated_contract_004 id = Originated id +let is_implicit = function Implicit m -> Some m | Originated _ -> None -let is_implicit = function - | Implicit m -> Some m - | Originated _ -> None +let is_originated = function Implicit _ -> None | Originated h -> Some h -let is_originated = function - | Implicit _ -> None - | Originated h -> Some h - -type origination_nonce = - { operation_hash: Operation_hash.t ; - origination_index: int32 } +type origination_nonce = { + operation_hash : Operation_hash.t; + origination_index : int32; +} let origination_nonce_encoding = let open Data_encoding in conv - (fun { operation_hash ; origination_index } -> - (operation_hash, origination_index)) + (fun {operation_hash; origination_index} -> + (operation_hash, origination_index)) (fun (operation_hash, origination_index) -> - { operation_hash ; origination_index }) @@ - obj2 - (req "operation" Operation_hash.encoding) - (dft "index" int32 0l) + {operation_hash; origination_index}) + @@ obj2 (req "operation" Operation_hash.encoding) (dft "index" int32 0l) let originated_contract nonce = let data = - Data_encoding.Binary.to_bytes_exn origination_nonce_encoding nonce in + Data_encoding.Binary.to_bytes_exn origination_nonce_encoding nonce + in Originated (Contract_hash.hash_bytes [data]) let originated_contracts - ~since: { origination_index = first ; operation_hash = first_hash } - ~until: ({ origination_index = last ; operation_hash = last_hash } as origination_nonce) = + ~since:{origination_index = first; operation_hash = first_hash} + ~until:( {origination_index = last; operation_hash = last_hash} as + origination_nonce ) = assert (Operation_hash.equal first_hash last_hash) ; let rec contracts acc origination_index = - if Compare.Int32.(origination_index < first) then - acc + if Compare.Int32.(origination_index < first) then acc else - let origination_nonce = - { origination_nonce with origination_index } in + let origination_nonce = {origination_nonce with origination_index} in let acc = originated_contract origination_nonce :: acc in - contracts acc (Int32.pred origination_index) in + contracts acc (Int32.pred origination_index) + in contracts [] (Int32.pred last) let initial_origination_nonce operation_hash = - { operation_hash ; origination_index = 0l } + {operation_hash; origination_index = 0l} let incr_origination_nonce nonce = let origination_index = Int32.succ nonce.origination_index in - { nonce with origination_index } + {nonce with origination_index} let rpc_arg = let construct = to_b58check in let destruct hash = match of_b58check hash with - | Error _ -> Error "Cannot parse contract id" - | Ok contract -> Ok contract in + | Error _ -> + Error "Cannot parse contract id" + | Ok contract -> + Ok contract + in RPC_arg.make - ~descr: "A contract identifier encoded in b58check." - ~name: "contract_id" + ~descr:"A contract identifier encoded in b58check." + ~name:"contract_id" ~construct ~destruct () module Index = struct - type t = contract let path_length = 7 let to_path c l = let raw_key = Data_encoding.Binary.to_bytes_exn encoding c in - let `Hex key = MBytes.to_hex raw_key in - let `Hex index_key = MBytes.to_hex (Raw_hashes.blake2b raw_key) in - String.sub index_key 0 2 :: - String.sub index_key 2 2 :: - String.sub index_key 4 2 :: - String.sub index_key 6 2 :: - String.sub index_key 8 2 :: - String.sub index_key 10 2 :: - key :: - l + let (`Hex key) = MBytes.to_hex raw_key in + let (`Hex index_key) = MBytes.to_hex (Raw_hashes.blake2b raw_key) in + String.sub index_key 0 2 :: String.sub index_key 2 2 + :: String.sub index_key 4 2 :: String.sub index_key 6 2 + :: String.sub index_key 8 2 :: String.sub index_key 10 2 :: key :: l let of_path = function - | [] | [_] | [_;_] | [_;_;_] | [_;_;_;_] | [_;_;_;_;_] | [_;_;_;_;_;_] - | _::_::_::_::_::_::_::_::_ -> + | [] + | [_] + | [_; _] + | [_; _; _] + | [_; _; _; _] + | [_; _; _; _; _] + | [_; _; _; _; _; _] + | _ :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: _ -> None - | [ index1 ; index2 ; index3 ; index4 ; index5 ; index6 ; key ] -> + | [index1; index2; index3; index4; index5; index6; key] -> let raw_key = MBytes.of_hex (`Hex key) in - let `Hex index_key = MBytes.to_hex (Raw_hashes.blake2b raw_key) in - assert Compare.String.(String.sub index_key 0 2 = index1) ; - assert Compare.String.(String.sub index_key 2 2 = index2) ; - assert Compare.String.(String.sub index_key 4 2 = index3) ; - assert Compare.String.(String.sub index_key 6 2 = index4) ; - assert Compare.String.(String.sub index_key 8 2 = index5) ; - assert Compare.String.(String.sub index_key 10 2 = index6) ; + let (`Hex index_key) = MBytes.to_hex (Raw_hashes.blake2b raw_key) in + assert (Compare.String.(String.sub index_key 0 2 = index1)) ; + assert (Compare.String.(String.sub index_key 2 2 = index2)) ; + assert (Compare.String.(String.sub index_key 4 2 = index3)) ; + assert (Compare.String.(String.sub index_key 6 2 = index4)) ; + assert (Compare.String.(String.sub index_key 8 2 = index5)) ; + assert (Compare.String.(String.sub index_key 10 2 = index6)) ; Data_encoding.Binary.of_bytes encoding raw_key let rpc_arg = rpc_arg - let encoding = encoding - let compare = compare + let encoding = encoding + + let compare = compare end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.mli index 37f5503f6..53935e460 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/contract_repr.mli @@ -26,6 +26,7 @@ type t = private | Implicit of Signature.Public_key_hash.t | Originated of Contract_hash.t + type contract = t include Compare.S with type t := contract @@ -34,9 +35,6 @@ include Compare.S with type t := contract val implicit_contract : Signature.Public_key_hash.t -> contract -(** Only for migration from proto_004 *) -val originated_contract_004 : Contract_hash.t -> contract - val is_implicit : contract -> Signature.Public_key_hash.t option (** {2 Originated contracts} *) @@ -50,7 +48,8 @@ type origination_nonce val originated_contract : origination_nonce -> contract -val originated_contracts : since: origination_nonce -> until: origination_nonce -> contract list +val originated_contracts : + since:origination_nonce -> until:origination_nonce -> contract list val initial_origination_nonce : Operation_hash.t -> origination_nonce @@ -58,18 +57,17 @@ val incr_origination_nonce : origination_nonce -> origination_nonce val is_originated : contract -> Contract_hash.t option - (** {2 Human readable notation} *) type error += Invalid_contract_notation of string (* `Permanent *) -val to_b58check: contract -> string +val to_b58check : contract -> string -val of_b58check: string -> contract tzresult +val of_b58check : string -> contract tzresult -val pp: Format.formatter -> contract -> unit +val pp : Format.formatter -> contract -> unit -val pp_short: Format.formatter -> contract -> unit +val pp_short : Format.formatter -> contract -> unit (** {2 Serializers} *) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/contract_services.ml b/vendors/ligo-utils/tezos-protocol-alpha/contract_services.ml index 5d57e0174..b350c9089 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/contract_services.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/contract_services.ml @@ -26,282 +26,349 @@ open Alpha_context let custom_root = - (RPC_path.(open_root / "context" / "contracts") : RPC_context.t RPC_path.context) + ( RPC_path.(open_root / "context" / "contracts") + : RPC_context.t RPC_path.context ) let big_map_root = - (RPC_path.(open_root / "context" / "big_maps") : RPC_context.t RPC_path.context) + ( RPC_path.(open_root / "context" / "big_maps") + : RPC_context.t RPC_path.context ) type info = { - balance: Tez.t ; - delegate: public_key_hash option ; - counter: counter option ; - script: Script.t option ; + balance : Tez.t; + delegate : public_key_hash option; + counter : counter option; + script : Script.t option; } let info_encoding = let open Data_encoding in conv - (fun {balance ; delegate ; script ; counter } -> + (fun {balance; delegate; script; counter} -> (balance, delegate, script, counter)) (fun (balance, delegate, script, counter) -> - {balance ; delegate ; script ; counter}) @@ - obj4 - (req "balance" Tez.encoding) - (opt "delegate" Signature.Public_key_hash.encoding) - (opt "script" Script.encoding) - (opt "counter" n) + {balance; delegate; script; counter}) + @@ obj4 + (req "balance" Tez.encoding) + (opt "delegate" Signature.Public_key_hash.encoding) + (opt "script" Script.encoding) + (opt "counter" n) module S = struct - open Data_encoding let balance = RPC_service.get_service - ~description: "Access the balance of a contract." - ~query: RPC_query.empty - ~output: Tez.encoding + ~description:"Access the balance of a contract." + ~query:RPC_query.empty + ~output:Tez.encoding RPC_path.(custom_root /: Contract.rpc_arg / "balance") let manager_key = RPC_service.get_service - ~description: "Access the manager of a contract." - ~query: RPC_query.empty - ~output: (option Signature.Public_key.encoding) + ~description:"Access the manager of a contract." + ~query:RPC_query.empty + ~output:(option Signature.Public_key.encoding) RPC_path.(custom_root /: Contract.rpc_arg / "manager_key") let delegate = RPC_service.get_service - ~description: "Access the delegate of a contract, if any." - ~query: RPC_query.empty - ~output: Signature.Public_key_hash.encoding + ~description:"Access the delegate of a contract, if any." + ~query:RPC_query.empty + ~output:Signature.Public_key_hash.encoding RPC_path.(custom_root /: Contract.rpc_arg / "delegate") let counter = RPC_service.get_service - ~description: "Access the counter of a contract, if any." - ~query: RPC_query.empty - ~output: z + ~description:"Access the counter of a contract, if any." + ~query:RPC_query.empty + ~output:z RPC_path.(custom_root /: Contract.rpc_arg / "counter") let script = RPC_service.get_service - ~description: "Access the code and data of the contract." - ~query: RPC_query.empty - ~output: Script.encoding + ~description:"Access the code and data of the contract." + ~query:RPC_query.empty + ~output:Script.encoding RPC_path.(custom_root /: Contract.rpc_arg / "script") let storage = RPC_service.get_service - ~description: "Access the data of the contract." - ~query: RPC_query.empty - ~output: Script.expr_encoding + ~description:"Access the data of the contract." + ~query:RPC_query.empty + ~output:Script.expr_encoding RPC_path.(custom_root /: Contract.rpc_arg / "storage") let entrypoint_type = RPC_service.get_service - ~description: "Return the type of the given entrypoint of the contract" - ~query: RPC_query.empty - ~output: Script.expr_encoding - RPC_path.(custom_root /: Contract.rpc_arg / "entrypoints" /: RPC_arg.string) - + ~description:"Return the type of the given entrypoint of the contract" + ~query:RPC_query.empty + ~output:Script.expr_encoding + RPC_path.( + custom_root /: Contract.rpc_arg / "entrypoints" /: RPC_arg.string) let list_entrypoints = RPC_service.get_service - ~description: "Return the list of entrypoints of the contract" - ~query: RPC_query.empty - ~output: (obj2 - (dft "unreachable" - (Data_encoding.list - (obj1 (req "path" (Data_encoding.list Michelson_v1_primitives.prim_encoding)))) - []) - (req "entrypoints" - (assoc Script.expr_encoding))) + ~description:"Return the list of entrypoints of the contract" + ~query:RPC_query.empty + ~output: + (obj2 + (dft + "unreachable" + (Data_encoding.list + (obj1 + (req + "path" + (Data_encoding.list + Michelson_v1_primitives.prim_encoding)))) + []) + (req "entrypoints" (assoc Script.expr_encoding))) RPC_path.(custom_root /: Contract.rpc_arg / "entrypoints") let contract_big_map_get_opt = - RPC_service.post_service - ~description: "Access the value associated with a key in a big map of the contract (deprecated)." - ~query: RPC_query.empty - ~input: (obj2 - (req "key" Script.expr_encoding) - (req "type" Script.expr_encoding)) - ~output: (option Script.expr_encoding) - RPC_path.(custom_root /: Contract.rpc_arg / "big_map_get") + RPC_service.post_service + ~description: + "Access the value associated with a key in a big map of the contract \ + (deprecated)." + ~query:RPC_query.empty + ~input: + (obj2 + (req "key" Script.expr_encoding) + (req "type" Script.expr_encoding)) + ~output:(option Script.expr_encoding) + RPC_path.(custom_root /: Contract.rpc_arg / "big_map_get") let big_map_get = RPC_service.get_service - ~description: "Access the value associated with a key in a big map." - ~query: RPC_query.empty - ~output: Script.expr_encoding + ~description:"Access the value associated with a key in a big map." + ~query:RPC_query.empty + ~output:Script.expr_encoding RPC_path.(big_map_root /: Big_map.rpc_arg /: Script_expr_hash.rpc_arg) let info = RPC_service.get_service - ~description: "Access the complete status of a contract." - ~query: RPC_query.empty - ~output: info_encoding + ~description:"Access the complete status of a contract." + ~query:RPC_query.empty + ~output:info_encoding RPC_path.(custom_root /: Contract.rpc_arg) let list = RPC_service.get_service ~description: "All existing contracts (including non-empty default contracts)." - ~query: RPC_query.empty - ~output: (list Contract.encoding) + ~query:RPC_query.empty + ~output:(list Contract.encoding) custom_root - end let register () = let open Services_registration in - register0 S.list begin fun ctxt () () -> - Contract.list ctxt >>= return - end ; + register0 S.list (fun ctxt () () -> Contract.list ctxt >>= return) ; let register_field s f = register1 s (fun ctxt contract () () -> - Contract.exists ctxt contract >>=? function - | true -> f ctxt contract - | false -> raise Not_found) in + Contract.exists ctxt contract + >>=? function true -> f ctxt contract | false -> raise Not_found) + in let register_opt_field s f = - register_field s - (fun ctxt a1 -> - f ctxt a1 >>=? function - | None -> raise Not_found - | Some v -> return v) in + register_field s (fun ctxt a1 -> + f ctxt a1 >>=? function None -> raise Not_found | Some v -> return v) + in let do_big_map_get ctxt id key = let open Script_ir_translator in let ctxt = Gas.set_unlimited ctxt in - Big_map.exists ctxt id >>=? fun (ctxt, types) -> + Big_map.exists ctxt id + >>=? fun (ctxt, types) -> match types with - | None -> raise Not_found - | Some (_, value_type) -> - Lwt.return (parse_ty ctxt - ~legacy:true ~allow_big_map:false ~allow_operation:false ~allow_contract:true - (Micheline.root value_type)) + | None -> + raise Not_found + | Some (_, value_type) -> ( + Lwt.return + (parse_ty + ctxt + ~legacy:true + ~allow_big_map:false + ~allow_operation:false + ~allow_contract:true + (Micheline.root value_type)) >>=? fun (Ex_ty value_type, ctxt) -> - Big_map.get_opt ctxt id key >>=? fun (_ctxt, value) -> + Big_map.get_opt ctxt id key + >>=? fun (_ctxt, value) -> match value with - | None -> raise Not_found + | None -> + raise Not_found | Some value -> - parse_data ctxt ~legacy:true value_type (Micheline.root value) >>=? fun (value, ctxt) -> - unparse_data ctxt Readable value_type value >>=? fun (value, _ctxt) -> - return (Micheline.strip_locations value) in + parse_data ctxt ~legacy:true value_type (Micheline.root value) + >>=? fun (value, ctxt) -> + unparse_data ctxt Readable value_type value + >>=? fun (value, _ctxt) -> return (Micheline.strip_locations value) + ) + in register_field S.balance Contract.get_balance ; - register1 S.manager_key - (fun ctxt contract () () -> - match Contract.is_implicit contract with - | None -> raise Not_found - | Some mgr -> - Contract.is_manager_key_revealed ctxt mgr >>=? function - | false -> return_none - | true -> Contract.get_manager_key ctxt mgr >>=? return_some) ; + register1 S.manager_key (fun ctxt contract () () -> + match Contract.is_implicit contract with + | None -> + raise Not_found + | Some mgr -> ( + Contract.is_manager_key_revealed ctxt mgr + >>=? function + | false -> + return_none + | true -> + Contract.get_manager_key ctxt mgr >>=? return_some )) ; register_opt_field S.delegate Delegate.get ; - register1 S.counter - (fun ctxt contract () () -> - match Contract.is_implicit contract with - | None -> raise Not_found - | Some mgr -> Contract.get_counter ctxt mgr) ; - register_opt_field S.script - (fun c v -> Contract.get_script c v >>=? fun (_, v) -> return v) ; + register1 S.counter (fun ctxt contract () () -> + match Contract.is_implicit contract with + | None -> + raise Not_found + | Some mgr -> + Contract.get_counter ctxt mgr) ; + register_opt_field S.script (fun c v -> + Contract.get_script c v >>=? fun (_, v) -> return v) ; register_opt_field S.storage (fun ctxt contract -> - Contract.get_script ctxt contract >>=? fun (ctxt, script) -> + Contract.get_script ctxt contract + >>=? fun (ctxt, script) -> match script with - | None -> return_none + | None -> + return_none | Some script -> let ctxt = Gas.set_unlimited ctxt in let open Script_ir_translator in - parse_script ctxt ~legacy:true script >>=? fun (Ex_script script, ctxt) -> - unparse_script ctxt Readable script >>=? fun (script, ctxt) -> - Script.force_decode ctxt script.storage >>=? fun (storage, _ctxt) -> - return_some storage) ; - register2 S.entrypoint_type - (fun ctxt v entrypoint () () -> Contract.get_script_code ctxt v >>=? fun (_, expr) -> + parse_script ctxt ~legacy:true script + >>=? fun (Ex_script script, ctxt) -> + unparse_script ctxt Readable script + >>=? fun (script, ctxt) -> + Script.force_decode ctxt script.storage + >>=? fun (storage, _ctxt) -> return_some storage) ; + register2 S.entrypoint_type (fun ctxt v entrypoint () () -> + Contract.get_script_code ctxt v + >>=? fun (_, expr) -> match expr with - | None -> raise Not_found - | Some expr -> + | None -> + raise Not_found + | Some expr -> ( let ctxt = Gas.set_unlimited ctxt in let legacy = true in let open Script_ir_translator in - Script.force_decode ctxt expr >>=? fun (expr, _) -> + Script.force_decode ctxt expr + >>=? fun (expr, _) -> Lwt.return - begin - parse_toplevel ~legacy expr >>? fun (arg_type, _, _, root_name) -> - parse_ty ctxt ~legacy - ~allow_big_map:true ~allow_operation:false - ~allow_contract:true arg_type >>? fun (Ex_ty arg_type, _) -> - Script_ir_translator.find_entrypoint ~root_name arg_type - entrypoint - end >>= function - Ok (_f , Ex_ty ty)-> - unparse_ty ctxt ty >>=? fun (ty_node, _) -> + ( parse_toplevel ~legacy expr + >>? fun (arg_type, _, _, root_name) -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:true + arg_type + >>? fun (Ex_ty arg_type, _) -> + Script_ir_translator.find_entrypoint ~root_name arg_type entrypoint + ) + >>= function + | Ok (_f, Ex_ty ty) -> + unparse_ty ctxt ty + >>=? fun (ty_node, _) -> return (Micheline.strip_locations ty_node) - | Error _ -> raise Not_found) ; - register1 S.list_entrypoints - (fun ctxt v () () -> Contract.get_script_code ctxt v >>=? fun (_, expr) -> + | Error _ -> + raise Not_found )) ; + register1 S.list_entrypoints (fun ctxt v () () -> + Contract.get_script_code ctxt v + >>=? fun (_, expr) -> match expr with - | None -> raise Not_found + | None -> + raise Not_found | Some expr -> let ctxt = Gas.set_unlimited ctxt in let legacy = true in let open Script_ir_translator in - Script.force_decode ctxt expr >>=? fun (expr, _) -> + Script.force_decode ctxt expr + >>=? fun (expr, _) -> Lwt.return - begin - parse_toplevel ~legacy expr >>? fun (arg_type, _, _, root_name) -> - parse_ty ctxt ~legacy - ~allow_big_map:true ~allow_operation:false - ~allow_contract:true arg_type >>? fun (Ex_ty arg_type, _) -> - Script_ir_translator.list_entrypoints ~root_name arg_type ctxt - end >>=? fun (unreachable_entrypoint,map) -> + ( parse_toplevel ~legacy expr + >>? fun (arg_type, _, _, root_name) -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:true + arg_type + >>? fun (Ex_ty arg_type, _) -> + Script_ir_translator.list_entrypoints ~root_name arg_type ctxt ) + >>=? fun (unreachable_entrypoint, map) -> return - (unreachable_entrypoint, - Entrypoints_map.fold - begin fun entry (_,ty) acc -> - (entry , Micheline.strip_locations ty) ::acc end - map []) - ) ; + ( unreachable_entrypoint, + Entrypoints_map.fold + (fun entry (_, ty) acc -> + (entry, Micheline.strip_locations ty) :: acc) + map + [] )) ; register1 S.contract_big_map_get_opt (fun ctxt contract () (key, key_type) -> - Contract.get_script ctxt contract >>=? fun (ctxt, script) -> - Lwt.return (Script_ir_translator.parse_packable_ty ctxt ~legacy:true (Micheline.root key_type)) >>=? fun (Ex_ty key_type, ctxt) -> - Script_ir_translator.parse_data ctxt ~legacy:true key_type (Micheline.root key) >>=? fun (key, ctxt) -> - Script_ir_translator.hash_data ctxt key_type key >>=? fun (key, ctxt) -> + Contract.get_script ctxt contract + >>=? fun (ctxt, script) -> + Lwt.return + (Script_ir_translator.parse_packable_ty + ctxt + ~legacy:true + (Micheline.root key_type)) + >>=? fun (Ex_ty key_type, ctxt) -> + Script_ir_translator.parse_data + ctxt + ~legacy:true + key_type + (Micheline.root key) + >>=? fun (key, ctxt) -> + Script_ir_translator.hash_data ctxt key_type key + >>=? fun (key, ctxt) -> match script with - | None -> raise Not_found + | None -> + raise Not_found | Some script -> let ctxt = Gas.set_unlimited ctxt in let open Script_ir_translator in - parse_script ctxt ~legacy:true script >>=? fun (Ex_script script, ctxt) -> - Script_ir_translator.collect_big_maps ctxt script.storage_type script.storage >>=? fun (ids, _ctxt) -> + parse_script ctxt ~legacy:true script + >>=? fun (Ex_script script, ctxt) -> + Script_ir_translator.collect_big_maps + ctxt + script.storage_type + script.storage + >>=? fun (ids, _ctxt) -> let ids = Script_ir_translator.list_of_big_map_ids ids in let rec find = function - | [] -> return_none - | (id : Z.t) :: ids -> try do_big_map_get ctxt id key >>=? return_some with Not_found -> find ids in + | [] -> + return_none + | (id : Z.t) :: ids -> ( + try do_big_map_get ctxt id key >>=? return_some + with Not_found -> find ids ) + in find ids) ; - register2 S.big_map_get (fun ctxt id key () () -> - do_big_map_get ctxt id key) ; + register2 S.big_map_get (fun ctxt id key () () -> do_big_map_get ctxt id key) ; register_field S.info (fun ctxt contract -> - Contract.get_balance ctxt contract >>=? fun balance -> - Delegate.get ctxt contract >>=? fun delegate -> - begin match Contract.is_implicit contract with - | Some manager -> - Contract.get_counter ctxt manager >>=? fun counter -> - return_some counter - | None -> return None - end >>=? fun counter -> - Contract.get_script ctxt contract >>=? fun (ctxt, script) -> - begin match script with - | None -> return (None, ctxt) - | Some script -> - let ctxt = Gas.set_unlimited ctxt in - let open Script_ir_translator in - parse_script ctxt ~legacy:true script >>=? fun (Ex_script script, ctxt) -> - unparse_script ctxt Readable script >>=? fun (script, ctxt) -> - return (Some script, ctxt) - end >>=? fun (script, _ctxt) -> - return { balance ; delegate ; script ; counter }) + Contract.get_balance ctxt contract + >>=? fun balance -> + Delegate.get ctxt contract + >>=? fun delegate -> + ( match Contract.is_implicit contract with + | Some manager -> + Contract.get_counter ctxt manager + >>=? fun counter -> return_some counter + | None -> + return None ) + >>=? fun counter -> + Contract.get_script ctxt contract + >>=? fun (ctxt, script) -> + ( match script with + | None -> + return (None, ctxt) + | Some script -> + let ctxt = Gas.set_unlimited ctxt in + let open Script_ir_translator in + parse_script ctxt ~legacy:true script + >>=? fun (Ex_script script, ctxt) -> + unparse_script ctxt Readable script + >>=? fun (script, ctxt) -> return (Some script, ctxt) ) + >>=? fun (script, _ctxt) -> return {balance; delegate; script; counter}) -let list ctxt block = - RPC_context.make_call0 S.list ctxt block () () +let list ctxt block = RPC_context.make_call0 S.list ctxt block () () let info ctxt block contract = RPC_context.make_call1 S.info ctxt block contract () () @@ -310,7 +377,13 @@ let balance ctxt block contract = RPC_context.make_call1 S.balance ctxt block contract () () let manager_key ctxt block mgr = - RPC_context.make_call1 S.manager_key ctxt block (Contract.implicit_contract mgr) () () + RPC_context.make_call1 + S.manager_key + ctxt + block + (Contract.implicit_contract mgr) + () + () let delegate ctxt block contract = RPC_context.make_call1 S.delegate ctxt block contract () () @@ -319,7 +392,13 @@ let delegate_opt ctxt block contract = RPC_context.make_opt_call1 S.delegate ctxt block contract () () let counter ctxt block mgr = - RPC_context.make_call1 S.counter ctxt block (Contract.implicit_contract mgr) () () + RPC_context.make_call1 + S.counter + ctxt + block + (Contract.implicit_contract mgr) + () + () let script ctxt block contract = RPC_context.make_call1 S.script ctxt block contract () () diff --git a/vendors/ligo-utils/tezos-protocol-alpha/contract_services.mli b/vendors/ligo-utils/tezos-protocol-alpha/contract_services.mli index 7b638ebd7..3c3aab0ee 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/contract_services.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/contract_services.mli @@ -25,61 +25,95 @@ open Alpha_context -val list: - 'a #RPC_context.simple -> 'a -> Contract.t list shell_tzresult Lwt.t +val list : 'a #RPC_context.simple -> 'a -> Contract.t list shell_tzresult Lwt.t type info = { - balance: Tez.t ; - delegate: public_key_hash option ; - counter: counter option ; - script: Script.t option ; + balance : Tez.t; + delegate : public_key_hash option; + counter : counter option; + script : Script.t option; } -val info_encoding: info Data_encoding.t +val info_encoding : info Data_encoding.t -val info: +val info : 'a #RPC_context.simple -> 'a -> Contract.t -> info shell_tzresult Lwt.t -val balance: +val balance : 'a #RPC_context.simple -> 'a -> Contract.t -> Tez.t shell_tzresult Lwt.t -val manager_key: - 'a #RPC_context.simple -> 'a -> public_key_hash -> public_key option shell_tzresult Lwt.t +val manager_key : + 'a #RPC_context.simple -> + 'a -> + public_key_hash -> + public_key option shell_tzresult Lwt.t -val delegate: - 'a #RPC_context.simple -> 'a -> Contract.t -> public_key_hash shell_tzresult Lwt.t +val delegate : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> + public_key_hash shell_tzresult Lwt.t -val delegate_opt: - 'a #RPC_context.simple -> 'a -> Contract.t -> public_key_hash option shell_tzresult Lwt.t +val delegate_opt : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> + public_key_hash option shell_tzresult Lwt.t -val counter: - 'a #RPC_context.simple -> 'a -> public_key_hash -> counter shell_tzresult Lwt.t +val counter : + 'a #RPC_context.simple -> + 'a -> + public_key_hash -> + counter shell_tzresult Lwt.t -val script: +val script : 'a #RPC_context.simple -> 'a -> Contract.t -> Script.t shell_tzresult Lwt.t -val script_opt: - 'a #RPC_context.simple -> 'a -> Contract.t -> Script.t option shell_tzresult Lwt.t +val script_opt : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> + Script.t option shell_tzresult Lwt.t -val storage: - 'a #RPC_context.simple -> 'a -> Contract.t -> Script.expr shell_tzresult Lwt.t - -val entrypoint_type: - 'a #RPC_context.simple -> 'a -> Contract.t -> string -> Script.expr shell_tzresult Lwt.t - -val list_entrypoints: - 'a #RPC_context.simple -> 'a -> Contract.t -> - (Michelson_v1_primitives.prim list list * - (string * Script.expr) list) shell_tzresult Lwt.t - -val storage_opt: - 'a #RPC_context.simple -> 'a -> Contract.t -> Script.expr option shell_tzresult Lwt.t - -val big_map_get: - 'a #RPC_context.simple -> 'a -> Z.t -> Script_expr_hash.t -> +val storage : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> Script.expr shell_tzresult Lwt.t -val contract_big_map_get_opt: - 'a #RPC_context.simple -> 'a -> Contract.t -> Script.expr * Script.expr -> Script.expr option shell_tzresult Lwt.t +val entrypoint_type : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> + string -> + Script.expr shell_tzresult Lwt.t -val register: unit -> unit +val list_entrypoints : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> + (Michelson_v1_primitives.prim list list * (string * Script.expr) list) + shell_tzresult + Lwt.t + +val storage_opt : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> + Script.expr option shell_tzresult Lwt.t + +val big_map_get : + 'a #RPC_context.simple -> + 'a -> + Z.t -> + Script_expr_hash.t -> + Script.expr shell_tzresult Lwt.t + +val contract_big_map_get_opt : + 'a #RPC_context.simple -> + 'a -> + Contract.t -> + Script.expr * Script.expr -> + Script.expr option shell_tzresult Lwt.t + +val register : unit -> unit diff --git a/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.ml index 21a74782b..c63a9f283 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.ml @@ -24,44 +24,74 @@ (*****************************************************************************) type error += - | Balance_too_low of Contract_repr.contract * Tez_repr.t * Tez_repr.t (* `Temporary *) - | Counter_in_the_past of Contract_repr.contract * Z.t * Z.t (* `Branch *) - | Counter_in_the_future of Contract_repr.contract * Z.t * Z.t (* `Temporary *) - | Unspendable_contract of Contract_repr.contract (* `Permanent *) - | Non_existing_contract of Contract_repr.contract (* `Temporary *) - | Empty_implicit_contract of Signature.Public_key_hash.t (* `Temporary *) - | Empty_transaction of Contract_repr.t (* `Temporary *) - | Inconsistent_hash of Signature.Public_key.t * Signature.Public_key_hash.t * Signature.Public_key_hash.t (* `Permanent *) - | Inconsistent_public_key of Signature.Public_key.t * Signature.Public_key.t (* `Permanent *) - | Failure of string (* `Permanent *) + | Balance_too_low of Contract_repr.contract * Tez_repr.t * Tez_repr.t + | (* `Temporary *) + Counter_in_the_past of Contract_repr.contract * Z.t * Z.t + | (* `Branch *) + Counter_in_the_future of Contract_repr.contract * Z.t * Z.t + | (* `Temporary *) + Unspendable_contract of Contract_repr.contract + | (* `Permanent *) + Non_existing_contract of Contract_repr.contract + | (* `Temporary *) + Empty_implicit_contract of Signature.Public_key_hash.t + | (* `Temporary *) + Empty_implicit_delegated_contract of + Signature.Public_key_hash.t + | (* `Temporary *) + Empty_transaction of Contract_repr.t (* `Temporary *) + | Inconsistent_hash of + Signature.Public_key.t + * Signature.Public_key_hash.t + * Signature.Public_key_hash.t + | (* `Permanent *) + Inconsistent_public_key of + Signature.Public_key.t * Signature.Public_key.t + | (* `Permanent *) + Failure of string (* `Permanent *) | Previously_revealed_key of Contract_repr.t (* `Permanent *) - | Unrevealed_manager_key of Contract_repr.t (* `Permanent *) + | Unrevealed_manager_key of Contract_repr.t + +(* `Permanent *) let () = register_error_kind `Permanent ~id:"contract.unspendable_contract" ~title:"Unspendable contract" - ~description:"An operation tried to spend tokens from an unspendable contract" + ~description: + "An operation tried to spend tokens from an unspendable contract" ~pp:(fun ppf c -> - Format.fprintf ppf "The tokens of contract %a can only be spent by its script" - Contract_repr.pp c) + Format.fprintf + ppf + "The tokens of contract %a can only be spent by its script" + Contract_repr.pp + c) Data_encoding.(obj1 (req "contract" Contract_repr.encoding)) - (function Unspendable_contract c -> Some c | _ -> None) + (function Unspendable_contract c -> Some c | _ -> None) (fun c -> Unspendable_contract c) ; register_error_kind `Temporary ~id:"contract.balance_too_low" ~title:"Balance too low" - ~description:"An operation tried to spend more tokens than the contract has" + ~description: + "An operation tried to spend more tokens than the contract has" ~pp:(fun ppf (c, b, a) -> - Format.fprintf ppf "Balance of contract %a too low (%a) to spend %a" - Contract_repr.pp c Tez_repr.pp b Tez_repr.pp a) - Data_encoding.(obj3 - (req "contract" Contract_repr.encoding) - (req "balance" Tez_repr.encoding) - (req "amount" Tez_repr.encoding)) - (function Balance_too_low (c, b, a) -> Some (c, b, a) | _ -> None) + Format.fprintf + ppf + "Balance of contract %a too low (%a) to spend %a" + Contract_repr.pp + c + Tez_repr.pp + b + Tez_repr.pp + a) + Data_encoding.( + obj3 + (req "contract" Contract_repr.encoding) + (req "balance" Tez_repr.encoding) + (req "amount" Tez_repr.encoding)) + (function Balance_too_low (c, b, a) -> Some (c, b, a) | _ -> None) (fun (c, b, a) -> Balance_too_low (c, b, a)) ; register_error_kind `Temporary @@ -69,16 +99,18 @@ let () = ~title:"Invalid counter (not yet reached) in a manager operation" ~description:"An operation assumed a contract counter in the future" ~pp:(fun ppf (contract, exp, found) -> - Format.fprintf ppf - "Counter %s not yet reached for contract %a (expected %s)" - (Z.to_string found) - Contract_repr.pp contract - (Z.to_string exp)) - Data_encoding. - (obj3 - (req "contract" Contract_repr.encoding) - (req "expected" z) - (req "found" z)) + Format.fprintf + ppf + "Counter %s not yet reached for contract %a (expected %s)" + (Z.to_string found) + Contract_repr.pp + contract + (Z.to_string exp)) + Data_encoding.( + obj3 + (req "contract" Contract_repr.encoding) + (req "expected" z) + (req "found" z)) (function Counter_in_the_future (c, x, y) -> Some (c, x, y) | _ -> None) (fun (c, x, y) -> Counter_in_the_future (c, x, y)) ; register_error_kind @@ -87,27 +119,29 @@ let () = ~title:"Invalid counter (already used) in a manager operation" ~description:"An operation assumed a contract counter in the past" ~pp:(fun ppf (contract, exp, found) -> - Format.fprintf ppf - "Counter %s already used for contract %a (expected %s)" - (Z.to_string found) - Contract_repr.pp contract - (Z.to_string exp)) - Data_encoding. - (obj3 - (req "contract" Contract_repr.encoding) - (req "expected" z) - (req "found" z)) + Format.fprintf + ppf + "Counter %s already used for contract %a (expected %s)" + (Z.to_string found) + Contract_repr.pp + contract + (Z.to_string exp)) + Data_encoding.( + obj3 + (req "contract" Contract_repr.encoding) + (req "expected" z) + (req "found" z)) (function Counter_in_the_past (c, x, y) -> Some (c, x, y) | _ -> None) (fun (c, x, y) -> Counter_in_the_past (c, x, y)) ; register_error_kind `Temporary ~id:"contract.non_existing_contract" ~title:"Non existing contract" - ~description:"A contract handle is not present in the context \ - (either it never was or it has been destroyed)" + ~description: + "A contract handle is not present in the context (either it never was \ + or it has been destroyed)" ~pp:(fun ppf contract -> - Format.fprintf ppf "Contract %a does not exist" - Contract_repr.pp contract) + Format.fprintf ppf "Contract %a does not exist" Contract_repr.pp contract) Data_encoding.(obj1 (req "contract" Contract_repr.encoding)) (function Non_existing_contract c -> Some c | _ -> None) (fun c -> Non_existing_contract c) ; @@ -115,30 +149,41 @@ let () = `Permanent ~id:"contract.manager.inconsistent_hash" ~title:"Inconsistent public key hash" - ~description:"A revealed manager public key is inconsistent with the announced hash" + ~description: + "A revealed manager public key is inconsistent with the announced hash" ~pp:(fun ppf (k, eh, ph) -> - Format.fprintf ppf "The hash of the manager public key %s is not %a as announced but %a" - (Signature.Public_key.to_b58check k) - Signature.Public_key_hash.pp ph - Signature.Public_key_hash.pp eh) - Data_encoding.(obj3 - (req "public_key" Signature.Public_key.encoding) - (req "expected_hash" Signature.Public_key_hash.encoding) - (req "provided_hash" Signature.Public_key_hash.encoding)) + Format.fprintf + ppf + "The hash of the manager public key %s is not %a as announced but %a" + (Signature.Public_key.to_b58check k) + Signature.Public_key_hash.pp + ph + Signature.Public_key_hash.pp + eh) + Data_encoding.( + obj3 + (req "public_key" Signature.Public_key.encoding) + (req "expected_hash" Signature.Public_key_hash.encoding) + (req "provided_hash" Signature.Public_key_hash.encoding)) (function Inconsistent_hash (k, eh, ph) -> Some (k, eh, ph) | _ -> None) (fun (k, eh, ph) -> Inconsistent_hash (k, eh, ph)) ; register_error_kind `Permanent ~id:"contract.manager.inconsistent_public_key" ~title:"Inconsistent public key" - ~description:"A provided manager public key is different with the public key stored in the contract" + ~description: + "A provided manager public key is different with the public key stored \ + in the contract" ~pp:(fun ppf (eh, ph) -> - Format.fprintf ppf "Expected manager public key %s but %s was provided" - (Signature.Public_key.to_b58check ph) - (Signature.Public_key.to_b58check eh)) - Data_encoding.(obj2 - (req "public_key" Signature.Public_key.encoding) - (req "expected_public_key" Signature.Public_key.encoding)) + Format.fprintf + ppf + "Expected manager public key %s but %s was provided" + (Signature.Public_key.to_b58check ph) + (Signature.Public_key.to_b58check eh)) + Data_encoding.( + obj2 + (req "public_key" Signature.Public_key.encoding) + (req "expected_public_key" Signature.Public_key.encoding)) (function Inconsistent_public_key (eh, ph) -> Some (eh, ph) | _ -> None) (fun (eh, ph) -> Inconsistent_public_key (eh, ph)) ; register_error_kind @@ -155,11 +200,14 @@ let () = ~id:"contract.unrevealed_key" ~title:"Manager operation precedes key revelation" ~description: - "One tried to apply a manager operation \ - without revealing the manager public key" + "One tried to apply a manager operation without revealing the manager \ + public key" ~pp:(fun ppf s -> - Format.fprintf ppf "Unrevealed manager key for contract %a." - Contract_repr.pp s) + Format.fprintf + ppf + "Unrevealed manager key for contract %a." + Contract_repr.pp + s) Data_encoding.(obj1 (req "contract" Contract_repr.encoding)) (function Unrevealed_manager_key s -> Some s | _ -> None) (fun s -> Unrevealed_manager_key s) ; @@ -167,11 +215,13 @@ let () = `Branch ~id:"contract.previously_revealed_key" ~title:"Manager operation already revealed" - ~description: - "One tried to revealed twice a manager public key" + ~description:"One tried to revealed twice a manager public key" ~pp:(fun ppf s -> - Format.fprintf ppf "Previously revealed manager key for contract %a." - Contract_repr.pp s) + Format.fprintf + ppf + "Previously revealed manager key for contract %a." + Contract_repr.pp + s) Data_encoding.(obj1 (req "contract" Contract_repr.encoding)) (function Previously_revealed_key s -> Some s | _ -> None) (fun s -> Previously_revealed_key s) ; @@ -179,23 +229,43 @@ let () = `Branch ~id:"implicit.empty_implicit_contract" ~title:"Empty implicit contract" - ~description:"No manager operations are allowed on an empty implicit contract." + ~description: + "No manager operations are allowed on an empty implicit contract." ~pp:(fun ppf implicit -> - Format.fprintf ppf - "Empty implicit contract (%a)" - Signature.Public_key_hash.pp implicit) + Format.fprintf + ppf + "Empty implicit contract (%a)" + Signature.Public_key_hash.pp + implicit) Data_encoding.(obj1 (req "implicit" Signature.Public_key_hash.encoding)) (function Empty_implicit_contract c -> Some c | _ -> None) (fun c -> Empty_implicit_contract c) ; + register_error_kind + `Branch + ~id:"implicit.empty_implicit_delegated_contract" + ~title:"Empty implicit delegated contract" + ~description:"Emptying an implicit delegated account is not allowed." + ~pp:(fun ppf implicit -> + Format.fprintf + ppf + "Emptying implicit delegated contract (%a)" + Signature.Public_key_hash.pp + implicit) + Data_encoding.(obj1 (req "implicit" Signature.Public_key_hash.encoding)) + (function Empty_implicit_delegated_contract c -> Some c | _ -> None) + (fun c -> Empty_implicit_delegated_contract c) ; register_error_kind `Branch ~id:"contract.empty_transaction" ~title:"Empty transaction" ~description:"Forbidden to credit 0ꜩ to a contract without code." ~pp:(fun ppf contract -> - Format.fprintf ppf - "Transaction of 0ꜩ towards a contract without code are forbidden (%a)." - Contract_repr.pp contract) + Format.fprintf + ppf + "Transaction of 0ꜩ towards a contract without code are forbidden \ + (%a)." + Contract_repr.pp + contract) Data_encoding.(obj1 (req "contract" Contract_repr.encoding)) (function Empty_transaction c -> Some c | _ -> None) (fun c -> Empty_transaction c) @@ -222,7 +292,9 @@ type big_map_diff = big_map_diff_item list let big_map_diff_item_encoding = let open Data_encoding in union - [ case (Tag 0) ~title:"update" + [ case + (Tag 0) + ~title:"update" (obj5 (req "action" (constant "update")) (req "big_map" z) @@ -230,157 +302,196 @@ let big_map_diff_item_encoding = (req "key" Script_repr.expr_encoding) (opt "value" Script_repr.expr_encoding)) (function - | Update { big_map ; diff_key_hash ; diff_key ; diff_value } -> + | Update {big_map; diff_key_hash; diff_key; diff_value} -> Some ((), big_map, diff_key_hash, diff_key, diff_value) - | _ -> None ) + | _ -> + None) (fun ((), big_map, diff_key_hash, diff_key, diff_value) -> - Update { big_map ; diff_key_hash ; diff_key ; diff_value }) ; - case (Tag 1) ~title:"remove" - (obj2 - (req "action" (constant "remove")) - (req "big_map" z)) - (function - | Clear big_map -> - Some ((), big_map) - | _ -> None ) - (fun ((), big_map) -> - Clear big_map) ; - case (Tag 2) ~title:"copy" + Update {big_map; diff_key_hash; diff_key; diff_value}); + case + (Tag 1) + ~title:"remove" + (obj2 (req "action" (constant "remove")) (req "big_map" z)) + (function Clear big_map -> Some ((), big_map) | _ -> None) + (fun ((), big_map) -> Clear big_map); + case + (Tag 2) + ~title:"copy" (obj3 (req "action" (constant "copy")) (req "source_big_map" z) (req "destination_big_map" z)) - (function - | Copy (src, dst) -> - Some ((), src, dst) - | _ -> None ) - (fun ((), src, dst) -> - Copy (src, dst)) ; - case (Tag 3) ~title:"alloc" + (function Copy (src, dst) -> Some ((), src, dst) | _ -> None) + (fun ((), src, dst) -> Copy (src, dst)); + case + (Tag 3) + ~title:"alloc" (obj4 (req "action" (constant "alloc")) (req "big_map" z) (req "key_type" Script_repr.expr_encoding) (req "value_type" Script_repr.expr_encoding)) (function - | Alloc { big_map ; key_type ; value_type } -> + | Alloc {big_map; key_type; value_type} -> Some ((), big_map, key_type, value_type) - | _ -> None ) + | _ -> + None) (fun ((), big_map, key_type, value_type) -> - Alloc { big_map ; key_type ; value_type }) ] + Alloc {big_map; key_type; value_type}) ] let big_map_diff_encoding = let open Data_encoding in - def "contract.big_map_diff" @@ - list big_map_diff_item_encoding + def "contract.big_map_diff" @@ list big_map_diff_item_encoding let big_map_key_cost = 65 + let big_map_cost = 33 let update_script_big_map c = function - | None -> return (c, Z.zero) + | None -> + return (c, Z.zero) | Some diff -> - fold_left_s (fun (c, total) -> function - | Clear id -> - Storage.Big_map.Total_bytes.get c id >>=? fun size -> - Storage.Big_map.remove_rec c id >>= fun c -> - if Compare.Z.(id < Z.zero) then - return (c, total) - else - return (c, Z.sub (Z.sub total size) (Z.of_int big_map_cost)) + fold_left_s + (fun (c, total) -> function Clear id -> + Storage.Big_map.Total_bytes.get c id + >>=? fun size -> + Storage.Big_map.remove_rec c id + >>= fun c -> + if Compare.Z.(id < Z.zero) then return (c, total) + else return (c, Z.sub (Z.sub total size) (Z.of_int big_map_cost)) | Copy (from, to_) -> - Storage.Big_map.copy c ~from ~to_ >>=? fun c -> - if Compare.Z.(to_ < Z.zero) then - return (c, total) + Storage.Big_map.copy c ~from ~to_ + >>=? fun c -> + if Compare.Z.(to_ < Z.zero) then return (c, total) else - Storage.Big_map.Total_bytes.get c from >>=? fun size -> + Storage.Big_map.Total_bytes.get c from + >>=? fun size -> return (c, Z.add (Z.add total size) (Z.of_int big_map_cost)) - | Alloc { big_map ; key_type ; value_type } -> - Storage.Big_map.Total_bytes.init c big_map Z.zero >>=? fun c -> + | Alloc {big_map; key_type; value_type} -> + Storage.Big_map.Total_bytes.init c big_map Z.zero + >>=? fun c -> (* Annotations are erased to allow sharing on [Copy]. The types from the contract code are used, these ones are only used to make sure they are compatible during transmissions between contracts, and only need to be compatible, annotations nonwhistanding. *) - let key_type = Micheline.strip_locations (Script_repr.strip_annotations (Micheline.root key_type)) in - let value_type = Micheline.strip_locations (Script_repr.strip_annotations (Micheline.root value_type)) in - Storage.Big_map.Key_type.init c big_map key_type >>=? fun c -> - Storage.Big_map.Value_type.init c big_map value_type >>=? fun c -> - if Compare.Z.(big_map < Z.zero) then - return (c, total) - else - return (c, Z.add total (Z.of_int big_map_cost)) - | Update { big_map ; diff_key_hash ; diff_value = None } -> + let key_type = + Micheline.strip_locations + (Script_repr.strip_annotations (Micheline.root key_type)) + in + let value_type = + Micheline.strip_locations + (Script_repr.strip_annotations (Micheline.root value_type)) + in + Storage.Big_map.Key_type.init c big_map key_type + >>=? fun c -> + Storage.Big_map.Value_type.init c big_map value_type + >>=? fun c -> + if Compare.Z.(big_map < Z.zero) then return (c, total) + else return (c, Z.add total (Z.of_int big_map_cost)) + | Update {big_map; diff_key_hash; diff_value = None} -> Storage.Big_map.Contents.remove (c, big_map) diff_key_hash >>=? fun (c, freed, existed) -> - let freed = if existed then freed + big_map_key_cost else freed in - Storage.Big_map.Total_bytes.get c big_map >>=? fun size -> - Storage.Big_map.Total_bytes.set c big_map (Z.sub size (Z.of_int freed)) >>=? fun c -> - if Compare.Z.(big_map < Z.zero) then - return (c, total) - else - return (c, Z.sub total (Z.of_int freed)) - | Update { big_map ; diff_key_hash ; diff_value = Some v } -> + let freed = + if existed then freed + big_map_key_cost else freed + in + Storage.Big_map.Total_bytes.get c big_map + >>=? fun size -> + Storage.Big_map.Total_bytes.set + c + big_map + (Z.sub size (Z.of_int freed)) + >>=? fun c -> + if Compare.Z.(big_map < Z.zero) then return (c, total) + else return (c, Z.sub total (Z.of_int freed)) + | Update {big_map; diff_key_hash; diff_value = Some v} -> Storage.Big_map.Contents.init_set (c, big_map) diff_key_hash v >>=? fun (c, size_diff, existed) -> - let size_diff = if existed then size_diff else size_diff + big_map_key_cost in - Storage.Big_map.Total_bytes.get c big_map >>=? fun size -> - Storage.Big_map.Total_bytes.set c big_map (Z.add size (Z.of_int size_diff)) >>=? fun c -> - if Compare.Z.(big_map < Z.zero) then - return (c, total) - else - return (c, Z.add total (Z.of_int size_diff))) - (c, Z.zero) diff + let size_diff = + if existed then size_diff else size_diff + big_map_key_cost + in + Storage.Big_map.Total_bytes.get c big_map + >>=? fun size -> + Storage.Big_map.Total_bytes.set + c + big_map + (Z.add size (Z.of_int size_diff)) + >>=? fun c -> + if Compare.Z.(big_map < Z.zero) then return (c, total) + else return (c, Z.add total (Z.of_int size_diff))) + (c, Z.zero) + diff -let create_base c - ?(prepaid_bootstrap_storage=false) (* Free space for bootstrap contracts *) - contract - ~balance ~manager ~delegate ?script () = - begin match Contract_repr.is_implicit contract with - | None -> return c - | Some _ -> - Storage.Contract.Global_counter.get c >>=? fun counter -> - Storage.Contract.Counter.init c contract counter - end >>=? fun c -> - Storage.Contract.Balance.init c contract balance >>=? fun c -> - begin match manager with - | Some manager -> - Storage.Contract.Manager.init c contract (Manager_repr.Hash manager) - | None -> return c - end >>=? fun c -> - begin - match delegate with - | None -> return c - | Some delegate -> - Delegate_storage.init c contract delegate - end >>=? fun c -> +let create_base c ?(prepaid_bootstrap_storage = false) + (* Free space for bootstrap contracts *) + contract ~balance ~manager ~delegate ?script () = + ( match Contract_repr.is_implicit contract with + | None -> + return c + | Some _ -> + Storage.Contract.Global_counter.get c + >>=? fun counter -> Storage.Contract.Counter.init c contract counter ) + >>=? fun c -> + Storage.Contract.Balance.init c contract balance + >>=? fun c -> + ( match manager with + | Some manager -> + Storage.Contract.Manager.init c contract (Manager_repr.Hash manager) + | None -> + return c ) + >>=? fun c -> + ( match delegate with + | None -> + return c + | Some delegate -> + Delegate_storage.init c contract delegate ) + >>=? fun c -> match script with - | Some ({ Script_repr.code ; storage }, big_map_diff) -> - Storage.Contract.Code.init c contract code >>=? fun (c, code_size) -> - Storage.Contract.Storage.init c contract storage >>=? fun (c, storage_size) -> - update_script_big_map c big_map_diff >>=? fun (c, big_map_size) -> - let total_size = Z.add (Z.add (Z.of_int code_size) (Z.of_int storage_size)) big_map_size in - assert Compare.Z.(total_size >= Z.zero) ; - let prepaid_bootstrap_storage = - if prepaid_bootstrap_storage then - total_size - else - Z.zero + | Some ({Script_repr.code; storage}, big_map_diff) -> + Storage.Contract.Code.init c contract code + >>=? fun (c, code_size) -> + Storage.Contract.Storage.init c contract storage + >>=? fun (c, storage_size) -> + update_script_big_map c big_map_diff + >>=? fun (c, big_map_size) -> + let total_size = + Z.add (Z.add (Z.of_int code_size) (Z.of_int storage_size)) big_map_size in - Storage.Contract.Paid_storage_space.init c contract prepaid_bootstrap_storage >>=? fun c -> + assert (Compare.Z.(total_size >= Z.zero)) ; + let prepaid_bootstrap_storage = + if prepaid_bootstrap_storage then total_size else Z.zero + in + Storage.Contract.Paid_storage_space.init + c + contract + prepaid_bootstrap_storage + >>=? fun c -> Storage.Contract.Used_storage_space.init c contract total_size | None -> return c -let originate c ?prepaid_bootstrap_storage contract - ~balance ~script ~delegate = - create_base c ?prepaid_bootstrap_storage contract ~balance - ~manager:None ~delegate ~script () +let originate c ?prepaid_bootstrap_storage contract ~balance ~script ~delegate + = + create_base + c + ?prepaid_bootstrap_storage + contract + ~balance + ~manager:None + ~delegate + ~script + () let create_implicit c manager ~balance = - create_base c (Contract_repr.implicit_contract manager) - ~balance ~manager:(Some manager) ?script:None ~delegate:None () + create_base + c + (Contract_repr.implicit_contract manager) + ~balance + ~manager:(Some manager) + ?script:None + ~delegate:None + () let delete c contract = match Contract_repr.is_implicit contract with @@ -388,215 +499,255 @@ let delete c contract = (* For non implicit contract Big_map should be cleared *) failwith "Non implicit contracts cannot be removed" | Some _ -> - Delegate_storage.remove c contract >>=? fun c -> - Storage.Contract.Balance.delete c contract >>=? fun c -> - Storage.Contract.Manager.delete c contract >>=? fun c -> - Storage.Contract.Counter.delete c contract >>=? fun c -> - Storage.Contract.Code.remove c contract >>=? fun (c, _, _) -> - Storage.Contract.Storage.remove c contract >>=? fun (c, _, _) -> - Storage.Contract.Paid_storage_space.remove c contract >>= fun c -> - Storage.Contract.Used_storage_space.remove c contract >>= fun c -> - return c + Delegate_storage.remove c contract + >>=? fun c -> + Storage.Contract.Balance.delete c contract + >>=? fun c -> + Storage.Contract.Manager.delete c contract + >>=? fun c -> + Storage.Contract.Counter.delete c contract + >>=? fun c -> + Storage.Contract.Code.remove c contract + >>=? fun (c, _, _) -> + Storage.Contract.Storage.remove c contract + >>=? fun (c, _, _) -> + Storage.Contract.Paid_storage_space.remove c contract + >>= fun c -> + Storage.Contract.Used_storage_space.remove c contract + >>= fun c -> return c let allocated c contract = - Storage.Contract.Balance.get_option c contract >>=? function - | None -> return_false - | Some _ -> return_true + Storage.Contract.Balance.get_option c contract + >>=? function None -> return_false | Some _ -> return_true let exists c contract = match Contract_repr.is_implicit contract with - | Some _ -> return_true - | None -> allocated c contract + | Some _ -> + return_true + | None -> + allocated c contract let must_exist c contract = - exists c contract >>=? function - | true -> return_unit - | false -> fail (Non_existing_contract contract) + exists c contract + >>=? function + | true -> return_unit | false -> fail (Non_existing_contract contract) let must_be_allocated c contract = - allocated c contract >>=? function - | true -> return_unit - | false -> - match Contract_repr.is_implicit contract with - | Some pkh -> fail (Empty_implicit_contract pkh) - | None -> fail (Non_existing_contract contract) + allocated c contract + >>=? function + | true -> + return_unit + | false -> ( + match Contract_repr.is_implicit contract with + | Some pkh -> + fail (Empty_implicit_contract pkh) + | None -> + fail (Non_existing_contract contract) ) let list c = Storage.Contract.list c let fresh_contract_from_current_nonce c = - Lwt.return (Raw_context.increment_origination_nonce c) >>=? fun (c, nonce) -> - return (c, Contract_repr.originated_contract nonce) + Lwt.return (Raw_context.increment_origination_nonce c) + >>=? fun (c, nonce) -> return (c, Contract_repr.originated_contract nonce) -let originated_from_current_nonce ~since: ctxt_since ~until: ctxt_until = - Lwt.return (Raw_context.origination_nonce ctxt_since) >>=? fun since -> - Lwt.return (Raw_context.origination_nonce ctxt_until) >>=? fun until -> +let originated_from_current_nonce ~since:ctxt_since ~until:ctxt_until = + Lwt.return (Raw_context.origination_nonce ctxt_since) + >>=? fun since -> + Lwt.return (Raw_context.origination_nonce ctxt_until) + >>=? fun until -> filter_map_s - (fun contract -> exists ctxt_until contract >>=? function - | true -> return_some contract - | false -> return_none) + (fun contract -> + exists ctxt_until contract + >>=? function true -> return_some contract | false -> return_none) (Contract_repr.originated_contracts ~since ~until) let check_counter_increment c manager counter = let contract = Contract_repr.implicit_contract manager in - Storage.Contract.Counter.get c contract >>=? fun contract_counter -> + Storage.Contract.Counter.get c contract + >>=? fun contract_counter -> let expected = Z.succ contract_counter in - if Compare.Z.(expected = counter) - then return_unit + if Compare.Z.(expected = counter) then return_unit else if Compare.Z.(expected > counter) then fail (Counter_in_the_past (contract, expected, counter)) - else - fail (Counter_in_the_future (contract, expected, counter)) + else fail (Counter_in_the_future (contract, expected, counter)) let increment_counter c manager = let contract = Contract_repr.implicit_contract manager in - Storage.Contract.Global_counter.get c >>=? fun global_counter -> - Storage.Contract.Global_counter.set c (Z.succ global_counter) >>=? fun c -> - Storage.Contract.Counter.get c contract >>=? fun contract_counter -> + Storage.Contract.Global_counter.get c + >>=? fun global_counter -> + Storage.Contract.Global_counter.set c (Z.succ global_counter) + >>=? fun c -> + Storage.Contract.Counter.get c contract + >>=? fun contract_counter -> Storage.Contract.Counter.set c contract (Z.succ contract_counter) -let get_script_code c contract = - Storage.Contract.Code.get_option c contract +let get_script_code c contract = Storage.Contract.Code.get_option c contract let get_script c contract = - Storage.Contract.Code.get_option c contract >>=? fun (c, code) -> - Storage.Contract.Storage.get_option c contract >>=? fun (c, storage) -> - match code, storage with - | None, None -> return (c, None) - | Some code, Some storage -> return (c, Some { Script_repr.code ; storage }) - | None, Some _ | Some _, None -> failwith "get_script" + Storage.Contract.Code.get_option c contract + >>=? fun (c, code) -> + Storage.Contract.Storage.get_option c contract + >>=? fun (c, storage) -> + match (code, storage) with + | (None, None) -> + return (c, None) + | (Some code, Some storage) -> + return (c, Some {Script_repr.code; storage}) + | (None, Some _) | (Some _, None) -> + failwith "get_script" let get_storage ctxt contract = - Storage.Contract.Storage.get_option ctxt contract >>=? function - | (ctxt, None) -> return (ctxt, None) + Storage.Contract.Storage.get_option ctxt contract + >>=? function + | (ctxt, None) -> + return (ctxt, None) | (ctxt, Some storage) -> - Lwt.return (Script_repr.force_decode storage) >>=? fun (storage, cost) -> - Lwt.return (Raw_context.consume_gas ctxt cost) >>=? fun ctxt -> - return (ctxt, Some storage) + Lwt.return (Script_repr.force_decode storage) + >>=? fun (storage, cost) -> + Lwt.return (Raw_context.consume_gas ctxt cost) + >>=? fun ctxt -> return (ctxt, Some storage) let get_counter c manager = let contract = Contract_repr.implicit_contract manager in - Storage.Contract.Counter.get_option c contract >>=? function - | None -> begin - match Contract_repr.is_implicit contract with - | Some _ -> Storage.Contract.Global_counter.get c - | None -> failwith "get_counter" - end - | Some v -> return v - -let get_manager_004 c contract = - Storage.Contract.Manager.get_option c contract >>=? function - | None -> begin - match Contract_repr.is_implicit contract with - | Some manager -> return manager - | None -> failwith "get_manager" - end - | Some (Manager_repr.Hash v) -> return v - | Some (Manager_repr.Public_key v) -> return (Signature.Public_key.hash v) + Storage.Contract.Counter.get_option c contract + >>=? function + | None -> ( + match Contract_repr.is_implicit contract with + | Some _ -> + Storage.Contract.Global_counter.get c + | None -> + failwith "get_counter" ) + | Some v -> + return v let get_manager_key c manager = let contract = Contract_repr.implicit_contract manager in - Storage.Contract.Manager.get_option c contract >>=? function - | None -> failwith "get_manager_key" - | Some (Manager_repr.Hash _) -> fail (Unrevealed_manager_key contract) - | Some (Manager_repr.Public_key v) -> return v + Storage.Contract.Manager.get_option c contract + >>=? function + | None -> + failwith "get_manager_key" + | Some (Manager_repr.Hash _) -> + fail (Unrevealed_manager_key contract) + | Some (Manager_repr.Public_key v) -> + return v let is_manager_key_revealed c manager = let contract = Contract_repr.implicit_contract manager in - Storage.Contract.Manager.get_option c contract >>=? function - | None -> return_false - | Some (Manager_repr.Hash _) -> return_false - | Some (Manager_repr.Public_key _) -> return_true + Storage.Contract.Manager.get_option c contract + >>=? function + | None -> + return_false + | Some (Manager_repr.Hash _) -> + return_false + | Some (Manager_repr.Public_key _) -> + return_true let reveal_manager_key c manager public_key = let contract = Contract_repr.implicit_contract manager in - Storage.Contract.Manager.get c contract >>=? function - | Public_key _ -> fail (Previously_revealed_key contract) + Storage.Contract.Manager.get c contract + >>=? function + | Public_key _ -> + fail (Previously_revealed_key contract) | Hash v -> let actual_hash = Signature.Public_key.hash public_key in - if (Signature.Public_key_hash.equal actual_hash v) then - let v = (Manager_repr.Public_key public_key) in - Storage.Contract.Manager.set c contract v >>=? fun c -> - return c - else fail (Inconsistent_hash (public_key,v,actual_hash)) + if Signature.Public_key_hash.equal actual_hash v then + let v = Manager_repr.Public_key public_key in + Storage.Contract.Manager.set c contract v >>=? fun c -> return c + else fail (Inconsistent_hash (public_key, v, actual_hash)) let get_balance c contract = - Storage.Contract.Balance.get_option c contract >>=? function - | None -> begin - match Contract_repr.is_implicit contract with - | Some _ -> return Tez_repr.zero - | None -> failwith "get_balance" - end - | Some v -> return v + Storage.Contract.Balance.get_option c contract + >>=? function + | None -> ( + match Contract_repr.is_implicit contract with + | Some _ -> + return Tez_repr.zero + | None -> + failwith "get_balance" ) + | Some v -> + return v let update_script_storage c contract storage big_map_diff = let storage = Script_repr.lazy_expr storage in - update_script_big_map c big_map_diff >>=? fun (c, big_map_size_diff) -> - Storage.Contract.Storage.set c contract storage >>=? fun (c, size_diff) -> - Storage.Contract.Used_storage_space.get c contract >>=? fun previous_size -> - let new_size = Z.add previous_size (Z.add big_map_size_diff (Z.of_int size_diff)) in + update_script_big_map c big_map_diff + >>=? fun (c, big_map_size_diff) -> + Storage.Contract.Storage.set c contract storage + >>=? fun (c, size_diff) -> + Storage.Contract.Used_storage_space.get c contract + >>=? fun previous_size -> + let new_size = + Z.add previous_size (Z.add big_map_size_diff (Z.of_int size_diff)) + in Storage.Contract.Used_storage_space.set c contract new_size let spend c contract amount = - Storage.Contract.Balance.get c contract >>=? fun balance -> + Storage.Contract.Balance.get c contract + >>=? fun balance -> match Tez_repr.(balance -? amount) with | Error _ -> fail (Balance_too_low (contract, balance, amount)) - | Ok new_balance -> - Storage.Contract.Balance.set c contract new_balance >>=? fun c -> - Roll_storage.Contract.remove_amount c contract amount >>=? fun c -> - if Tez_repr.(new_balance > Tez_repr.zero) then - return c - else match Contract_repr.is_implicit contract with - | None -> return c (* Never delete originated contracts *) - | Some pkh -> - Delegate_storage.get c contract >>=? function + | Ok new_balance -> ( + Storage.Contract.Balance.set c contract new_balance + >>=? fun c -> + Roll_storage.Contract.remove_amount c contract amount + >>=? fun c -> + if Tez_repr.(new_balance > Tez_repr.zero) then return c + else + match Contract_repr.is_implicit contract with + | None -> + return c (* Never delete originated contracts *) + | Some pkh -> ( + Delegate_storage.get c contract + >>=? function | Some pkh' -> - (* Don't delete "delegate" contract *) - assert (Signature.Public_key_hash.equal pkh pkh') ; - return c + if Signature.Public_key_hash.equal pkh pkh' then return c + else + (* Delegated implicit accounts cannot be emptied *) + fail (Empty_implicit_delegated_contract pkh) | None -> (* Delete empty implicit contract *) - delete c contract + delete c contract ) ) let credit c contract amount = - begin - if Tez_repr.(amount <> Tez_repr.zero) then - return c - else - Storage.Contract.Code.mem c contract >>=? fun (c, target_has_code) -> - fail_unless target_has_code (Empty_transaction contract) >>=? fun () -> - return c - end >>=? fun c -> - Storage.Contract.Balance.get_option c contract >>=? function - | None -> begin - match Contract_repr.is_implicit contract with - | None -> fail (Non_existing_contract contract) - | Some manager -> - create_implicit c manager ~balance:amount - end + ( if Tez_repr.(amount <> Tez_repr.zero) then return c + else + Storage.Contract.Code.mem c contract + >>=? fun (c, target_has_code) -> + fail_unless target_has_code (Empty_transaction contract) + >>=? fun () -> return c ) + >>=? fun c -> + Storage.Contract.Balance.get_option c contract + >>=? function + | None -> ( + match Contract_repr.is_implicit contract with + | None -> + fail (Non_existing_contract contract) + | Some manager -> + create_implicit c manager ~balance:amount ) | Some balance -> - Lwt.return Tez_repr.(amount +? balance) >>=? fun balance -> - Storage.Contract.Balance.set c contract balance >>=? fun c -> - Roll_storage.Contract.add_amount c contract amount + Lwt.return Tez_repr.(amount +? balance) + >>=? fun balance -> + Storage.Contract.Balance.set c contract balance + >>=? fun c -> Roll_storage.Contract.add_amount c contract amount let init c = Storage.Contract.Global_counter.init c Z.zero + >>=? fun c -> Storage.Big_map.Next.init c let used_storage_space c contract = - Storage.Contract.Used_storage_space.get_option c contract >>=? function - | None -> return Z.zero - | Some fees -> return fees + Storage.Contract.Used_storage_space.get_option c contract + >>=? function None -> return Z.zero | Some fees -> return fees let paid_storage_space c contract = - Storage.Contract.Paid_storage_space.get_option c contract >>=? function - | None -> return Z.zero - | Some paid_space -> return paid_space + Storage.Contract.Paid_storage_space.get_option c contract + >>=? function None -> return Z.zero | Some paid_space -> return paid_space -let set_paid_storage_space_and_return_fees_to_pay c contract new_storage_space = - Storage.Contract.Paid_storage_space.get c contract >>=? fun already_paid_space -> - if Compare.Z.(already_paid_space >= new_storage_space) then - return (Z.zero, c) +let set_paid_storage_space_and_return_fees_to_pay c contract new_storage_space + = + Storage.Contract.Paid_storage_space.get c contract + >>=? fun already_paid_space -> + if Compare.Z.(already_paid_space >= new_storage_space) then return (Z.zero, c) else let to_pay = Z.sub new_storage_space already_paid_space in - Storage.Contract.Paid_storage_space.set c contract new_storage_space >>=? fun c -> - return (to_pay, c) + Storage.Contract.Paid_storage_space.set c contract new_storage_space + >>=? fun c -> return (to_pay, c) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.mli index a8c1747e1..450b58ac1 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.mli @@ -24,60 +24,89 @@ (*****************************************************************************) type error += - | Balance_too_low of Contract_repr.contract * Tez_repr.t * Tez_repr.t (* `Temporary *) - | Counter_in_the_past of Contract_repr.contract * Z.t * Z.t (* `Branch *) - | Counter_in_the_future of Contract_repr.contract * Z.t * Z.t (* `Temporary *) - | Unspendable_contract of Contract_repr.contract (* `Permanent *) - | Non_existing_contract of Contract_repr.contract (* `Temporary *) - | Empty_implicit_contract of Signature.Public_key_hash.t (* `Temporary *) - | Empty_transaction of Contract_repr.t (* `Temporary *) - | Inconsistent_hash of Signature.Public_key.t * Signature.Public_key_hash.t * Signature.Public_key_hash.t (* `Permanent *) - | Inconsistent_public_key of Signature.Public_key.t * Signature.Public_key.t (* `Permanent *) - | Failure of string (* `Permanent *) + | Balance_too_low of Contract_repr.contract * Tez_repr.t * Tez_repr.t + | (* `Temporary *) + Counter_in_the_past of Contract_repr.contract * Z.t * Z.t + | (* `Branch *) + Counter_in_the_future of Contract_repr.contract * Z.t * Z.t + | (* `Temporary *) + Unspendable_contract of Contract_repr.contract + | (* `Permanent *) + Non_existing_contract of Contract_repr.contract + | (* `Temporary *) + Empty_implicit_contract of Signature.Public_key_hash.t + | (* `Temporary *) + Empty_implicit_delegated_contract of + Signature.Public_key_hash.t + | (* `Temporary *) + Empty_transaction of Contract_repr.t (* `Temporary *) + | Inconsistent_hash of + Signature.Public_key.t + * Signature.Public_key_hash.t + * Signature.Public_key_hash.t + | (* `Permanent *) + Inconsistent_public_key of + Signature.Public_key.t * Signature.Public_key.t + | (* `Permanent *) + Failure of string (* `Permanent *) | Previously_revealed_key of Contract_repr.t (* `Permanent *) - | Unrevealed_manager_key of Contract_repr.t (* `Permanent *) + | Unrevealed_manager_key of Contract_repr.t -val exists: Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t -val must_exist: Raw_context.t -> Contract_repr.t -> unit tzresult Lwt.t +(* `Permanent *) -val allocated: Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t -val must_be_allocated: Raw_context.t -> Contract_repr.t -> unit tzresult Lwt.t +val exists : Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t +val must_exist : Raw_context.t -> Contract_repr.t -> unit tzresult Lwt.t -val list: Raw_context.t -> Contract_repr.t list Lwt.t +val allocated : Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t -val check_counter_increment: +val must_be_allocated : Raw_context.t -> Contract_repr.t -> unit tzresult Lwt.t + +val list : Raw_context.t -> Contract_repr.t list Lwt.t + +val check_counter_increment : Raw_context.t -> Signature.Public_key_hash.t -> Z.t -> unit tzresult Lwt.t -val increment_counter: +val increment_counter : Raw_context.t -> Signature.Public_key_hash.t -> Raw_context.t tzresult Lwt.t -val get_manager_004: - Raw_context.t -> Contract_repr.t -> Signature.Public_key_hash.t tzresult Lwt.t +val get_manager_key : + Raw_context.t -> + Signature.Public_key_hash.t -> + Signature.Public_key.t tzresult Lwt.t -val get_manager_key: - Raw_context.t -> Signature.Public_key_hash.t -> Signature.Public_key.t tzresult Lwt.t -val is_manager_key_revealed: +val is_manager_key_revealed : Raw_context.t -> Signature.Public_key_hash.t -> bool tzresult Lwt.t -val reveal_manager_key: - Raw_context.t -> Signature.Public_key_hash.t -> Signature.Public_key.t -> +val reveal_manager_key : + Raw_context.t -> + Signature.Public_key_hash.t -> + Signature.Public_key.t -> Raw_context.t tzresult Lwt.t -val get_balance: Raw_context.t -> Contract_repr.t -> Tez_repr.t tzresult Lwt.t -val get_counter: Raw_context.t -> Signature.Public_key_hash.t -> Z.t tzresult Lwt.t +val get_balance : Raw_context.t -> Contract_repr.t -> Tez_repr.t tzresult Lwt.t -val get_script_code: - Raw_context.t -> Contract_repr.t -> (Raw_context.t * Script_repr.lazy_expr option) tzresult Lwt.t -val get_script: - Raw_context.t -> Contract_repr.t -> (Raw_context.t * Script_repr.t option) tzresult Lwt.t -val get_storage: - Raw_context.t -> Contract_repr.t -> (Raw_context.t * Script_repr.expr option) tzresult Lwt.t +val get_counter : + Raw_context.t -> Signature.Public_key_hash.t -> Z.t tzresult Lwt.t +val get_script_code : + Raw_context.t -> + Contract_repr.t -> + (Raw_context.t * Script_repr.lazy_expr option) tzresult Lwt.t + +val get_script : + Raw_context.t -> + Contract_repr.t -> + (Raw_context.t * Script_repr.t option) tzresult Lwt.t + +val get_storage : + Raw_context.t -> + Contract_repr.t -> + (Raw_context.t * Script_repr.expr option) tzresult Lwt.t type big_map_diff_item = | Update of { - big_map : Z.t ; + big_map : Z.t; diff_key : Script_repr.expr; diff_key_hash : Script_expr_hash.t; diff_value : Script_repr.expr option; @@ -94,38 +123,50 @@ type big_map_diff = big_map_diff_item list val big_map_diff_encoding : big_map_diff Data_encoding.t -val update_script_storage: - Raw_context.t -> Contract_repr.t -> - Script_repr.expr -> big_map_diff option -> +val update_script_storage : + Raw_context.t -> + Contract_repr.t -> + Script_repr.expr -> + big_map_diff option -> Raw_context.t tzresult Lwt.t -val credit: - Raw_context.t -> Contract_repr.t -> Tez_repr.t -> +val credit : + Raw_context.t -> + Contract_repr.t -> + Tez_repr.t -> Raw_context.t tzresult Lwt.t -val spend: - Raw_context.t -> Contract_repr.t -> Tez_repr.t -> +val spend : + Raw_context.t -> + Contract_repr.t -> + Tez_repr.t -> Raw_context.t tzresult Lwt.t -val originate: +val originate : Raw_context.t -> ?prepaid_bootstrap_storage:bool -> Contract_repr.t -> balance:Tez_repr.t -> - script:(Script_repr.t * big_map_diff option) -> + script:Script_repr.t * big_map_diff option -> delegate:Signature.Public_key_hash.t option -> Raw_context.t tzresult Lwt.t val fresh_contract_from_current_nonce : Raw_context.t -> (Raw_context.t * Contract_repr.t) tzresult Lwt.t + val originated_from_current_nonce : - since: Raw_context.t -> - until: Raw_context.t -> + since:Raw_context.t -> + until:Raw_context.t -> Contract_repr.t list tzresult Lwt.t -val init: - Raw_context.t -> Raw_context.t tzresult Lwt.t +val init : Raw_context.t -> Raw_context.t tzresult Lwt.t -val used_storage_space: Raw_context.t -> Contract_repr.t -> Z.t tzresult Lwt.t -val paid_storage_space: Raw_context.t -> Contract_repr.t -> Z.t tzresult Lwt.t -val set_paid_storage_space_and_return_fees_to_pay: Raw_context.t -> Contract_repr.t -> Z.t -> (Z.t * Raw_context.t) tzresult Lwt.t +val used_storage_space : Raw_context.t -> Contract_repr.t -> Z.t tzresult Lwt.t + +val paid_storage_space : Raw_context.t -> Contract_repr.t -> Z.t tzresult Lwt.t + +val set_paid_storage_space_and_return_fees_to_pay : + Raw_context.t -> + Contract_repr.t -> + Z.t -> + (Z.t * Raw_context.t) tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.ml index 5c24319e8..153c3f765 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.ml @@ -24,18 +24,23 @@ (*****************************************************************************) type t = int32 + type cycle = t let encoding = Data_encoding.int32 + let rpc_arg = let construct = Int32.to_string in let destruct str = match Int32.of_string str with - | exception _ -> Error "Cannot parse cycle" - | cycle -> Ok cycle in + | exception _ -> + Error "Cannot parse cycle" + | cycle -> + Ok cycle + in RPC_arg.make ~descr:"A cycle integer" - ~name: "block_cycle" + ~name:"block_cycle" ~construct ~destruct () @@ -44,42 +49,45 @@ let pp ppf cycle = Format.fprintf ppf "%ld" cycle include (Compare.Int32 : Compare.S with type t := t) -module Map = Map.Make(Compare.Int32) +module Map = Map.Make (Compare.Int32) let root = 0l + let succ = Int32.succ -let pred = function - | 0l -> None - | i -> Some (Int32.pred i) + +let pred = function 0l -> None | i -> Some (Int32.pred i) let add c i = - assert Compare.Int.(i > 0) ; + assert (Compare.Int.(i > 0)) ; Int32.add c (Int32.of_int i) let sub c i = - assert Compare.Int.(i > 0) ; + assert (Compare.Int.(i > 0)) ; let r = Int32.sub c (Int32.of_int i) in if Compare.Int32.(r < 0l) then None else Some r let to_int32 i = i let of_int32_exn l = - if Compare.Int32.(l >= 0l) - then l + if Compare.Int32.(l >= 0l) then l else invalid_arg "Level_repr.Cycle.of_int32" module Index = struct type t = cycle + let path_length = 1 - let to_path c l = - Int32.to_string (to_int32 c) :: l + + let to_path c l = Int32.to_string (to_int32 c) :: l + let of_path = function - | [s] -> begin - try Some (Int32.of_string s) - with _ -> None - end - | _ -> None + | [s] -> ( + try Some (Int32.of_string s) with _ -> None ) + | _ -> + None + let rpc_arg = rpc_arg + let encoding = encoding + let compare = compare end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.mli index c3502f665..241992c70 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/cycle_repr.mli @@ -24,20 +24,30 @@ (*****************************************************************************) type t + type cycle = t + include Compare.S with type t := t -val encoding: cycle Data_encoding.t -val rpc_arg: cycle RPC_arg.arg -val pp: Format.formatter -> cycle -> unit -val root: cycle -val pred: cycle -> cycle option -val add: cycle -> int -> cycle -val sub: cycle -> int -> cycle option -val succ: cycle -> cycle +val encoding : cycle Data_encoding.t -val to_int32: cycle -> int32 -val of_int32_exn: int32 -> cycle +val rpc_arg : cycle RPC_arg.arg + +val pp : Format.formatter -> cycle -> unit + +val root : cycle + +val pred : cycle -> cycle option + +val add : cycle -> int -> cycle + +val sub : cycle -> int -> cycle option + +val succ : cycle -> cycle + +val to_int32 : cycle -> int32 + +val of_int32_exn : int32 -> cycle module Map : S.MAP with type key = cycle diff --git a/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.ml b/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.ml index 0e54e0afc..b6b2899ba 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.ml @@ -26,31 +26,53 @@ open Alpha_context type info = { - balance: Tez.t ; - frozen_balance: Tez.t ; - frozen_balance_by_cycle: Delegate.frozen_balance Cycle.Map.t ; - staking_balance: Tez.t ; - delegated_contracts: Contract_repr.t list ; - delegated_balance: Tez.t ; - deactivated: bool ; - grace_period: Cycle.t ; + balance : Tez.t; + frozen_balance : Tez.t; + frozen_balance_by_cycle : Delegate.frozen_balance Cycle.Map.t; + staking_balance : Tez.t; + delegated_contracts : Contract_repr.t list; + delegated_balance : Tez.t; + deactivated : bool; + grace_period : Cycle.t; } let info_encoding = let open Data_encoding in conv - (fun { balance ; frozen_balance ; frozen_balance_by_cycle ; - staking_balance ; delegated_contracts ; delegated_balance ; - deactivated ; grace_period } -> - (balance, frozen_balance, frozen_balance_by_cycle, - staking_balance, delegated_contracts, delegated_balance, - deactivated, grace_period)) - (fun (balance, frozen_balance, frozen_balance_by_cycle, - staking_balance, delegated_contracts, delegated_balance, - deactivated, grace_period) -> - { balance ; frozen_balance ; frozen_balance_by_cycle ; - staking_balance ; delegated_contracts ; delegated_balance ; - deactivated ; grace_period }) + (fun { balance; + frozen_balance; + frozen_balance_by_cycle; + staking_balance; + delegated_contracts; + delegated_balance; + deactivated; + grace_period } -> + ( balance, + frozen_balance, + frozen_balance_by_cycle, + staking_balance, + delegated_contracts, + delegated_balance, + deactivated, + grace_period )) + (fun ( balance, + frozen_balance, + frozen_balance_by_cycle, + staking_balance, + delegated_contracts, + delegated_balance, + deactivated, + grace_period ) -> + { + balance; + frozen_balance; + frozen_balance_by_cycle; + staking_balance; + delegated_contracts; + delegated_balance; + deactivated; + grace_period; + }) (obj8 (req "balance" Tez.encoding) (req "frozen_balance" Tez.encoding) @@ -62,188 +84,180 @@ let info_encoding = (req "grace_period" Cycle.encoding)) module S = struct - let path = RPC_path.(open_root / "context" / "delegates") open Data_encoding - type list_query = { - active: bool ; - inactive: bool ; - } - let list_query :list_query RPC_query.t = + type list_query = {active : bool; inactive : bool} + + let list_query : list_query RPC_query.t = let open RPC_query in - query (fun active inactive -> { active ; inactive }) + query (fun active inactive -> {active; inactive}) |+ flag "active" (fun t -> t.active) |+ flag "inactive" (fun t -> t.inactive) |> seal let list_delegate = RPC_service.get_service - ~description: - "Lists all registered delegates." - ~query: list_query - ~output: (list Signature.Public_key_hash.encoding) + ~description:"Lists all registered delegates." + ~query:list_query + ~output:(list Signature.Public_key_hash.encoding) path let path = RPC_path.(path /: Signature.Public_key_hash.rpc_arg) let info = RPC_service.get_service - ~description: - "Everything about a delegate." - ~query: RPC_query.empty - ~output: info_encoding + ~description:"Everything about a delegate." + ~query:RPC_query.empty + ~output:info_encoding path let balance = RPC_service.get_service ~description: - "Returns the full balance of a given delegate, \ - including the frozen balances." - ~query: RPC_query.empty - ~output: Tez.encoding + "Returns the full balance of a given delegate, including the frozen \ + balances." + ~query:RPC_query.empty + ~output:Tez.encoding RPC_path.(path / "balance") let frozen_balance = RPC_service.get_service ~description: - "Returns the total frozen balances of a given delegate, \ - this includes the frozen deposits, rewards and fees." - ~query: RPC_query.empty - ~output: Tez.encoding + "Returns the total frozen balances of a given delegate, this includes \ + the frozen deposits, rewards and fees." + ~query:RPC_query.empty + ~output:Tez.encoding RPC_path.(path / "frozen_balance") let frozen_balance_by_cycle = RPC_service.get_service ~description: - "Returns the frozen balances of a given delegate, \ - indexed by the cycle by which it will be unfrozen" - ~query: RPC_query.empty - ~output: Delegate.frozen_balance_by_cycle_encoding + "Returns the frozen balances of a given delegate, indexed by the \ + cycle by which it will be unfrozen" + ~query:RPC_query.empty + ~output:Delegate.frozen_balance_by_cycle_encoding RPC_path.(path / "frozen_balance_by_cycle") let staking_balance = RPC_service.get_service ~description: "Returns the total amount of tokens delegated to a given delegate. \ - This includes the balances of all the contracts that delegate \ - to it, but also the balance of the delegate itself and its frozen \ - fees and deposits. The rewards do not count in the delegated balance \ - until they are unfrozen." - ~query: RPC_query.empty - ~output: Tez.encoding + This includes the balances of all the contracts that delegate to it, \ + but also the balance of the delegate itself and its frozen fees and \ + deposits. The rewards do not count in the delegated balance until \ + they are unfrozen." + ~query:RPC_query.empty + ~output:Tez.encoding RPC_path.(path / "staking_balance") let delegated_contracts = RPC_service.get_service ~description: "Returns the list of contracts that delegate to a given delegate." - ~query: RPC_query.empty - ~output: (list Contract_repr.encoding) + ~query:RPC_query.empty + ~output:(list Contract_repr.encoding) RPC_path.(path / "delegated_contracts") let delegated_balance = RPC_service.get_service ~description: - "Returns the balances of all the contracts that delegate to a \ - given delegate. This excludes the delegate's own balance and \ - its frozen balances." - ~query: RPC_query.empty - ~output: Tez.encoding + "Returns the balances of all the contracts that delegate to a given \ + delegate. This excludes the delegate's own balance and its frozen \ + balances." + ~query:RPC_query.empty + ~output:Tez.encoding RPC_path.(path / "delegated_balance") let deactivated = RPC_service.get_service ~description: "Tells whether the delegate is currently tagged as deactivated or not." - ~query: RPC_query.empty - ~output: bool + ~query:RPC_query.empty + ~output:bool RPC_path.(path / "deactivated") let grace_period = RPC_service.get_service ~description: "Returns the cycle by the end of which the delegate might be \ - deactivated if she fails to execute any delegate action. \ - A deactivated delegate might be reactivated \ - (without loosing any rolls) by simply re-registering as a delegate. \ - For deactivated delegates, this value contains the cycle by which \ - they were deactivated." - ~query: RPC_query.empty - ~output: Cycle.encoding + deactivated if she fails to execute any delegate action. A \ + deactivated delegate might be reactivated (without loosing any \ + rolls) by simply re-registering as a delegate. For deactivated \ + delegates, this value contains the cycle by which they were \ + deactivated." + ~query:RPC_query.empty + ~output:Cycle.encoding RPC_path.(path / "grace_period") - end let register () = let open Services_registration in - register0 S.list_delegate begin fun ctxt q () -> - Delegate.list ctxt >>= fun delegates -> - if q.active && q.inactive then - return delegates - else if q.active then - filter_map_s - (fun pkh -> - Delegate.deactivated ctxt pkh >>=? function - | true -> return_none - | false -> return_some pkh) - delegates - else if q.inactive then - filter_map_s - (fun pkh -> - Delegate.deactivated ctxt pkh >>=? function - | false -> return_none - | true -> return_some pkh) - delegates - else - return_nil - end ; - register1 S.info begin fun ctxt pkh () () -> - Delegate.full_balance ctxt pkh >>=? fun balance -> - Delegate.frozen_balance ctxt pkh >>=? fun frozen_balance -> - Delegate.frozen_balance_by_cycle ctxt pkh >>= fun frozen_balance_by_cycle -> - Delegate.staking_balance ctxt pkh >>=? fun staking_balance -> - Delegate.delegated_contracts ctxt pkh >>= fun delegated_contracts -> - Delegate.delegated_balance ctxt pkh >>=? fun delegated_balance -> - Delegate.deactivated ctxt pkh >>=? fun deactivated -> - Delegate.grace_period ctxt pkh >>=? fun grace_period -> - return { - balance ; frozen_balance ; frozen_balance_by_cycle ; - staking_balance ; delegated_contracts ; delegated_balance ; - deactivated ; grace_period - } - end ; - register1 S.balance begin fun ctxt pkh () () -> - Delegate.full_balance ctxt pkh - end ; - register1 S.frozen_balance begin fun ctxt pkh () () -> - Delegate.frozen_balance ctxt pkh - end ; - register1 S.frozen_balance_by_cycle begin fun ctxt pkh () () -> - Delegate.frozen_balance_by_cycle ctxt pkh >>= return - end ; - register1 S.staking_balance begin fun ctxt pkh () () -> - Delegate.staking_balance ctxt pkh - end ; - register1 S.delegated_contracts begin fun ctxt pkh () () -> - Delegate.delegated_contracts ctxt pkh >>= return - end ; - register1 S.delegated_balance begin fun ctxt pkh () () -> - Delegate.delegated_balance ctxt pkh - end ; - register1 S.deactivated begin fun ctxt pkh () () -> - Delegate.deactivated ctxt pkh - end ; - register1 S.grace_period begin fun ctxt pkh () () -> - Delegate.grace_period ctxt pkh - end + register0 S.list_delegate (fun ctxt q () -> + Delegate.list ctxt + >>= fun delegates -> + if q.active && q.inactive then return delegates + else if q.active then + filter_map_s + (fun pkh -> + Delegate.deactivated ctxt pkh + >>=? function true -> return_none | false -> return_some pkh) + delegates + else if q.inactive then + filter_map_s + (fun pkh -> + Delegate.deactivated ctxt pkh + >>=? function false -> return_none | true -> return_some pkh) + delegates + else return_nil) ; + register1 S.info (fun ctxt pkh () () -> + Delegate.full_balance ctxt pkh + >>=? fun balance -> + Delegate.frozen_balance ctxt pkh + >>=? fun frozen_balance -> + Delegate.frozen_balance_by_cycle ctxt pkh + >>= fun frozen_balance_by_cycle -> + Delegate.staking_balance ctxt pkh + >>=? fun staking_balance -> + Delegate.delegated_contracts ctxt pkh + >>= fun delegated_contracts -> + Delegate.delegated_balance ctxt pkh + >>=? fun delegated_balance -> + Delegate.deactivated ctxt pkh + >>=? fun deactivated -> + Delegate.grace_period ctxt pkh + >>=? fun grace_period -> + return + { + balance; + frozen_balance; + frozen_balance_by_cycle; + staking_balance; + delegated_contracts; + delegated_balance; + deactivated; + grace_period; + }) ; + register1 S.balance (fun ctxt pkh () () -> Delegate.full_balance ctxt pkh) ; + register1 S.frozen_balance (fun ctxt pkh () () -> + Delegate.frozen_balance ctxt pkh) ; + register1 S.frozen_balance_by_cycle (fun ctxt pkh () () -> + Delegate.frozen_balance_by_cycle ctxt pkh >>= return) ; + register1 S.staking_balance (fun ctxt pkh () () -> + Delegate.staking_balance ctxt pkh) ; + register1 S.delegated_contracts (fun ctxt pkh () () -> + Delegate.delegated_contracts ctxt pkh >>= return) ; + register1 S.delegated_balance (fun ctxt pkh () () -> + Delegate.delegated_balance ctxt pkh) ; + register1 S.deactivated (fun ctxt pkh () () -> Delegate.deactivated ctxt pkh) ; + register1 S.grace_period (fun ctxt pkh () () -> + Delegate.grace_period ctxt pkh) let list ctxt block ?(active = true) ?(inactive = false) () = - RPC_context.make_call0 S.list_delegate ctxt block { active ; inactive } () + RPC_context.make_call0 S.list_delegate ctxt block {active; inactive} () -let info ctxt block pkh = - RPC_context.make_call1 S.info ctxt block pkh () () +let info ctxt block pkh = RPC_context.make_call1 S.info ctxt block pkh () () let balance ctxt block pkh = RPC_context.make_call1 S.balance ctxt block pkh () () @@ -270,44 +284,43 @@ let grace_period ctxt block pkh = RPC_context.make_call1 S.grace_period ctxt block pkh () () let requested_levels ~default ctxt cycles levels = - match levels, cycles with - | [], [] -> + match (levels, cycles) with + | ([], []) -> return [default] - | levels, cycles -> + | (levels, cycles) -> (* explicitly fail when requested levels or cycle are in the past... or too far in the future... *) let levels = List.sort_uniq Level.compare - (List.concat (List.map (Level.from_raw ctxt) levels :: - List.map (Level.levels_in_cycle ctxt) cycles)) in + (List.concat + ( List.map (Level.from_raw ctxt) levels + :: List.map (Level.levels_in_cycle ctxt) cycles )) + in map_s (fun level -> - let current_level = Level.current ctxt in - if Level.(level <= current_level) then - return (level, None) - else - Baking.earlier_predecessor_timestamp - ctxt level >>=? fun timestamp -> - return (level, Some timestamp)) + let current_level = Level.current ctxt in + if Level.(level <= current_level) then return (level, None) + else + Baking.earlier_predecessor_timestamp ctxt level + >>=? fun timestamp -> return (level, Some timestamp)) levels module Baking_rights = struct - type t = { - level: Raw_level.t ; - delegate: Signature.Public_key_hash.t ; - priority: int ; - timestamp: Timestamp.t option ; + level : Raw_level.t; + delegate : Signature.Public_key_hash.t; + priority : int; + timestamp : Timestamp.t option; } let encoding = let open Data_encoding in conv - (fun { level ; delegate ; priority ; timestamp } -> - (level, delegate, priority, timestamp)) + (fun {level; delegate; priority; timestamp} -> + (level, delegate, priority, timestamp)) (fun (level, delegate, priority, timestamp) -> - { level ; delegate ; priority ; timestamp }) + {level; delegate; priority; timestamp}) (obj4 (req "level" Raw_level.encoding) (req "delegate" Signature.Public_key_hash.encoding) @@ -315,27 +328,26 @@ module Baking_rights = struct (opt "estimated_time" Timestamp.encoding)) module S = struct - open Data_encoding - let custom_root = - RPC_path.(open_root / "helpers" / "baking_rights") + let custom_root = RPC_path.(open_root / "helpers" / "baking_rights") type baking_rights_query = { - levels: Raw_level.t list ; - cycles: Cycle.t list ; - delegates: Signature.Public_key_hash.t list ; - max_priority: int option ; - all: bool ; + levels : Raw_level.t list; + cycles : Cycle.t list; + delegates : Signature.Public_key_hash.t list; + max_priority : int option; + all : bool; } let baking_rights_query = let open RPC_query in query (fun levels cycles delegates max_priority all -> - { levels ; cycles ; delegates ; max_priority ; all }) + {levels; cycles; delegates; max_priority; all}) |+ multi_field "level" Raw_level.rpc_arg (fun t -> t.levels) |+ multi_field "cycle" Cycle.rpc_arg (fun t -> t.cycles) - |+ multi_field "delegate" Signature.Public_key_hash.rpc_arg (fun t -> t.delegates) + |+ multi_field "delegate" Signature.Public_key_hash.rpc_arg (fun t -> + t.delegates) |+ opt_field "max_priority" RPC_arg.int (fun t -> t.max_priority) |+ flag "all" (fun t -> t.all) |> seal @@ -344,112 +356,114 @@ module Baking_rights = struct RPC_service.get_service ~description: "Retrieves the list of delegates allowed to bake a block.\n\ - By default, it gives the best baking priorities for bakers \ - that have at least one opportunity below the 64th priority \ - for the next block.\n\ - Parameters `level` and `cycle` can be used to specify the \ - (valid) level(s) in the past or future at which the baking \ - rights have to be returned. Parameter `delegate` can be \ - used to restrict the results to the given delegates. If \ - parameter `all` is set, all the baking opportunities for \ - each baker at each level are returned, instead of just the \ - first one.\n\ + By default, it gives the best baking priorities for bakers that \ + have at least one opportunity below the 64th priority for the next \ + block.\n\ + Parameters `level` and `cycle` can be used to specify the (valid) \ + level(s) in the past or future at which the baking rights have to \ + be returned. Parameter `delegate` can be used to restrict the \ + results to the given delegates. If parameter `all` is set, all the \ + baking opportunities for each baker at each level are returned, \ + instead of just the first one.\n\ Returns the list of baking slots. Also returns the minimal \ - timestamps that correspond to these slots. The timestamps \ - are omitted for levels in the past, and are only estimates \ - for levels later that the next block, based on the \ - hypothesis that all predecessor blocks were baked at the \ - first priority." - ~query: baking_rights_query - ~output: (list encoding) + timestamps that correspond to these slots. The timestamps are \ + omitted for levels in the past, and are only estimates for levels \ + later that the next block, based on the hypothesis that all \ + predecessor blocks were baked at the first priority." + ~query:baking_rights_query + ~output:(list encoding) custom_root - end let baking_priorities ctxt max_prio (level, pred_timestamp) = - Baking.baking_priorities ctxt level >>=? fun contract_list -> + Baking.baking_priorities ctxt level + >>=? fun contract_list -> let rec loop l acc priority = - if Compare.Int.(priority >= max_prio) then - return (List.rev acc) + if Compare.Int.(priority > max_prio) then return (List.rev acc) else - let Misc.LCons (pk, next) = l in + let (Misc.LCons (pk, next)) = l in let delegate = Signature.Public_key.hash pk in - begin - match pred_timestamp with - | None -> return_none - | Some pred_timestamp -> - Baking.minimal_time ctxt priority pred_timestamp >>=? fun t -> - return_some t - end>>=? fun timestamp -> + ( match pred_timestamp with + | None -> + return_none + | Some pred_timestamp -> + Baking.minimal_time ctxt priority pred_timestamp + >>=? fun t -> return_some t ) + >>=? fun timestamp -> let acc = - { level = level.level ; delegate ; priority ; timestamp } :: acc in - next () >>=? fun l -> - loop l acc (priority+1) in + {level = level.level; delegate; priority; timestamp} :: acc + in + next () >>=? fun l -> loop l acc (priority + 1) + in loop contract_list [] 0 let remove_duplicated_delegates rights = - List.rev @@ fst @@ - List.fold_left - (fun (acc, previous) r -> - if Signature.Public_key_hash.Set.mem r.delegate previous then - (acc, previous) - else - (r :: acc, - Signature.Public_key_hash.Set.add r.delegate previous)) - ([], Signature.Public_key_hash.Set.empty) - rights + List.rev @@ fst + @@ List.fold_left + (fun (acc, previous) r -> + if Signature.Public_key_hash.Set.mem r.delegate previous then + (acc, previous) + else + (r :: acc, Signature.Public_key_hash.Set.add r.delegate previous)) + ([], Signature.Public_key_hash.Set.empty) + rights let register () = let open Services_registration in - register0 S.baking_rights begin fun ctxt q () -> - requested_levels - ~default: - (Level.succ ctxt (Level.current ctxt), Some (Timestamp.current ctxt)) - ctxt q.cycles q.levels >>=? fun levels -> - let max_priority = - match q.max_priority with - | None -> 64 - | Some max -> max in - map_s (baking_priorities ctxt max_priority) levels >>=? fun rights -> - let rights = - if q.all then - rights - else - List.map remove_duplicated_delegates rights in - let rights = List.concat rights in - match q.delegates with - | [] -> return rights - | _ :: _ as delegates -> - let is_requested p = - List.exists (Signature.Public_key_hash.equal p.delegate) delegates in - return (List.filter is_requested rights) - end + register0 S.baking_rights (fun ctxt q () -> + requested_levels + ~default: + ( Level.succ ctxt (Level.current ctxt), + Some (Timestamp.current ctxt) ) + ctxt + q.cycles + q.levels + >>=? fun levels -> + let max_priority = + match q.max_priority with None -> 64 | Some max -> max + in + map_s (baking_priorities ctxt max_priority) levels + >>=? fun rights -> + let rights = + if q.all then rights else List.map remove_duplicated_delegates rights + in + let rights = List.concat rights in + match q.delegates with + | [] -> + return rights + | _ :: _ as delegates -> + let is_requested p = + List.exists + (Signature.Public_key_hash.equal p.delegate) + delegates + in + return (List.filter is_requested rights)) - let get ctxt - ?(levels = []) ?(cycles = []) ?(delegates = []) ?(all = false) + let get ctxt ?(levels = []) ?(cycles = []) ?(delegates = []) ?(all = false) ?max_priority block = - RPC_context.make_call0 S.baking_rights ctxt block - { levels ; cycles ; delegates ; max_priority ; all } + RPC_context.make_call0 + S.baking_rights + ctxt + block + {levels; cycles; delegates; max_priority; all} () - end module Endorsing_rights = struct - type t = { - level: Raw_level.t ; - delegate: Signature.Public_key_hash.t ; - slots: int list ; - estimated_time: Time.t option ; + level : Raw_level.t; + delegate : Signature.Public_key_hash.t; + slots : int list; + estimated_time : Time.t option; } let encoding = let open Data_encoding in conv - (fun { level ; delegate ; slots ; estimated_time } -> - (level, delegate, slots, estimated_time)) + (fun {level; delegate; slots; estimated_time} -> + (level, delegate, slots, estimated_time)) (fun (level, delegate, slots, estimated_time) -> - { level ; delegate ; slots ; estimated_time }) + {level; delegate; slots; estimated_time}) (obj4 (req "level" Raw_level.encoding) (req "delegate" Signature.Public_key_hash.encoding) @@ -457,94 +471,97 @@ module Endorsing_rights = struct (opt "estimated_time" Timestamp.encoding)) module S = struct - open Data_encoding - let custom_root = - RPC_path.(open_root / "helpers" / "endorsing_rights") + let custom_root = RPC_path.(open_root / "helpers" / "endorsing_rights") type endorsing_rights_query = { - levels: Raw_level.t list ; - cycles: Cycle.t list ; - delegates: Signature.Public_key_hash.t list ; + levels : Raw_level.t list; + cycles : Cycle.t list; + delegates : Signature.Public_key_hash.t list; } let endorsing_rights_query = let open RPC_query in - query (fun levels cycles delegates -> - { levels ; cycles ; delegates }) + query (fun levels cycles delegates -> {levels; cycles; delegates}) |+ multi_field "level" Raw_level.rpc_arg (fun t -> t.levels) |+ multi_field "cycle" Cycle.rpc_arg (fun t -> t.cycles) - |+ multi_field "delegate" Signature.Public_key_hash.rpc_arg (fun t -> t.delegates) + |+ multi_field "delegate" Signature.Public_key_hash.rpc_arg (fun t -> + t.delegates) |> seal let endorsing_rights = RPC_service.get_service ~description: "Retrieves the delegates allowed to endorse a block.\n\ - By default, it gives the endorsement slots for delegates that \ - have at least one in the next block.\n\ - Parameters `level` and `cycle` can be used to specify the \ - (valid) level(s) in the past or future at which the \ - endorsement rights have to be returned. Parameter \ - `delegate` can be used to restrict the results to the given \ - delegates.\n\ - Returns the list of endorsement slots. Also returns the \ - minimal timestamps that correspond to these slots. The \ - timestamps are omitted for levels in the past, and are only \ - estimates for levels later that the next block, based on \ - the hypothesis that all predecessor blocks were baked at \ - the first priority." - ~query: endorsing_rights_query - ~output: (list encoding) + By default, it gives the endorsement slots for delegates that have \ + at least one in the next block.\n\ + Parameters `level` and `cycle` can be used to specify the (valid) \ + level(s) in the past or future at which the endorsement rights \ + have to be returned. Parameter `delegate` can be used to restrict \ + the results to the given delegates.\n\ + Returns the list of endorsement slots. Also returns the minimal \ + timestamps that correspond to these slots. The timestamps are \ + omitted for levels in the past, and are only estimates for levels \ + later that the next block, based on the hypothesis that all \ + predecessor blocks were baked at the first priority." + ~query:endorsing_rights_query + ~output:(list encoding) custom_root - end let endorsement_slots ctxt (level, estimated_time) = - Baking.endorsement_rights ctxt level >>=? fun rights -> + Baking.endorsement_rights ctxt level + >>=? fun rights -> return (Signature.Public_key_hash.Map.fold - (fun delegate (_, slots, _) acc -> { - level = level.level ; delegate ; slots ; estimated_time - } :: acc) - rights []) + (fun delegate (_, slots, _) acc -> + {level = level.level; delegate; slots; estimated_time} :: acc) + rights + []) let register () = let open Services_registration in - register0 S.endorsing_rights begin fun ctxt q () -> - requested_levels - ~default: (Level.current ctxt, Some (Timestamp.current ctxt)) - ctxt q.cycles q.levels >>=? fun levels -> - map_s (endorsement_slots ctxt) levels >>=? fun rights -> - let rights = List.concat rights in - match q.delegates with - | [] -> return rights - | _ :: _ as delegates -> - let is_requested p = - List.exists (Signature.Public_key_hash.equal p.delegate) delegates in - return (List.filter is_requested rights) - end + register0 S.endorsing_rights (fun ctxt q () -> + requested_levels + ~default:(Level.current ctxt, Some (Timestamp.current ctxt)) + ctxt + q.cycles + q.levels + >>=? fun levels -> + map_s (endorsement_slots ctxt) levels + >>=? fun rights -> + let rights = List.concat rights in + match q.delegates with + | [] -> + return rights + | _ :: _ as delegates -> + let is_requested p = + List.exists + (Signature.Public_key_hash.equal p.delegate) + delegates + in + return (List.filter is_requested rights)) - let get ctxt - ?(levels = []) ?(cycles = []) ?(delegates = []) block = - RPC_context.make_call0 S.endorsing_rights ctxt block - { levels ; cycles ; delegates } + let get ctxt ?(levels = []) ?(cycles = []) ?(delegates = []) block = + RPC_context.make_call0 + S.endorsing_rights + ctxt + block + {levels; cycles; delegates} () - end module Endorsing_power = struct - let endorsing_power ctxt (operation, chain_id) = - let Operation_data data = operation.protocol_data in + let (Operation_data data) = operation.protocol_data in match data.contents with - | Single Endorsement _ -> - Baking.check_endorsement_rights ctxt chain_id { - shell = operation.shell ; - protocol_data = data ; - } >>=? fun (_, slots, _) -> - return (List.length slots) + | Single (Endorsement _) -> + Baking.check_endorsement_rights + ctxt + chain_id + {shell = operation.shell; protocol_data = data} + >>=? fun (_, slots, _) -> return (List.length slots) | _ -> failwith "Operation is not an endorsement" @@ -552,101 +569,98 @@ module Endorsing_power = struct let endorsing_power = let open Data_encoding in RPC_service.post_service - ~description:"Get the endorsing power of an endorsement, that is, \ - the number of slots that the endorser has" - ~query: RPC_query.empty - ~input: (obj2 - (req "endorsement_operation" Operation.encoding) - (req "chain_id" Chain_id.encoding)) - ~output: int31 + ~description: + "Get the endorsing power of an endorsement, that is, the number of \ + slots that the endorser has" + ~query:RPC_query.empty + ~input: + (obj2 + (req "endorsement_operation" Operation.encoding) + (req "chain_id" Chain_id.encoding)) + ~output:int31 RPC_path.(open_root / "endorsing_power") end let register () = let open Services_registration in - register0 S.endorsing_power begin fun ctxt () (op, chain_id) -> - endorsing_power ctxt (op, chain_id) - end + register0 S.endorsing_power (fun ctxt () (op, chain_id) -> + endorsing_power ctxt (op, chain_id)) let get ctxt block op chain_id = RPC_context.make_call0 S.endorsing_power ctxt block () (op, chain_id) - end module Required_endorsements = struct - let required_endorsements ctxt block_delay = return (Baking.minimum_allowed_endorsements ctxt ~block_delay) module S = struct - - type t = { block_delay : Period.t } + type t = {block_delay : Period.t} let required_endorsements_query = let open RPC_query in - query (fun block_delay -> { block_delay }) - |+ field "block_delay" Period.rpc_arg Period.zero (fun t -> t.block_delay) + query (fun block_delay -> {block_delay}) + |+ field "block_delay" Period.rpc_arg Period.zero (fun t -> + t.block_delay) |> seal let required_endorsements = let open Data_encoding in RPC_service.get_service - ~description:"Minimum number of endorsements for a block to be \ - valid, given a delay of the block's timestamp with \ - respect to the minimum time to bake at the \ - block's priority" - ~query: required_endorsements_query - ~output: int31 + ~description: + "Minimum number of endorsements for a block to be valid, given a \ + delay of the block's timestamp with respect to the minimum time to \ + bake at the block's priority" + ~query:required_endorsements_query + ~output:int31 RPC_path.(open_root / "required_endorsements") end let register () = let open Services_registration in - register0 S.required_endorsements begin fun ctxt ({ block_delay }) () -> - required_endorsements ctxt block_delay - end + register0 S.required_endorsements (fun ctxt {block_delay} () -> + required_endorsements ctxt block_delay) let get ctxt block block_delay = - RPC_context.make_call0 S.required_endorsements ctxt block { block_delay } () - + RPC_context.make_call0 S.required_endorsements ctxt block {block_delay} () end module Minimal_valid_time = struct - let minimal_valid_time ctxt ~priority ~endorsing_power = - Baking.minimal_valid_time ctxt - ~priority ~endorsing_power + Baking.minimal_valid_time ctxt ~priority ~endorsing_power module S = struct - - type t = { priority : int ; - endorsing_power : int } + type t = {priority : int; endorsing_power : int} let minimal_valid_time_query = let open RPC_query in - query (fun priority endorsing_power -> - { priority ; endorsing_power }) + query (fun priority endorsing_power -> {priority; endorsing_power}) |+ field "priority" RPC_arg.int 0 (fun t -> t.priority) |+ field "endorsing_power" RPC_arg.int 0 (fun t -> t.endorsing_power) |> seal let minimal_valid_time = RPC_service.get_service - ~description: "Minimal valid time for a block given a priority \ - and an endorsing power." - ~query: minimal_valid_time_query - ~output: Time.encoding + ~description: + "Minimal valid time for a block given a priority and an endorsing \ + power." + ~query:minimal_valid_time_query + ~output:Time.encoding RPC_path.(open_root / "minimal_valid_time") end let register () = let open Services_registration in - register0 S.minimal_valid_time begin fun ctxt { priority ; endorsing_power } () -> - minimal_valid_time ctxt ~priority ~endorsing_power - end + register0 S.minimal_valid_time (fun ctxt {priority; endorsing_power} () -> + minimal_valid_time ctxt ~priority ~endorsing_power) let get ctxt block priority endorsing_power = - RPC_context.make_call0 S.minimal_valid_time ctxt block { priority ; endorsing_power } () + RPC_context.make_call0 + S.minimal_valid_time + ctxt + block + {priority; endorsing_power} + () end let register () = @@ -658,17 +672,20 @@ let register () = Minimal_valid_time.register () let endorsement_rights ctxt level = - Endorsing_rights.endorsement_slots ctxt (level, None) >>=? fun l -> - return (List.map (fun { Endorsing_rights.delegate ; _ } -> delegate) l) + Endorsing_rights.endorsement_slots ctxt (level, None) + >>=? fun l -> + return (List.map (fun {Endorsing_rights.delegate; _} -> delegate) l) let baking_rights ctxt max_priority = let max = match max_priority with None -> 64 | Some m -> m in let level = Level.current ctxt in - Baking_rights.baking_priorities ctxt max (level, None) >>=? fun l -> - return (level.level, - List.map - (fun { Baking_rights.delegate ; timestamp ; _ } -> - (delegate, timestamp)) l) + Baking_rights.baking_priorities ctxt max (level, None) + >>=? fun l -> + return + ( level.level, + List.map + (fun {Baking_rights.delegate; timestamp; _} -> (delegate, timestamp)) + l ) let endorsing_power ctxt operation = Endorsing_power.endorsing_power ctxt operation diff --git a/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.mli b/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.mli index 74b282b98..d2f7b5e7f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/delegate_services.mli @@ -25,78 +25,87 @@ open Alpha_context -val list: - 'a #RPC_context.simple -> 'a -> +val list : + 'a #RPC_context.simple -> + 'a -> ?active:bool -> ?inactive:bool -> - unit -> Signature.Public_key_hash.t list shell_tzresult Lwt.t + unit -> + Signature.Public_key_hash.t list shell_tzresult Lwt.t type info = { - balance: Tez.t ; - frozen_balance: Tez.t ; - frozen_balance_by_cycle: Delegate.frozen_balance Cycle.Map.t ; - staking_balance: Tez.t ; - delegated_contracts: Contract_repr.t list ; - delegated_balance: Tez.t ; - deactivated: bool ; - grace_period: Cycle.t ; + balance : Tez.t; + frozen_balance : Tez.t; + frozen_balance_by_cycle : Delegate.frozen_balance Cycle.Map.t; + staking_balance : Tez.t; + delegated_contracts : Contract_repr.t list; + delegated_balance : Tez.t; + deactivated : bool; + grace_period : Cycle.t; } -val info_encoding: info Data_encoding.t +val info_encoding : info Data_encoding.t -val info: - 'a #RPC_context.simple -> 'a -> +val info : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> info shell_tzresult Lwt.t -val balance: - 'a #RPC_context.simple -> 'a -> +val balance : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> Tez.t shell_tzresult Lwt.t -val frozen_balance: - 'a #RPC_context.simple -> 'a -> +val frozen_balance : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> Tez.t shell_tzresult Lwt.t -val frozen_balance_by_cycle: - 'a #RPC_context.simple -> 'a -> +val frozen_balance_by_cycle : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> Delegate.frozen_balance Cycle.Map.t shell_tzresult Lwt.t -val staking_balance: - 'a #RPC_context.simple -> 'a -> +val staking_balance : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> Tez.t shell_tzresult Lwt.t -val delegated_contracts: - 'a #RPC_context.simple -> 'a -> +val delegated_contracts : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> Contract_repr.t list shell_tzresult Lwt.t -val delegated_balance: - 'a #RPC_context.simple -> 'a -> +val delegated_balance : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> Tez.t shell_tzresult Lwt.t -val deactivated: - 'a #RPC_context.simple -> 'a -> +val deactivated : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> bool shell_tzresult Lwt.t -val grace_period: - 'a #RPC_context.simple -> 'a -> +val grace_period : + 'a #RPC_context.simple -> + 'a -> Signature.Public_key_hash.t -> Cycle.t shell_tzresult Lwt.t - module Baking_rights : sig - type t = { - level: Raw_level.t ; - delegate: Signature.Public_key_hash.t ; - priority: int ; - timestamp: Timestamp.t option ; + level : Raw_level.t; + delegate : Signature.Public_key_hash.t; + priority : int; + timestamp : Timestamp.t option; } (** Retrieves the list of delegates allowed to bake a block. @@ -117,24 +126,23 @@ module Baking_rights : sig omitted for levels in the past, and are only estimates for levels later that the next block, based on the hypothesis that all predecessor blocks were baked at the first priority. *) - val get: + val get : 'a #RPC_context.simple -> - ?levels: Raw_level.t list -> - ?cycles: Cycle.t list -> - ?delegates: Signature.public_key_hash list -> - ?all: bool -> - ?max_priority: int -> - 'a -> t list shell_tzresult Lwt.t - + ?levels:Raw_level.t list -> + ?cycles:Cycle.t list -> + ?delegates:Signature.public_key_hash list -> + ?all:bool -> + ?max_priority:int -> + 'a -> + t list shell_tzresult Lwt.t end module Endorsing_rights : sig - type t = { - level: Raw_level.t ; - delegate: Signature.Public_key_hash.t ; - slots: int list ; - estimated_time: Timestamp.t option ; + level : Raw_level.t; + delegate : Signature.Public_key_hash.t; + slots : int list; + estimated_time : Timestamp.t option; } (** Retrieves the delegates allowed to endorse a block. @@ -153,66 +161,51 @@ module Endorsing_rights : sig estimates for levels later that the next block, based on the hypothesis that all predecessor blocks were baked at the first priority. *) - val get: + val get : 'a #RPC_context.simple -> - ?levels: Raw_level.t list -> - ?cycles: Cycle.t list -> - ?delegates: Signature.public_key_hash list -> - 'a -> t list shell_tzresult Lwt.t - + ?levels:Raw_level.t list -> + ?cycles:Cycle.t list -> + ?delegates:Signature.public_key_hash list -> + 'a -> + t list shell_tzresult Lwt.t end module Endorsing_power : sig - - val get: - 'a #RPC_context.simple -> 'a -> + val get : + 'a #RPC_context.simple -> + 'a -> Alpha_context.packed_operation -> Chain_id.t -> int shell_tzresult Lwt.t - end module Required_endorsements : sig - - val get: - 'a #RPC_context.simple -> 'a -> - Period.t -> int shell_tzresult Lwt.t - + val get : + 'a #RPC_context.simple -> 'a -> Period.t -> int shell_tzresult Lwt.t end module Minimal_valid_time : sig - - val get: - 'a #RPC_context.simple -> 'a -> - int -> int -> Time.t shell_tzresult Lwt.t - + val get : + 'a #RPC_context.simple -> 'a -> int -> int -> Time.t shell_tzresult Lwt.t end (* temporary export for deprecated unit test *) -val endorsement_rights: - Alpha_context.t -> - Level.t -> - public_key_hash list tzresult Lwt.t +val endorsement_rights : + Alpha_context.t -> Level.t -> public_key_hash list tzresult Lwt.t -val baking_rights: +val baking_rights : Alpha_context.t -> int option -> (Raw_level.t * (public_key_hash * Time.t option) list) tzresult Lwt.t -val endorsing_power: +val endorsing_power : Alpha_context.t -> - (Alpha_context.packed_operation * Chain_id.t) -> + Alpha_context.packed_operation * Chain_id.t -> int tzresult Lwt.t -val required_endorsements: - Alpha_context.t -> - Alpha_context.Period.t -> - int tzresult Lwt.t +val required_endorsements : + Alpha_context.t -> Alpha_context.Period.t -> int tzresult Lwt.t -val minimal_valid_time: - Alpha_context.t -> - int -> - int -> - Time.t tzresult Lwt.t +val minimal_valid_time : Alpha_context.t -> int -> int -> Time.t tzresult Lwt.t -val register: unit -> unit +val register : unit -> unit diff --git a/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.ml index c8d5e878b..0515b47b6 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.ml @@ -31,92 +31,101 @@ type balance = let balance_encoding = let open Data_encoding in - def "operation_metadata.alpha.balance" @@ - union - [ case (Tag 0) - ~title:"Contract" - (obj2 - (req "kind" (constant "contract")) - (req "contract" Contract_repr.encoding)) - (function Contract c -> Some ((), c) | _ -> None ) - (fun ((), c) -> (Contract c)) ; - case (Tag 1) - ~title:"Rewards" - (obj4 - (req "kind" (constant "freezer")) - (req "category" (constant "rewards")) - (req "delegate" Signature.Public_key_hash.encoding) - (req "cycle" Cycle_repr.encoding)) - (function Rewards (d, l) -> Some ((), (), d, l) | _ -> None) - (fun ((), (), d, l) -> Rewards (d, l)) ; - case (Tag 2) - ~title:"Fees" - (obj4 - (req "kind" (constant "freezer")) - (req "category" (constant "fees")) - (req "delegate" Signature.Public_key_hash.encoding) - (req "cycle" Cycle_repr.encoding)) - (function Fees (d, l) -> Some ((), (), d, l) | _ -> None) - (fun ((), (), d, l) -> Fees (d, l)) ; - case (Tag 3) - ~title:"Deposits" - (obj4 - (req "kind" (constant "freezer")) - (req "category" (constant "deposits")) - (req "delegate" Signature.Public_key_hash.encoding) - (req "cycle" Cycle_repr.encoding)) - (function Deposits (d, l) -> Some ((), (), d, l) | _ -> None) - (fun ((), (), d, l) -> Deposits (d, l)) ] + def "operation_metadata.alpha.balance" + @@ union + [ case + (Tag 0) + ~title:"Contract" + (obj2 + (req "kind" (constant "contract")) + (req "contract" Contract_repr.encoding)) + (function Contract c -> Some ((), c) | _ -> None) + (fun ((), c) -> Contract c); + case + (Tag 1) + ~title:"Rewards" + (obj4 + (req "kind" (constant "freezer")) + (req "category" (constant "rewards")) + (req "delegate" Signature.Public_key_hash.encoding) + (req "cycle" Cycle_repr.encoding)) + (function Rewards (d, l) -> Some ((), (), d, l) | _ -> None) + (fun ((), (), d, l) -> Rewards (d, l)); + case + (Tag 2) + ~title:"Fees" + (obj4 + (req "kind" (constant "freezer")) + (req "category" (constant "fees")) + (req "delegate" Signature.Public_key_hash.encoding) + (req "cycle" Cycle_repr.encoding)) + (function Fees (d, l) -> Some ((), (), d, l) | _ -> None) + (fun ((), (), d, l) -> Fees (d, l)); + case + (Tag 3) + ~title:"Deposits" + (obj4 + (req "kind" (constant "freezer")) + (req "category" (constant "deposits")) + (req "delegate" Signature.Public_key_hash.encoding) + (req "cycle" Cycle_repr.encoding)) + (function Deposits (d, l) -> Some ((), (), d, l) | _ -> None) + (fun ((), (), d, l) -> Deposits (d, l)) ] -type balance_update = - | Debited of Tez_repr.t - | Credited of Tez_repr.t +type balance_update = Debited of Tez_repr.t | Credited of Tez_repr.t let balance_update_encoding = let open Data_encoding in - def "operation_metadata.alpha.balance_update" @@ - obj1 - (req "change" - (conv - (function - | Credited v -> Tez_repr.to_mutez v - | Debited v -> Int64.neg (Tez_repr.to_mutez v)) - (Json.wrap_error @@ - fun v -> - if Compare.Int64.(v < 0L) then - match Tez_repr.of_mutez (Int64.neg v) with - | Some v -> Debited v - | None -> failwith "Qty.of_mutez" - else - match Tez_repr.of_mutez v with - | Some v -> Credited v - | None -> failwith "Qty.of_mutez") - int64)) + def "operation_metadata.alpha.balance_update" + @@ obj1 + (req + "change" + (conv + (function + | Credited v -> + Tez_repr.to_mutez v + | Debited v -> + Int64.neg (Tez_repr.to_mutez v)) + ( Json.wrap_error + @@ fun v -> + if Compare.Int64.(v < 0L) then + match Tez_repr.of_mutez (Int64.neg v) with + | Some v -> + Debited v + | None -> + failwith "Qty.of_mutez" + else + match Tez_repr.of_mutez v with + | Some v -> + Credited v + | None -> + failwith "Qty.of_mutez" ) + int64)) type balance_updates = (balance * balance_update) list let balance_updates_encoding = let open Data_encoding in - def "operation_metadata.alpha.balance_updates" @@ - list (merge_objs balance_encoding balance_update_encoding) + def "operation_metadata.alpha.balance_updates" + @@ list (merge_objs balance_encoding balance_update_encoding) let cleanup_balance_updates balance_updates = List.filter (fun (_, (Credited update | Debited update)) -> - not (Tez_repr.equal update Tez_repr.zero)) + not (Tez_repr.equal update Tez_repr.zero)) balance_updates type frozen_balance = { - deposit : Tez_repr.t ; - fees : Tez_repr.t ; - rewards : Tez_repr.t ; + deposit : Tez_repr.t; + fees : Tez_repr.t; + rewards : Tez_repr.t; } let frozen_balance_encoding = let open Data_encoding in conv - (fun { deposit ; fees ; rewards } -> (deposit, fees, rewards)) - (fun (deposit, fees, rewards) -> { deposit ; fees ; rewards }) + (fun {deposit; fees; rewards} -> (deposit, fees, rewards)) + (fun (deposit, fees, rewards) -> {deposit; fees; rewards}) (obj3 (req "deposit" Tez_repr.encoding) (req "fees" Tez_repr.encoding) @@ -127,10 +136,13 @@ type error += | Active_delegate (* `Temporary *) | Current_delegate (* `Temporary *) | Empty_delegate_account of Signature.Public_key_hash.t (* `Temporary *) - | Balance_too_low_for_deposit of - { delegate : Signature.Public_key_hash.t ; - deposit : Tez_repr.t ; - balance : Tez_repr.t } (* `Temporary *) + | Balance_too_low_for_deposit of { + delegate : Signature.Public_key_hash.t; + deposit : Tez_repr.t; + balance : Tez_repr.t; + } + +(* `Temporary *) let () = register_error_kind @@ -139,8 +151,11 @@ let () = ~title:"Forbidden delegate deletion" ~description:"Tried to unregister a delegate" ~pp:(fun ppf delegate -> - Format.fprintf ppf "Delegate deletion is forbidden (%a)" - Signature.Public_key_hash.pp delegate) + Format.fprintf + ppf + "Delegate deletion is forbidden (%a)" + Signature.Public_key_hash.pp + delegate) Data_encoding.(obj1 (req "delegate" Signature.Public_key_hash.encoding)) (function No_deletion c -> Some c | _ -> None) (fun c -> No_deletion c) ; @@ -150,8 +165,7 @@ let () = ~title:"Delegate already active" ~description:"Useless delegate reactivation" ~pp:(fun ppf () -> - Format.fprintf ppf - "The delegate is still active, no need to refresh it") + Format.fprintf ppf "The delegate is still active, no need to refresh it") Data_encoding.empty (function Active_delegate -> Some () | _ -> None) (fun () -> Active_delegate) ; @@ -161,8 +175,9 @@ let () = ~title:"Unchanged delegated" ~description:"Contract already delegated to the given delegate" ~pp:(fun ppf () -> - Format.fprintf ppf - "The contract is already delegated to the same delegate") + Format.fprintf + ppf + "The contract is already delegated to the same delegate") Data_encoding.empty (function Current_delegate -> Some () | _ -> None) (fun () -> Current_delegate) ; @@ -170,12 +185,15 @@ let () = `Permanent ~id:"delegate.empty_delegate_account" ~title:"Empty delegate account" - ~description:"Cannot register a delegate when its implicit account is empty" + ~description: + "Cannot register a delegate when its implicit account is empty" ~pp:(fun ppf delegate -> - Format.fprintf ppf - "Delegate registration is forbidden when the delegate - implicit account is empty (%a)" - Signature.Public_key_hash.pp delegate) + Format.fprintf + ppf + "Delegate registration is forbidden when the delegate\n\ + \ implicit account is empty (%a)" + Signature.Public_key_hash.pp + delegate) Data_encoding.(obj1 (req "delegate" Signature.Public_key_hash.encoding)) (function Empty_delegate_account c -> Some c | _ -> None) (fun c -> Empty_delegate_account c) ; @@ -185,392 +203,474 @@ let () = ~title:"Balance too low for deposit" ~description:"Cannot freeze deposit when the balance is too low" ~pp:(fun ppf (delegate, balance, deposit) -> - Format.fprintf ppf - "Delegate %a has a too low balance (%a) to deposit %a" - Signature.Public_key_hash.pp delegate - Tez_repr.pp balance - Tez_repr.pp deposit) - Data_encoding. - (obj3 - (req "delegate" Signature.Public_key_hash.encoding) - (req "balance" Tez_repr.encoding) - (req "deposit" Tez_repr.encoding)) - (function Balance_too_low_for_deposit { delegate ; balance ; deposit } -> - Some (delegate, balance, deposit) | _ -> None) - (fun (delegate, balance, deposit) -> Balance_too_low_for_deposit { delegate ; balance ; deposit } ) + Format.fprintf + ppf + "Delegate %a has a too low balance (%a) to deposit %a" + Signature.Public_key_hash.pp + delegate + Tez_repr.pp + balance + Tez_repr.pp + deposit) + Data_encoding.( + obj3 + (req "delegate" Signature.Public_key_hash.encoding) + (req "balance" Tez_repr.encoding) + (req "deposit" Tez_repr.encoding)) + (function + | Balance_too_low_for_deposit {delegate; balance; deposit} -> + Some (delegate, balance, deposit) + | _ -> + None) + (fun (delegate, balance, deposit) -> + Balance_too_low_for_deposit {delegate; balance; deposit}) let link c contract delegate = - Storage.Contract.Balance.get c contract >>=? fun balance -> - Roll_storage.Delegate.add_amount c delegate balance >>=? fun c -> - Storage.Contract.Delegated.add (c, Contract_repr.implicit_contract delegate) contract >>= fun c -> - return c + Storage.Contract.Balance.get c contract + >>=? fun balance -> + Roll_storage.Delegate.add_amount c delegate balance + >>=? fun c -> + Storage.Contract.Delegated.add + (c, Contract_repr.implicit_contract delegate) + contract + >>= fun c -> return c let unlink c contract = - Storage.Contract.Balance.get c contract >>=? fun balance -> - Storage.Contract.Delegate.get_option c contract >>=? function - | None -> return c + Storage.Contract.Balance.get c contract + >>=? fun balance -> + Storage.Contract.Delegate.get_option c contract + >>=? function + | None -> + return c | Some delegate -> (* Removes the balance of the contract from the delegate *) - Roll_storage.Delegate.remove_amount c delegate balance >>=? fun c -> - Storage.Contract.Delegated.del (c, Contract_repr.implicit_contract delegate) contract >>= fun c -> - return c + Roll_storage.Delegate.remove_amount c delegate balance + >>=? fun c -> + Storage.Contract.Delegated.del + (c, Contract_repr.implicit_contract delegate) + contract + >>= fun c -> return c let known c delegate = Storage.Contract.Manager.get_option - c (Contract_repr.implicit_contract delegate) >>=? function - | None | Some (Manager_repr.Hash _) -> return_false - | Some (Manager_repr.Public_key _) -> return_true + c + (Contract_repr.implicit_contract delegate) + >>=? function + | None | Some (Manager_repr.Hash _) -> + return_false + | Some (Manager_repr.Public_key _) -> + return_true (* A delegate is registered if its "implicit account" delegates to itself. *) let registered c delegate = Storage.Contract.Delegate.get_option - c (Contract_repr.implicit_contract delegate) >>=? function + c + (Contract_repr.implicit_contract delegate) + >>=? function | Some current_delegate -> return @@ Signature.Public_key_hash.equal delegate current_delegate | None -> return_false let init ctxt contract delegate = - known ctxt delegate >>=? fun known_delegate -> - fail_unless - known_delegate - (Roll_storage.Unregistered_delegate delegate) >>=? fun () -> - registered ctxt delegate >>=? fun is_registered -> - fail_unless - is_registered - (Roll_storage.Unregistered_delegate delegate) >>=? fun () -> - Storage.Contract.Delegate.init ctxt contract delegate >>=? fun ctxt -> - link ctxt contract delegate + known ctxt delegate + >>=? fun known_delegate -> + fail_unless known_delegate (Roll_storage.Unregistered_delegate delegate) + >>=? fun () -> + registered ctxt delegate + >>=? fun is_registered -> + fail_unless is_registered (Roll_storage.Unregistered_delegate delegate) + >>=? fun () -> + Storage.Contract.Delegate.init ctxt contract delegate + >>=? fun ctxt -> link ctxt contract delegate let get = Roll_storage.get_contract_delegate let set c contract delegate = match delegate with - | None -> begin + | None -> ( let delete () = - unlink c contract >>=? fun c -> - Storage.Contract.Delegate.remove c contract >>= fun c -> - return c in + unlink c contract + >>=? fun c -> + Storage.Contract.Delegate.remove c contract >>= fun c -> return c + in match Contract_repr.is_implicit contract with | Some pkh -> (* check if contract is a registered delegate *) - registered c pkh >>=? fun is_registered -> - if is_registered then - fail (No_deletion pkh) - else - delete () - | None -> delete () - end + registered c pkh + >>=? fun is_registered -> + if is_registered then fail (No_deletion pkh) else delete () + | None -> + delete () ) | Some delegate -> - known c delegate >>=? fun known_delegate -> - registered c delegate >>=? fun registered_delegate -> + known c delegate + >>=? fun known_delegate -> + registered c delegate + >>=? fun registered_delegate -> let self_delegation = match Contract_repr.is_implicit contract with - | Some pkh -> Signature.Public_key_hash.equal pkh delegate - | None -> false in - if not known_delegate || not (registered_delegate || self_delegation) then - fail (Roll_storage.Unregistered_delegate delegate) + | Some pkh -> + Signature.Public_key_hash.equal pkh delegate + | None -> + false + in + if (not known_delegate) || not (registered_delegate || self_delegation) + then fail (Roll_storage.Unregistered_delegate delegate) else - begin - Storage.Contract.Delegate.get_option c contract >>=? function - | Some current_delegate - when Signature.Public_key_hash.equal delegate current_delegate -> - if self_delegation then - Roll_storage.Delegate.is_inactive c delegate >>=? function - | true -> return_unit - | false -> fail Active_delegate - else - fail Current_delegate - | None | Some _ -> return_unit - end >>=? fun () -> + Storage.Contract.Delegate.get_option c contract + >>=? (function + | Some current_delegate + when Signature.Public_key_hash.equal delegate current_delegate + -> + if self_delegation then + Roll_storage.Delegate.is_inactive c delegate + >>=? function + | true -> return_unit | false -> fail Active_delegate + else fail Current_delegate + | None | Some _ -> + return_unit) + >>=? fun () -> (* check if contract is a registered delegate *) - begin - match Contract_repr.is_implicit contract with - | Some pkh -> - registered c pkh >>=? fun is_registered -> - (* allow self-delegation to re-activate *) - if not self_delegation && is_registered then - fail (No_deletion pkh) - else - return_unit - | None -> - return_unit - end >>=? fun () -> - Storage.Contract.Balance.mem c contract >>= fun exists -> + ( match Contract_repr.is_implicit contract with + | Some pkh -> + registered c pkh + >>=? fun is_registered -> + (* allow self-delegation to re-activate *) + if (not self_delegation) && is_registered then + fail (No_deletion pkh) + else return_unit + | None -> + return_unit ) + >>=? fun () -> + Storage.Contract.Balance.mem c contract + >>= fun exists -> fail_when (self_delegation && not exists) - (Empty_delegate_account delegate) >>=? fun () -> - unlink c contract >>=? fun c -> - Storage.Contract.Delegate.init_set c contract delegate >>= fun c -> - link c contract delegate >>=? fun c -> - begin - if self_delegation then - Storage.Delegates.add c delegate >>= fun c -> - Roll_storage.Delegate.set_active c delegate >>=? fun c -> - return c - else - return c - end >>=? fun c -> - return c + (Empty_delegate_account delegate) + >>=? fun () -> + unlink c contract + >>=? fun c -> + Storage.Contract.Delegate.init_set c contract delegate + >>= fun c -> + link c contract delegate + >>=? fun c -> + ( if self_delegation then + Storage.Delegates.add c delegate + >>= fun c -> + Roll_storage.Delegate.set_active c delegate >>=? fun c -> return c + else return c ) + >>=? fun c -> return c -let remove ctxt contract = - unlink ctxt contract +let remove ctxt contract = unlink ctxt contract let delegated_contracts ctxt delegate = let contract = Contract_repr.implicit_contract delegate in Storage.Contract.Delegated.elements (ctxt, contract) let get_frozen_deposit ctxt contract cycle = - Storage.Contract.Frozen_deposits.get_option (ctxt, contract) cycle >>=? function - | None -> return Tez_repr.zero - | Some frozen -> return frozen + Storage.Contract.Frozen_deposits.get_option (ctxt, contract) cycle + >>=? function None -> return Tez_repr.zero | Some frozen -> return frozen let credit_frozen_deposit ctxt delegate cycle amount = let contract = Contract_repr.implicit_contract delegate in - get_frozen_deposit ctxt contract cycle >>=? fun old_amount -> - Lwt.return Tez_repr.(old_amount +? amount) >>=? fun new_amount -> - Storage.Contract.Frozen_deposits.init_set - (ctxt, contract) cycle new_amount >>= fun ctxt -> - Storage.Delegates_with_frozen_balance.add (ctxt, cycle) delegate >>= fun ctxt -> - return ctxt + get_frozen_deposit ctxt contract cycle + >>=? fun old_amount -> + Lwt.return Tez_repr.(old_amount +? amount) + >>=? fun new_amount -> + Storage.Contract.Frozen_deposits.init_set (ctxt, contract) cycle new_amount + >>= fun ctxt -> + Storage.Delegates_with_frozen_balance.add (ctxt, cycle) delegate + >>= fun ctxt -> return ctxt let freeze_deposit ctxt delegate amount = - let { Level_repr.cycle ; _ } = Level_storage.current ctxt in - Roll_storage.Delegate.set_active ctxt delegate >>=? fun ctxt -> + let {Level_repr.cycle; _} = Level_storage.current ctxt in + Roll_storage.Delegate.set_active ctxt delegate + >>=? fun ctxt -> let contract = Contract_repr.implicit_contract delegate in - Storage.Contract.Balance.get ctxt contract >>=? fun balance -> + Storage.Contract.Balance.get ctxt contract + >>=? fun balance -> Lwt.return - (record_trace (Balance_too_low_for_deposit { delegate; deposit = amount; balance }) - Tez_repr.(balance -? amount)) >>=? fun new_balance -> - Storage.Contract.Balance.set ctxt contract new_balance >>=? fun ctxt -> - credit_frozen_deposit ctxt delegate cycle amount + (record_trace + (Balance_too_low_for_deposit {delegate; deposit = amount; balance}) + Tez_repr.(balance -? amount)) + >>=? fun new_balance -> + Storage.Contract.Balance.set ctxt contract new_balance + >>=? fun ctxt -> credit_frozen_deposit ctxt delegate cycle amount let get_frozen_fees ctxt contract cycle = - Storage.Contract.Frozen_fees.get_option (ctxt, contract) cycle >>=? function - | None -> return Tez_repr.zero - | Some frozen -> return frozen + Storage.Contract.Frozen_fees.get_option (ctxt, contract) cycle + >>=? function None -> return Tez_repr.zero | Some frozen -> return frozen let credit_frozen_fees ctxt delegate cycle amount = let contract = Contract_repr.implicit_contract delegate in - get_frozen_fees ctxt contract cycle >>=? fun old_amount -> - Lwt.return Tez_repr.(old_amount +? amount) >>=? fun new_amount -> - Storage.Contract.Frozen_fees.init_set - (ctxt, contract) cycle new_amount >>= fun ctxt -> - Storage.Delegates_with_frozen_balance.add (ctxt, cycle) delegate >>= fun ctxt -> - return ctxt + get_frozen_fees ctxt contract cycle + >>=? fun old_amount -> + Lwt.return Tez_repr.(old_amount +? amount) + >>=? fun new_amount -> + Storage.Contract.Frozen_fees.init_set (ctxt, contract) cycle new_amount + >>= fun ctxt -> + Storage.Delegates_with_frozen_balance.add (ctxt, cycle) delegate + >>= fun ctxt -> return ctxt let freeze_fees ctxt delegate amount = - let { Level_repr.cycle ; _ } = Level_storage.current ctxt in - Roll_storage.Delegate.add_amount ctxt delegate amount >>=? fun ctxt -> - credit_frozen_fees ctxt delegate cycle amount + let {Level_repr.cycle; _} = Level_storage.current ctxt in + Roll_storage.Delegate.add_amount ctxt delegate amount + >>=? fun ctxt -> credit_frozen_fees ctxt delegate cycle amount let burn_fees ctxt delegate cycle amount = let contract = Contract_repr.implicit_contract delegate in - get_frozen_fees ctxt contract cycle >>=? fun old_amount -> - begin - match Tez_repr.(old_amount -? amount) with - | Ok new_amount -> - Roll_storage.Delegate.remove_amount - ctxt delegate amount >>=? fun ctxt -> - return (new_amount, ctxt) - | Error _ -> - Roll_storage.Delegate.remove_amount - ctxt delegate old_amount >>=? fun ctxt -> - return (Tez_repr.zero, ctxt) - end >>=? fun (new_amount, ctxt) -> - Storage.Contract.Frozen_fees.init_set (ctxt, contract) cycle new_amount >>= fun ctxt -> - return ctxt - + get_frozen_fees ctxt contract cycle + >>=? fun old_amount -> + ( match Tez_repr.(old_amount -? amount) with + | Ok new_amount -> + Roll_storage.Delegate.remove_amount ctxt delegate amount + >>=? fun ctxt -> return (new_amount, ctxt) + | Error _ -> + Roll_storage.Delegate.remove_amount ctxt delegate old_amount + >>=? fun ctxt -> return (Tez_repr.zero, ctxt) ) + >>=? fun (new_amount, ctxt) -> + Storage.Contract.Frozen_fees.init_set (ctxt, contract) cycle new_amount + >>= fun ctxt -> return ctxt let get_frozen_rewards ctxt contract cycle = - Storage.Contract.Frozen_rewards.get_option (ctxt, contract) cycle >>=? function - | None -> return Tez_repr.zero - | Some frozen -> return frozen + Storage.Contract.Frozen_rewards.get_option (ctxt, contract) cycle + >>=? function None -> return Tez_repr.zero | Some frozen -> return frozen let credit_frozen_rewards ctxt delegate cycle amount = let contract = Contract_repr.implicit_contract delegate in - get_frozen_rewards ctxt contract cycle >>=? fun old_amount -> - Lwt.return Tez_repr.(old_amount +? amount) >>=? fun new_amount -> - Storage.Contract.Frozen_rewards.init_set - (ctxt, contract) cycle new_amount >>= fun ctxt -> - Storage.Delegates_with_frozen_balance.add (ctxt, cycle) delegate >>= fun ctxt -> - return ctxt + get_frozen_rewards ctxt contract cycle + >>=? fun old_amount -> + Lwt.return Tez_repr.(old_amount +? amount) + >>=? fun new_amount -> + Storage.Contract.Frozen_rewards.init_set (ctxt, contract) cycle new_amount + >>= fun ctxt -> + Storage.Delegates_with_frozen_balance.add (ctxt, cycle) delegate + >>= fun ctxt -> return ctxt let freeze_rewards ctxt delegate amount = - let { Level_repr.cycle ; _ } = Level_storage.current ctxt in + let {Level_repr.cycle; _} = Level_storage.current ctxt in credit_frozen_rewards ctxt delegate cycle amount let burn_rewards ctxt delegate cycle amount = let contract = Contract_repr.implicit_contract delegate in - get_frozen_rewards ctxt contract cycle >>=? fun old_amount -> + get_frozen_rewards ctxt contract cycle + >>=? fun old_amount -> let new_amount = match Tez_repr.(old_amount -? amount) with - | Error _ -> Tez_repr.zero - | Ok new_amount -> new_amount in - Storage.Contract.Frozen_rewards.init_set (ctxt, contract) cycle new_amount >>= fun ctxt -> - return ctxt - - + | Error _ -> + Tez_repr.zero + | Ok new_amount -> + new_amount + in + Storage.Contract.Frozen_rewards.init_set (ctxt, contract) cycle new_amount + >>= fun ctxt -> return ctxt let unfreeze ctxt delegate cycle = let contract = Contract_repr.implicit_contract delegate in - get_frozen_deposit ctxt contract cycle >>=? fun deposit -> - get_frozen_fees ctxt contract cycle >>=? fun fees -> - get_frozen_rewards ctxt contract cycle >>=? fun rewards -> - Storage.Contract.Balance.get ctxt contract >>=? fun balance -> - Lwt.return Tez_repr.(deposit +? fees) >>=? fun unfrozen_amount -> - Lwt.return Tez_repr.(unfrozen_amount +? rewards) >>=? fun unfrozen_amount -> - Lwt.return Tez_repr.(balance +? unfrozen_amount) >>=? fun balance -> - Storage.Contract.Balance.set ctxt contract balance >>=? fun ctxt -> - Roll_storage.Delegate.add_amount ctxt delegate rewards >>=? fun ctxt -> - Storage.Contract.Frozen_deposits.remove (ctxt, contract) cycle >>= fun ctxt -> - Storage.Contract.Frozen_fees.remove (ctxt, contract) cycle >>= fun ctxt -> - Storage.Contract.Frozen_rewards.remove (ctxt, contract) cycle >>= fun ctxt -> - return (ctxt, (cleanup_balance_updates - [(Deposits (delegate, cycle), Debited deposit) ; - (Fees (delegate, cycle), Debited fees) ; - (Rewards (delegate, cycle), Debited rewards) ; - (Contract (Contract_repr.implicit_contract delegate), Credited unfrozen_amount)])) + get_frozen_deposit ctxt contract cycle + >>=? fun deposit -> + get_frozen_fees ctxt contract cycle + >>=? fun fees -> + get_frozen_rewards ctxt contract cycle + >>=? fun rewards -> + Storage.Contract.Balance.get ctxt contract + >>=? fun balance -> + Lwt.return Tez_repr.(deposit +? fees) + >>=? fun unfrozen_amount -> + Lwt.return Tez_repr.(unfrozen_amount +? rewards) + >>=? fun unfrozen_amount -> + Lwt.return Tez_repr.(balance +? unfrozen_amount) + >>=? fun balance -> + Storage.Contract.Balance.set ctxt contract balance + >>=? fun ctxt -> + Roll_storage.Delegate.add_amount ctxt delegate rewards + >>=? fun ctxt -> + Storage.Contract.Frozen_deposits.remove (ctxt, contract) cycle + >>= fun ctxt -> + Storage.Contract.Frozen_fees.remove (ctxt, contract) cycle + >>= fun ctxt -> + Storage.Contract.Frozen_rewards.remove (ctxt, contract) cycle + >>= fun ctxt -> + return + ( ctxt, + cleanup_balance_updates + [ (Deposits (delegate, cycle), Debited deposit); + (Fees (delegate, cycle), Debited fees); + (Rewards (delegate, cycle), Debited rewards); + ( Contract (Contract_repr.implicit_contract delegate), + Credited unfrozen_amount ) ] ) let cycle_end ctxt last_cycle unrevealed = let preserved = Constants_storage.preserved_cycles ctxt in - begin - match Cycle_repr.pred last_cycle with - | None -> return (ctxt,[]) - | Some revealed_cycle -> - List.fold_left - (fun acc (u : Nonce_storage.unrevealed) -> - acc >>=? fun (ctxt, balance_updates) -> - burn_fees - ctxt u.delegate revealed_cycle u.fees >>=? fun ctxt -> - burn_rewards - ctxt u.delegate revealed_cycle u.rewards >>=? fun ctxt -> - let bus = [(Fees (u.delegate, revealed_cycle), Debited u.fees); - (Rewards (u.delegate, revealed_cycle), Debited u.rewards)] in - return (ctxt, bus @ balance_updates)) - (return (ctxt,[])) unrevealed - end >>=? fun (ctxt, balance_updates) -> + ( match Cycle_repr.pred last_cycle with + | None -> + return (ctxt, []) + | Some revealed_cycle -> + List.fold_left + (fun acc (u : Nonce_storage.unrevealed) -> + acc + >>=? fun (ctxt, balance_updates) -> + burn_fees ctxt u.delegate revealed_cycle u.fees + >>=? fun ctxt -> + burn_rewards ctxt u.delegate revealed_cycle u.rewards + >>=? fun ctxt -> + let bus = + [ (Fees (u.delegate, revealed_cycle), Debited u.fees); + (Rewards (u.delegate, revealed_cycle), Debited u.rewards) ] + in + return (ctxt, bus @ balance_updates)) + (return (ctxt, [])) + unrevealed ) + >>=? fun (ctxt, balance_updates) -> match Cycle_repr.sub last_cycle preserved with - | None -> return (ctxt, balance_updates, []) + | None -> + return (ctxt, balance_updates, []) | Some unfrozen_cycle -> - Storage.Delegates_with_frozen_balance.fold (ctxt, unfrozen_cycle) + Storage.Delegates_with_frozen_balance.fold + (ctxt, unfrozen_cycle) ~init:(Ok (ctxt, balance_updates)) ~f:(fun delegate acc -> - Lwt.return acc >>=? fun (ctxt, bus) -> - unfreeze ctxt - delegate unfrozen_cycle >>=? fun (ctxt, balance_updates) -> - return (ctxt, balance_updates @ bus)) >>=? fun (ctxt, balance_updates) -> - Storage.Delegates_with_frozen_balance.clear (ctxt, unfrozen_cycle) >>= fun ctxt -> - Storage.Active_delegates_with_rolls.fold ctxt + Lwt.return acc + >>=? fun (ctxt, bus) -> + unfreeze ctxt delegate unfrozen_cycle + >>=? fun (ctxt, balance_updates) -> + return (ctxt, balance_updates @ bus)) + >>=? fun (ctxt, balance_updates) -> + Storage.Delegates_with_frozen_balance.clear (ctxt, unfrozen_cycle) + >>= fun ctxt -> + Storage.Active_delegates_with_rolls.fold + ctxt ~init:(Ok (ctxt, [])) ~f:(fun delegate acc -> - Lwt.return acc >>=? fun (ctxt, deactivated) -> - Storage.Contract.Delegate_desactivation.get ctxt - (Contract_repr.implicit_contract delegate) >>=? fun cycle -> - if Cycle_repr.(cycle <= last_cycle) then - Roll_storage.Delegate.set_inactive ctxt delegate >>=? fun ctxt -> - return (ctxt, delegate :: deactivated) - else - return (ctxt, deactivated)) >>=? fun (ctxt, deactivated) -> + Lwt.return acc + >>=? fun (ctxt, deactivated) -> + Storage.Contract.Delegate_desactivation.get + ctxt + (Contract_repr.implicit_contract delegate) + >>=? fun cycle -> + if Cycle_repr.(cycle <= last_cycle) then + Roll_storage.Delegate.set_inactive ctxt delegate + >>=? fun ctxt -> return (ctxt, delegate :: deactivated) + else return (ctxt, deactivated)) + >>=? fun (ctxt, deactivated) -> return (ctxt, balance_updates, deactivated) let punish ctxt delegate cycle = let contract = Contract_repr.implicit_contract delegate in - get_frozen_deposit ctxt contract cycle >>=? fun deposit -> - get_frozen_fees ctxt contract cycle >>=? fun fees -> - get_frozen_rewards ctxt contract cycle >>=? fun rewards -> - Roll_storage.Delegate.remove_amount ctxt delegate deposit >>=? fun ctxt -> - Roll_storage.Delegate.remove_amount ctxt delegate fees >>=? fun ctxt -> + get_frozen_deposit ctxt contract cycle + >>=? fun deposit -> + get_frozen_fees ctxt contract cycle + >>=? fun fees -> + get_frozen_rewards ctxt contract cycle + >>=? fun rewards -> + Roll_storage.Delegate.remove_amount ctxt delegate deposit + >>=? fun ctxt -> + Roll_storage.Delegate.remove_amount ctxt delegate fees + >>=? fun ctxt -> (* Rewards are not accounted in the delegate's rolls yet... *) - Storage.Contract.Frozen_deposits.remove (ctxt, contract) cycle >>= fun ctxt -> - Storage.Contract.Frozen_fees.remove (ctxt, contract) cycle >>= fun ctxt -> - Storage.Contract.Frozen_rewards.remove (ctxt, contract) cycle >>= fun ctxt -> - return (ctxt, { deposit ; fees ; rewards }) - + Storage.Contract.Frozen_deposits.remove (ctxt, contract) cycle + >>= fun ctxt -> + Storage.Contract.Frozen_fees.remove (ctxt, contract) cycle + >>= fun ctxt -> + Storage.Contract.Frozen_rewards.remove (ctxt, contract) cycle + >>= fun ctxt -> return (ctxt, {deposit; fees; rewards}) let has_frozen_balance ctxt delegate cycle = let contract = Contract_repr.implicit_contract delegate in - get_frozen_deposit ctxt contract cycle >>=? fun deposit -> + get_frozen_deposit ctxt contract cycle + >>=? fun deposit -> if Tez_repr.(deposit <> zero) then return_true else - get_frozen_fees ctxt contract cycle >>=? fun fees -> + get_frozen_fees ctxt contract cycle + >>=? fun fees -> if Tez_repr.(fees <> zero) then return_true else - get_frozen_rewards ctxt contract cycle >>=? fun rewards -> - return Tez_repr.(rewards <> zero) + get_frozen_rewards ctxt contract cycle + >>=? fun rewards -> return Tez_repr.(rewards <> zero) let frozen_balance_by_cycle_encoding = let open Data_encoding in conv - (Cycle_repr.Map.bindings) + Cycle_repr.Map.bindings (List.fold_left (fun m (c, b) -> Cycle_repr.Map.add c b m) Cycle_repr.Map.empty) - (list (merge_objs - (obj1 (req "cycle" Cycle_repr.encoding)) - frozen_balance_encoding)) + (list + (merge_objs + (obj1 (req "cycle" Cycle_repr.encoding)) + frozen_balance_encoding)) let empty_frozen_balance = - { deposit = Tez_repr.zero ; - fees = Tez_repr.zero ; - rewards = Tez_repr.zero } + {deposit = Tez_repr.zero; fees = Tez_repr.zero; rewards = Tez_repr.zero} let frozen_balance_by_cycle ctxt delegate = let contract = Contract_repr.implicit_contract delegate in let map = Cycle_repr.Map.empty in Storage.Contract.Frozen_deposits.fold - (ctxt, contract) ~init:map + (ctxt, contract) + ~init:map ~f:(fun cycle amount map -> - Lwt.return - (Cycle_repr.Map.add cycle - { empty_frozen_balance with deposit = amount } map)) >>= fun map -> + Lwt.return + (Cycle_repr.Map.add + cycle + {empty_frozen_balance with deposit = amount} + map)) + >>= fun map -> Storage.Contract.Frozen_fees.fold - (ctxt, contract) ~init:map + (ctxt, contract) + ~init:map ~f:(fun cycle amount map -> - let balance = - match Cycle_repr.Map.find_opt cycle map with - | None -> empty_frozen_balance - | Some balance -> balance in - Lwt.return - (Cycle_repr.Map.add cycle - { balance with fees = amount } map)) >>= fun map -> + let balance = + match Cycle_repr.Map.find_opt cycle map with + | None -> + empty_frozen_balance + | Some balance -> + balance + in + Lwt.return (Cycle_repr.Map.add cycle {balance with fees = amount} map)) + >>= fun map -> Storage.Contract.Frozen_rewards.fold - (ctxt, contract) ~init:map + (ctxt, contract) + ~init:map ~f:(fun cycle amount map -> - let balance = - match Cycle_repr.Map.find_opt cycle map with - | None -> empty_frozen_balance - | Some balance -> balance in - Lwt.return - (Cycle_repr.Map.add cycle - { balance with rewards = amount } map)) >>= fun map -> - Lwt.return map + let balance = + match Cycle_repr.Map.find_opt cycle map with + | None -> + empty_frozen_balance + | Some balance -> + balance + in + Lwt.return (Cycle_repr.Map.add cycle {balance with rewards = amount} map)) + >>= fun map -> Lwt.return map let frozen_balance ctxt delegate = let contract = Contract_repr.implicit_contract delegate in let balance = Ok Tez_repr.zero in Storage.Contract.Frozen_deposits.fold - (ctxt, contract) ~init:balance + (ctxt, contract) + ~init:balance ~f:(fun _cycle amount acc -> - Lwt.return acc >>=? fun acc -> - Lwt.return (Tez_repr.(acc +? amount))) >>= fun balance -> + Lwt.return acc >>=? fun acc -> Lwt.return Tez_repr.(acc +? amount)) + >>= fun balance -> Storage.Contract.Frozen_fees.fold - (ctxt, contract) ~init:balance + (ctxt, contract) + ~init:balance ~f:(fun _cycle amount acc -> - Lwt.return acc >>=? fun acc -> - Lwt.return (Tez_repr.(acc +? amount))) >>= fun balance -> + Lwt.return acc >>=? fun acc -> Lwt.return Tez_repr.(acc +? amount)) + >>= fun balance -> Storage.Contract.Frozen_rewards.fold - (ctxt, contract) ~init:balance + (ctxt, contract) + ~init:balance ~f:(fun _cycle amount acc -> - Lwt.return acc >>=? fun acc -> - Lwt.return (Tez_repr.(acc +? amount))) >>= fun balance -> - Lwt.return balance + Lwt.return acc >>=? fun acc -> Lwt.return Tez_repr.(acc +? amount)) + >>= fun balance -> Lwt.return balance let full_balance ctxt delegate = let contract = Contract_repr.implicit_contract delegate in - frozen_balance ctxt delegate >>=? fun frozen_balance -> - Storage.Contract.Balance.get ctxt contract >>=? fun balance -> - Lwt.return Tez_repr.(frozen_balance +? balance) + frozen_balance ctxt delegate + >>=? fun frozen_balance -> + Storage.Contract.Balance.get ctxt contract + >>=? fun balance -> Lwt.return Tez_repr.(frozen_balance +? balance) let deactivated = Roll_storage.Delegate.is_inactive @@ -580,27 +680,34 @@ let grace_period ctxt delegate = let staking_balance ctxt delegate = let token_per_rolls = Constants_storage.tokens_per_roll ctxt in - Roll_storage.get_rolls ctxt delegate >>=? fun rolls -> - Roll_storage.get_change ctxt delegate >>=? fun change -> + Roll_storage.get_rolls ctxt delegate + >>=? fun rolls -> + Roll_storage.get_change ctxt delegate + >>=? fun change -> let rolls = Int64.of_int (List.length rolls) in - Lwt.return Tez_repr.(token_per_rolls *? rolls) >>=? fun balance -> - Lwt.return Tez_repr.(balance +? change) + Lwt.return Tez_repr.(token_per_rolls *? rolls) + >>=? fun balance -> Lwt.return Tez_repr.(balance +? change) let delegated_balance ctxt delegate = let contract = Contract_repr.implicit_contract delegate in - staking_balance ctxt delegate >>=? fun staking_balance -> - Storage.Contract.Balance.get ctxt contract >>= fun self_staking_balance -> + staking_balance ctxt delegate + >>=? fun staking_balance -> + Storage.Contract.Balance.get ctxt contract + >>= fun self_staking_balance -> Storage.Contract.Frozen_deposits.fold - (ctxt, contract) ~init:self_staking_balance + (ctxt, contract) + ~init:self_staking_balance ~f:(fun _cycle amount acc -> - Lwt.return acc >>=? fun acc -> - Lwt.return (Tez_repr.(acc +? amount))) >>= fun self_staking_balance -> + Lwt.return acc >>=? fun acc -> Lwt.return Tez_repr.(acc +? amount)) + >>= fun self_staking_balance -> Storage.Contract.Frozen_fees.fold - (ctxt, contract) ~init:self_staking_balance + (ctxt, contract) + ~init:self_staking_balance ~f:(fun _cycle amount acc -> - Lwt.return acc >>=? fun acc -> - Lwt.return (Tez_repr.(acc +? amount))) >>=? fun self_staking_balance -> + Lwt.return acc >>=? fun acc -> Lwt.return Tez_repr.(acc +? amount)) + >>=? fun self_staking_balance -> Lwt.return Tez_repr.(staking_balance -? self_staking_balance) let fold = Storage.Delegates.fold + let list = Storage.Delegates.elements diff --git a/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.mli index 730cde305..36ab69612 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/delegate_storage.mli @@ -31,9 +31,7 @@ type balance = | Deposits of Signature.Public_key_hash.t * Cycle_repr.t (** A credit or debit of tezzies to a balance. *) -type balance_update = - | Debited of Tez_repr.t - | Credited of Tez_repr.t +type balance_update = Debited of Tez_repr.t | Credited of Tez_repr.t (** A list of balance updates. Duplicates may happen. *) type balance_updates = (balance * balance_update) list @@ -44,26 +42,29 @@ val balance_updates_encoding : balance_updates Data_encoding.t val cleanup_balance_updates : balance_updates -> balance_updates type frozen_balance = { - deposit : Tez_repr.t ; - fees : Tez_repr.t ; - rewards : Tez_repr.t ; + deposit : Tez_repr.t; + fees : Tez_repr.t; + rewards : Tez_repr.t; } (** Allow to register a delegate when creating an account. *) -val init: - Raw_context.t -> Contract_repr.t -> Signature.Public_key_hash.t -> +val init : + Raw_context.t -> + Contract_repr.t -> + Signature.Public_key_hash.t -> Raw_context.t tzresult Lwt.t (** Cleanup delegation when deleting a contract. *) -val remove: - Raw_context.t -> Contract_repr.t -> Raw_context.t tzresult Lwt.t +val remove : Raw_context.t -> Contract_repr.t -> Raw_context.t tzresult Lwt.t (** Reading the current delegate of a contract. *) -val get: - Raw_context.t -> Contract_repr.t -> +val get : + Raw_context.t -> + Contract_repr.t -> Signature.Public_key_hash.t option tzresult Lwt.t -val registered: Raw_context.t -> Signature.Public_key_hash.t -> bool tzresult Lwt.t +val registered : + Raw_context.t -> Signature.Public_key_hash.t -> bool tzresult Lwt.t (** Updating the delegate of a contract. @@ -71,8 +72,10 @@ val registered: Raw_context.t -> Signature.Public_key_hash.t -> bool tzresult Lw the delegate to the contract manager registers it as a delegate. One cannot unregister a delegate for now. The associate contract is now 'undeletable'. *) -val set: - Raw_context.t -> Contract_repr.t -> Signature.Public_key_hash.t option -> +val set : + Raw_context.t -> + Contract_repr.t -> + Signature.Public_key_hash.t option -> Raw_context.t tzresult Lwt.t type error += @@ -80,34 +83,44 @@ type error += | Active_delegate (* `Temporary *) | Current_delegate (* `Temporary *) | Empty_delegate_account of Signature.Public_key_hash.t (* `Temporary *) - | Balance_too_low_for_deposit of - { delegate : Signature.Public_key_hash.t ; - deposit : Tez_repr.t ; - balance : Tez_repr.t } (* `Temporary *) + | Balance_too_low_for_deposit of { + delegate : Signature.Public_key_hash.t; + deposit : Tez_repr.t; + balance : Tez_repr.t; + } + +(* `Temporary *) (** Iterate on all registered delegates. *) -val fold: +val fold : Raw_context.t -> init:'a -> - f:(Signature.Public_key_hash.t -> 'a -> 'a Lwt.t) -> 'a Lwt.t + f:(Signature.Public_key_hash.t -> 'a -> 'a Lwt.t) -> + 'a Lwt.t (** List all registered delegates. *) -val list: Raw_context.t -> Signature.Public_key_hash.t list Lwt.t +val list : Raw_context.t -> Signature.Public_key_hash.t list Lwt.t (** Various functions to 'freeze' tokens. A frozen 'deposit' keeps its associated rolls. When frozen, 'fees' may trigger new rolls allocation. Rewards won't trigger new rolls allocation until unfrozen. *) -val freeze_deposit: - Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t -> +val freeze_deposit : + Raw_context.t -> + Signature.Public_key_hash.t -> + Tez_repr.t -> Raw_context.t tzresult Lwt.t -val freeze_fees: - Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t -> +val freeze_fees : + Raw_context.t -> + Signature.Public_key_hash.t -> + Tez_repr.t -> Raw_context.t tzresult Lwt.t -val freeze_rewards: - Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t -> +val freeze_rewards : + Raw_context.t -> + Signature.Public_key_hash.t -> + Tez_repr.t -> Raw_context.t tzresult Lwt.t (** Trigger the context maintenance at the end of cycle 'n', i.e.: @@ -115,62 +128,64 @@ val freeze_rewards: provided unrevealed seeds (tipically seed from cycle 'n - 1'). Returns a list of account with the amount that was unfrozen for each and the list of deactivated delegates. *) -val cycle_end: - Raw_context.t -> Cycle_repr.t -> Nonce_storage.unrevealed list -> - (Raw_context.t * balance_updates * Signature.Public_key_hash.t list) tzresult Lwt.t +val cycle_end : + Raw_context.t -> + Cycle_repr.t -> + Nonce_storage.unrevealed list -> + (Raw_context.t * balance_updates * Signature.Public_key_hash.t list) tzresult + Lwt.t (** Burn all then frozen deposit/fees/rewards for a delegate at a given cycle. Returns the burned amounts. *) -val punish: - Raw_context.t -> Signature.Public_key_hash.t -> Cycle_repr.t -> +val punish : + Raw_context.t -> + Signature.Public_key_hash.t -> + Cycle_repr.t -> (Raw_context.t * frozen_balance) tzresult Lwt.t (** Has the given key some frozen tokens in its implicit contract? *) -val has_frozen_balance: - Raw_context.t -> Signature.Public_key_hash.t -> Cycle_repr.t -> +val has_frozen_balance : + Raw_context.t -> + Signature.Public_key_hash.t -> + Cycle_repr.t -> bool tzresult Lwt.t (** Returns the amount of frozen deposit, fees and rewards associated to a given delegate. *) -val frozen_balance: - Raw_context.t -> Signature.Public_key_hash.t -> - Tez_repr.t tzresult Lwt.t +val frozen_balance : + Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t tzresult Lwt.t -val frozen_balance_encoding: frozen_balance Data_encoding.t -val frozen_balance_by_cycle_encoding: +val frozen_balance_encoding : frozen_balance Data_encoding.t + +val frozen_balance_by_cycle_encoding : frozen_balance Cycle_repr.Map.t Data_encoding.t (** Returns the amount of frozen deposit, fees and rewards associated to a given delegate, indexed by the cycle by which at the end the balance will be unfrozen. *) -val frozen_balance_by_cycle: - Raw_context.t -> Signature.Public_key_hash.t -> +val frozen_balance_by_cycle : + Raw_context.t -> + Signature.Public_key_hash.t -> frozen_balance Cycle_repr.Map.t Lwt.t (** Returns the full 'balance' of the implicit contract associated to a given key, i.e. the sum of the spendable balance and of the frozen balance. *) -val full_balance: - Raw_context.t -> Signature.Public_key_hash.t -> - Tez_repr.t tzresult Lwt.t +val full_balance : + Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t tzresult Lwt.t -val staking_balance: - Raw_context.t -> Signature.Public_key_hash.t -> - Tez_repr.t tzresult Lwt.t +val staking_balance : + Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t tzresult Lwt.t (** Returns the list of contracts (implicit or originated) that delegated towards a given delegate *) -val delegated_contracts: - Raw_context.t -> Signature.Public_key_hash.t -> - Contract_repr.t list Lwt.t +val delegated_contracts : + Raw_context.t -> Signature.Public_key_hash.t -> Contract_repr.t list Lwt.t -val delegated_balance: - Raw_context.t -> Signature.Public_key_hash.t -> - Tez_repr.t tzresult Lwt.t +val delegated_balance : + Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t tzresult Lwt.t -val deactivated: - Raw_context.t -> Signature.Public_key_hash.t -> - bool tzresult Lwt.t +val deactivated : + Raw_context.t -> Signature.Public_key_hash.t -> bool tzresult Lwt.t -val grace_period: - Raw_context.t -> Signature.Public_key_hash.t -> - Cycle_repr.t tzresult Lwt.t +val grace_period : + Raw_context.t -> Signature.Public_key_hash.t -> Cycle_repr.t tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.ml index 67640e855..1a12e6c20 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.ml @@ -24,7 +24,9 @@ (*****************************************************************************) type error += Cannot_pay_storage_fee (* `Temporary *) + type error += Operation_quota_exceeded (* `Temporary *) + type error += Storage_limit_too_high (* `Permanent *) let () = @@ -41,19 +43,18 @@ let () = register_error_kind `Temporary ~id:"storage_exhausted.operation" - ~title: "Storage quota exceeded for the operation" + ~title:"Storage quota exceeded for the operation" ~description: - "A script or one of its callee wrote more \ - bytes than the operation said it would" + "A script or one of its callee wrote more bytes than the operation said \ + it would" Data_encoding.empty (function Operation_quota_exceeded -> Some () | _ -> None) (fun () -> Operation_quota_exceeded) ; register_error_kind `Permanent ~id:"storage_limit_too_high" - ~title: "Storage limit out of protocol hard bounds" - ~description: - "A transaction tried to exceed the hard limit on storage" + ~title:"Storage limit out of protocol hard bounds" + ~description:"A transaction tried to exceed the hard limit on storage" empty (function Storage_limit_too_high -> Some () | _ -> None) (fun () -> Storage_limit_too_high) @@ -62,50 +63,59 @@ let origination_burn c = let origination_size = Constants_storage.origination_size c in let cost_per_byte = Constants_storage.cost_per_byte c in (* the origination burn, measured in bytes *) - Lwt.return - Tez_repr.(cost_per_byte *? (Int64.of_int origination_size)) >>=? fun to_be_paid -> - return (Raw_context.update_allocated_contracts_count c, - to_be_paid) + Lwt.return Tez_repr.(cost_per_byte *? Int64.of_int origination_size) + >>=? fun to_be_paid -> + return (Raw_context.update_allocated_contracts_count c, to_be_paid) let record_paid_storage_space c contract = - Contract_storage.used_storage_space c contract >>=? fun size -> - Contract_storage.set_paid_storage_space_and_return_fees_to_pay c contract size >>=? fun (to_be_paid, c) -> + Contract_storage.used_storage_space c contract + >>=? fun size -> + Contract_storage.set_paid_storage_space_and_return_fees_to_pay + c + contract + size + >>=? fun (to_be_paid, c) -> let c = Raw_context.update_storage_space_to_pay c to_be_paid in let cost_per_byte = Constants_storage.cost_per_byte c in - Lwt.return (Tez_repr.(cost_per_byte *? (Z.to_int64 to_be_paid))) >>=? fun to_burn -> - return (c, size, to_be_paid, to_burn) + Lwt.return Tez_repr.(cost_per_byte *? Z.to_int64 to_be_paid) + >>=? fun to_burn -> return (c, size, to_be_paid, to_burn) let burn_storage_fees c ~storage_limit ~payer = let origination_size = Constants_storage.origination_size c in - let c, storage_space_to_pay, allocated_contracts = - Raw_context.clear_storage_space_to_pay c in + let (c, storage_space_to_pay, allocated_contracts) = + Raw_context.clear_storage_space_to_pay c + in let storage_space_for_allocated_contracts = - Z.mul (Z.of_int allocated_contracts) (Z.of_int origination_size) in + Z.mul (Z.of_int allocated_contracts) (Z.of_int origination_size) + in let consumed = - Z.add storage_space_to_pay storage_space_for_allocated_contracts in + Z.add storage_space_to_pay storage_space_for_allocated_contracts + in let remaining = Z.sub storage_limit consumed in - if Compare.Z.(remaining < Z.zero) then - fail Operation_quota_exceeded + if Compare.Z.(remaining < Z.zero) then fail Operation_quota_exceeded else let cost_per_byte = Constants_storage.cost_per_byte c in - Lwt.return (Tez_repr.(cost_per_byte *? (Z.to_int64 consumed))) >>=? fun to_burn -> + Lwt.return Tez_repr.(cost_per_byte *? Z.to_int64 consumed) + >>=? fun to_burn -> (* Burning the fees... *) if Tez_repr.(to_burn = Tez_repr.zero) then (* If the payer was was deleted by transfering all its balance, and no space was used, burning zero would fail *) return c else - trace Cannot_pay_storage_fee - (Contract_storage.must_exist c payer >>=? fun () -> - Contract_storage.spend c payer to_burn) >>=? fun c -> - return c + trace + Cannot_pay_storage_fee + ( Contract_storage.must_exist c payer + >>=? fun () -> Contract_storage.spend c payer to_burn ) + >>=? fun c -> return c let check_storage_limit c ~storage_limit = - if Compare.Z.(storage_limit > (Raw_context.constants c).hard_storage_limit_per_operation) - || Compare.Z.(storage_limit < Z.zero)then - error Storage_limit_too_high - else - ok () + if + Compare.Z.( + storage_limit + > (Raw_context.constants c).hard_storage_limit_per_operation) + || Compare.Z.(storage_limit < Z.zero) + then error Storage_limit_too_high + else ok () -let start_counting_storage_fees c = - Raw_context.init_storage_space_to_pay c +let start_counting_storage_fees c = Raw_context.init_storage_space_to_pay c diff --git a/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.mli index f46f7df87..5e3fc06e0 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/fees_storage.mli @@ -24,23 +24,27 @@ (*****************************************************************************) type error += Cannot_pay_storage_fee (* `Temporary *) + type error += Operation_quota_exceeded (* `Temporary *) + type error += Storage_limit_too_high (* `Permanent *) (** Does not burn, only adds the burn to storage space to be paid *) -val origination_burn: +val origination_burn : Raw_context.t -> (Raw_context.t * Tez_repr.t) tzresult Lwt.t (** The returned Tez quantity is for logging purpose only *) -val record_paid_storage_space: - Raw_context.t -> Contract_repr.t -> +val record_paid_storage_space : + Raw_context.t -> + Contract_repr.t -> (Raw_context.t * Z.t * Z.t * Tez_repr.t) tzresult Lwt.t -val check_storage_limit: - Raw_context.t -> storage_limit:Z.t -> unit tzresult +val check_storage_limit : Raw_context.t -> storage_limit:Z.t -> unit tzresult -val start_counting_storage_fees : - Raw_context.t -> Raw_context.t +val start_counting_storage_fees : Raw_context.t -> Raw_context.t -val burn_storage_fees: - Raw_context.t -> storage_limit:Z.t -> payer:Contract_repr.t -> Raw_context.t tzresult Lwt.t +val burn_storage_fees : + Raw_context.t -> + storage_limit:Z.t -> + payer:Contract_repr.t -> + Raw_context.t tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/fitness_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/fitness_repr.ml index 9bbc19e74..24d7295b4 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/fitness_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/fitness_repr.ml @@ -38,29 +38,25 @@ let () = let int64_to_bytes i = let b = MBytes.create 8 in - MBytes.set_int64 b 0 i; - b + MBytes.set_int64 b 0 i ; b let int64_of_bytes b = - if Compare.Int.(MBytes.length b <> 8) then - error Invalid_fitness - else - ok (MBytes.get_int64 b 0) + if Compare.Int.(MBytes.length b <> 8) then error Invalid_fitness + else ok (MBytes.get_int64 b 0) let from_int64 fitness = - [ MBytes.of_string Constants_repr.version_number ; - int64_to_bytes fitness ] + [MBytes.of_string Constants_repr.version_number; int64_to_bytes fitness] let to_int64 = function - | [ version ; - fitness ] - when Compare.String. - (MBytes.to_string version = Constants_repr.version_number) -> + | [version; fitness] + when Compare.String.( + MBytes.to_string version = Constants_repr.version_number) -> int64_of_bytes fitness - | [ version ; - _fitness (* ignored since higher version takes priority *) ] - when Compare.String. - (MBytes.to_string version = Constants_repr.version_number_004) -> + | [version; _fitness (* ignored since higher version takes priority *)] + when Compare.String.( + MBytes.to_string version = Constants_repr.version_number_004) -> ok 0L - | [] -> ok 0L - | _ -> error Invalid_fitness + | [] -> + ok 0L + | _ -> + error Invalid_fitness diff --git a/vendors/ligo-utils/tezos-protocol-alpha/fitness_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/fitness_storage.ml index e8853db8e..173ac9ab1 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/fitness_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/fitness_storage.ml @@ -24,6 +24,7 @@ (*****************************************************************************) let current = Raw_context.current_fitness + let increase ?(gap = 1) ctxt = let fitness = current ctxt in Raw_context.set_current_fitness ctxt (Int64.add (Int64.of_int gap) fitness) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.ml index 2d935809e..aa22db39f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.ml @@ -23,29 +23,30 @@ (* *) (*****************************************************************************) -type t = - | Unaccounted - | Limited of { remaining : Z.t } +type t = Unaccounted | Limited of {remaining : Z.t} type internal_gas = Z.t -type cost = - { allocations : Z.t ; - steps : Z.t ; - reads : Z.t ; - writes : Z.t ; - bytes_read : Z.t ; - bytes_written : Z.t } +type cost = { + allocations : Z.t; + steps : Z.t; + reads : Z.t; + writes : Z.t; + bytes_read : Z.t; + bytes_written : Z.t; +} let encoding = let open Data_encoding in union - [ case (Tag 0) + [ case + (Tag 0) ~title:"Limited" z - (function Limited { remaining } -> Some remaining | _ -> None) - (fun remaining -> Limited { remaining }) ; - case (Tag 1) + (function Limited {remaining} -> Some remaining | _ -> None) + (fun remaining -> Limited {remaining}); + case + (Tag 1) ~title:"Unaccounted" (constant "unaccounted") (function Unaccounted -> Some () | _ -> None) @@ -54,16 +55,16 @@ let encoding = let pp ppf = function | Unaccounted -> Format.fprintf ppf "unaccounted" - | Limited { remaining } -> + | Limited {remaining} -> Format.fprintf ppf "%s units remaining" (Z.to_string remaining) let cost_encoding = let open Data_encoding in conv - (fun { allocations ; steps ; reads ; writes ; bytes_read ; bytes_written } -> - (allocations, steps, reads, writes, bytes_read, bytes_written)) + (fun {allocations; steps; reads; writes; bytes_read; bytes_written} -> + (allocations, steps, reads, writes, bytes_read, bytes_written)) (fun (allocations, steps, reads, writes, bytes_read, bytes_written) -> - { allocations ; steps ; reads ; writes ; bytes_read ; bytes_written }) + {allocations; steps; reads; writes; bytes_read; bytes_written}) (obj6 (req "allocations" z) (req "steps" z) @@ -72,8 +73,10 @@ let cost_encoding = (req "bytes_read" z) (req "bytes_written" z)) -let pp_cost ppf { allocations ; steps ; reads ; writes ; bytes_read ; bytes_written } = - Format.fprintf ppf +let pp_cost ppf {allocations; steps; reads; writes; bytes_read; bytes_written} + = + Format.fprintf + ppf "(steps: %s, allocs: %s, reads: %s (%s bytes), writes: %s (%s bytes))" (Z.to_string steps) (Z.to_string allocations) @@ -83,20 +86,27 @@ let pp_cost ppf { allocations ; steps ; reads ; writes ; bytes_read ; bytes_writ (Z.to_string bytes_written) type error += Block_quota_exceeded (* `Temporary *) + type error += Operation_quota_exceeded (* `Temporary *) let allocation_weight = Z.of_int 2 + let step_weight = Z.of_int 1 + let read_base_weight = Z.of_int 100 + let write_base_weight = Z.of_int 160 + let byte_read_weight = Z.of_int 10 + let byte_written_weight = Z.of_int 15 let rescaling_bits = 7 -let rescaling_mask = - Z.sub (Z.shift_left Z.one rescaling_bits) Z.one + +let rescaling_mask = Z.sub (Z.shift_left Z.one rescaling_bits) Z.one let scale (z : Z.t) = Z.shift_left z rescaling_bits + let rescale (z : Z.t) = Z.shift_right z rescaling_bits let cost_to_internal_gas (cost : cost) : internal_gas = @@ -113,30 +123,26 @@ let cost_to_internal_gas (cost : cost) : internal_gas = (Z.mul cost.bytes_written byte_written_weight))) let internal_gas_to_gas internal_gas : Z.t * internal_gas = - let gas = rescale internal_gas in + let gas = rescale internal_gas in let rest = Z.logand internal_gas rescaling_mask in (gas, rest) let consume block_gas operation_gas internal_gas cost = match operation_gas with - | Unaccounted -> ok (block_gas, Unaccounted, internal_gas) - | Limited { remaining } -> - let cost_internal_gas = cost_to_internal_gas cost in - let total_internal_gas = - Z.add cost_internal_gas internal_gas in - let gas, rest = internal_gas_to_gas total_internal_gas in + | Unaccounted -> + ok (block_gas, Unaccounted, internal_gas) + | Limited {remaining} -> + let cost_internal_gas = cost_to_internal_gas cost in + let total_internal_gas = Z.add cost_internal_gas internal_gas in + let (gas, rest) = internal_gas_to_gas total_internal_gas in if Compare.Z.(gas > Z.zero) then - let remaining = - Z.sub remaining gas in - let block_remaining = - Z.sub block_gas gas in - if Compare.Z.(remaining < Z.zero) - then error Operation_quota_exceeded - else if Compare.Z.(block_remaining < Z.zero) - then error Block_quota_exceeded - else ok (block_remaining, Limited { remaining }, rest) - else - ok (block_gas, operation_gas, total_internal_gas) + let remaining = Z.sub remaining gas in + let block_remaining = Z.sub block_gas gas in + if Compare.Z.(remaining < Z.zero) then error Operation_quota_exceeded + else if Compare.Z.(block_remaining < Z.zero) then + error Block_quota_exceeded + else ok (block_remaining, Limited {remaining}, rest) + else ok (block_gas, operation_gas, total_internal_gas) let check_enough block_gas operation_gas internal_gas cost = consume block_gas operation_gas internal_gas cost @@ -145,97 +151,110 @@ let check_enough block_gas operation_gas internal_gas cost = let internal_gas_zero : internal_gas = Z.zero let alloc_cost n = - { allocations = scale (Z.of_int (n + 1)) ; - steps = Z.zero ; - reads = Z.zero ; - writes = Z.zero ; - bytes_read = Z.zero ; - bytes_written = Z.zero } + { + allocations = scale (Z.of_int (n + 1)); + steps = Z.zero; + reads = Z.zero; + writes = Z.zero; + bytes_read = Z.zero; + bytes_written = Z.zero; + } -let alloc_bytes_cost n = - alloc_cost ((n + 7) / 8) +let alloc_bytes_cost n = alloc_cost ((n + 7) / 8) -let alloc_bits_cost n = - alloc_cost ((n + 63) / 64) +let alloc_bits_cost n = alloc_cost ((n + 63) / 64) let atomic_step_cost n = - { allocations = Z.zero ; - steps = Z.of_int (2 * n) ; - reads = Z.zero ; - writes = Z.zero ; - bytes_read = Z.zero ; - bytes_written = Z.zero } + { + allocations = Z.zero; + steps = Z.of_int (2 * n); + reads = Z.zero; + writes = Z.zero; + bytes_read = Z.zero; + bytes_written = Z.zero; + } let step_cost n = - { allocations = Z.zero ; - steps = scale (Z.of_int n) ; - reads = Z.zero ; - writes = Z.zero ; - bytes_read = Z.zero ; - bytes_written = Z.zero } + { + allocations = Z.zero; + steps = scale (Z.of_int n); + reads = Z.zero; + writes = Z.zero; + bytes_read = Z.zero; + bytes_written = Z.zero; + } let free = - { allocations = Z.zero ; - steps = Z.zero ; - reads = Z.zero ; - writes = Z.zero ; - bytes_read = Z.zero ; - bytes_written = Z.zero } + { + allocations = Z.zero; + steps = Z.zero; + reads = Z.zero; + writes = Z.zero; + bytes_read = Z.zero; + bytes_written = Z.zero; + } let read_bytes_cost n = - { allocations = Z.zero ; - steps = Z.zero ; - reads = scale Z.one ; - writes = Z.zero ; - bytes_read = scale n ; - bytes_written = Z.zero } + { + allocations = Z.zero; + steps = Z.zero; + reads = scale Z.one; + writes = Z.zero; + bytes_read = scale n; + bytes_written = Z.zero; + } let write_bytes_cost n = - { allocations = Z.zero ; - steps = Z.zero ; - reads = Z.zero ; - writes = Z.one ; - bytes_read = Z.zero ; - bytes_written = scale n } + { + allocations = Z.zero; + steps = Z.zero; + reads = Z.zero; + writes = Z.one; + bytes_read = Z.zero; + bytes_written = scale n; + } let ( +@ ) x y = - { allocations = Z.add x.allocations y.allocations ; - steps = Z.add x.steps y.steps ; - reads = Z.add x.reads y.reads ; - writes = Z.add x.writes y.writes ; - bytes_read = Z.add x.bytes_read y.bytes_read ; - bytes_written = Z.add x.bytes_written y.bytes_written } + { + allocations = Z.add x.allocations y.allocations; + steps = Z.add x.steps y.steps; + reads = Z.add x.reads y.reads; + writes = Z.add x.writes y.writes; + bytes_read = Z.add x.bytes_read y.bytes_read; + bytes_written = Z.add x.bytes_written y.bytes_written; + } let ( *@ ) x y = - { allocations = Z.mul (Z.of_int x) y.allocations ; - steps = Z.mul (Z.of_int x) y.steps ; - reads = Z.mul (Z.of_int x) y.reads ; - writes = Z.mul (Z.of_int x) y.writes ; - bytes_read = Z.mul (Z.of_int x) y.bytes_read ; - bytes_written = Z.mul (Z.of_int x) y.bytes_written } + { + allocations = Z.mul (Z.of_int x) y.allocations; + steps = Z.mul (Z.of_int x) y.steps; + reads = Z.mul (Z.of_int x) y.reads; + writes = Z.mul (Z.of_int x) y.writes; + bytes_read = Z.mul (Z.of_int x) y.bytes_read; + bytes_written = Z.mul (Z.of_int x) y.bytes_written; + } -let alloc_mbytes_cost n = - alloc_cost 12 +@ alloc_bytes_cost n +let alloc_mbytes_cost n = alloc_cost 12 +@ alloc_bytes_cost n let () = let open Data_encoding in register_error_kind `Temporary ~id:"gas_exhausted.operation" - ~title: "Gas quota exceeded for the operation" + ~title:"Gas quota exceeded for the operation" ~description: - "A script or one of its callee took more \ - time than the operation said it would" + "A script or one of its callee took more time than the operation said \ + it would" empty (function Operation_quota_exceeded -> Some () | _ -> None) (fun () -> Operation_quota_exceeded) ; register_error_kind `Temporary ~id:"gas_exhausted.block" - ~title: "Gas quota exceeded for the block" + ~title:"Gas quota exceeded for the block" ~description: - "The sum of gas consumed by all the operations in the block \ - exceeds the hard gas limit per block" + "The sum of gas consumed by all the operations in the block exceeds the \ + hard gas limit per block" empty (function Block_quota_exceeded -> Some () | _ -> None) - (fun () -> Block_quota_exceeded) ; + (fun () -> Block_quota_exceeded) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.mli index d5b58c203..d7acd523c 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/gas_limit_repr.mli @@ -23,37 +23,49 @@ (* *) (*****************************************************************************) -type t = - | Unaccounted - | Limited of { remaining : Z.t } +type t = Unaccounted | Limited of {remaining : Z.t} type internal_gas val encoding : t Data_encoding.encoding + val pp : Format.formatter -> t -> unit type cost val cost_encoding : cost Data_encoding.encoding + val pp_cost : Format.formatter -> cost -> unit type error += Block_quota_exceeded (* `Temporary *) + type error += Operation_quota_exceeded (* `Temporary *) -val consume : Z.t -> t -> internal_gas -> cost -> (Z.t * t * internal_gas) tzresult +val consume : + Z.t -> t -> internal_gas -> cost -> (Z.t * t * internal_gas) tzresult + val check_enough : Z.t -> t -> internal_gas -> cost -> unit tzresult val internal_gas_zero : internal_gas val free : cost + val atomic_step_cost : int -> cost + val step_cost : int -> cost + val alloc_cost : int -> cost + val alloc_bytes_cost : int -> cost + val alloc_mbytes_cost : int -> cost + val alloc_bits_cost : int -> cost + val read_bytes_cost : Z.t -> cost + val write_bytes_cost : Z.t -> cost val ( *@ ) : int -> cost -> cost + val ( +@ ) : cost -> cost -> cost diff --git a/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.ml b/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.ml index a44c6c7f3..c63ed1035 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.ml @@ -32,381 +32,515 @@ let () = `Branch ~id:"operation.cannot_parse" ~title:"Cannot parse operation" - ~description:"The operation is ill-formed \ - or for another protocol version" - ~pp:(fun ppf () -> - Format.fprintf ppf "The operation cannot be parsed") + ~description:"The operation is ill-formed or for another protocol version" + ~pp:(fun ppf () -> Format.fprintf ppf "The operation cannot be parsed") Data_encoding.unit (function Cannot_parse_operation -> Some () | _ -> None) (fun () -> Cannot_parse_operation) -let parse_operation (op: Operation.raw) = - match Data_encoding.Binary.of_bytes - Operation.protocol_data_encoding - op.proto with +let parse_operation (op : Operation.raw) = + match + Data_encoding.Binary.of_bytes Operation.protocol_data_encoding op.proto + with | Some protocol_data -> - ok { shell = op.shell ; protocol_data } - | None -> error Cannot_parse_operation + ok {shell = op.shell; protocol_data} + | None -> + error Cannot_parse_operation let path = RPC_path.(open_root / "helpers") module Scripts = struct - module S = struct - open Data_encoding let path = RPC_path.(path / "scripts") let run_code_input_encoding = - (obj9 - (req "script" Script.expr_encoding) - (req "storage" Script.expr_encoding) - (req "input" Script.expr_encoding) - (req "amount" Tez.encoding) - (req "chain_id" Chain_id.encoding) - (opt "source" Contract.encoding) - (opt "payer" Contract.encoding) - (opt "gas" z) - (dft "entrypoint" string "default")) + obj9 + (req "script" Script.expr_encoding) + (req "storage" Script.expr_encoding) + (req "input" Script.expr_encoding) + (req "amount" Tez.encoding) + (req "chain_id" Chain_id.encoding) + (opt "source" Contract.encoding) + (opt "payer" Contract.encoding) + (opt "gas" z) + (dft "entrypoint" string "default") let trace_encoding = - def "scripted.trace" @@ - (list @@ obj3 - (req "location" Script.location_encoding) - (req "gas" Gas.encoding) - (req "stack" - (list - (obj2 - (req "item" (Script.expr_encoding)) - (opt "annot" string))))) + def "scripted.trace" @@ list + @@ obj3 + (req "location" Script.location_encoding) + (req "gas" Gas.encoding) + (req + "stack" + (list + (obj2 (req "item" Script.expr_encoding) (opt "annot" string)))) let run_code = RPC_service.post_service - ~description: "Run a piece of code in the current context" - ~query: RPC_query.empty - ~input: run_code_input_encoding - ~output: (obj3 - (req "storage" Script.expr_encoding) - (req "operations" (list Operation.internal_operation_encoding)) - (opt "big_map_diff" Contract.big_map_diff_encoding)) + ~description:"Run a piece of code in the current context" + ~query:RPC_query.empty + ~input:run_code_input_encoding + ~output: + (obj3 + (req "storage" Script.expr_encoding) + (req "operations" (list Operation.internal_operation_encoding)) + (opt "big_map_diff" Contract.big_map_diff_encoding)) RPC_path.(path / "run_code") let trace_code = RPC_service.post_service - ~description: "Run a piece of code in the current context, \ - keeping a trace" - ~query: RPC_query.empty - ~input: run_code_input_encoding - ~output: (obj4 - (req "storage" Script.expr_encoding) - (req "operations" (list Operation.internal_operation_encoding)) - (req "trace" trace_encoding) - (opt "big_map_diff" Contract.big_map_diff_encoding)) + ~description: + "Run a piece of code in the current context, keeping a trace" + ~query:RPC_query.empty + ~input:run_code_input_encoding + ~output: + (obj4 + (req "storage" Script.expr_encoding) + (req "operations" (list Operation.internal_operation_encoding)) + (req "trace" trace_encoding) + (opt "big_map_diff" Contract.big_map_diff_encoding)) RPC_path.(path / "trace_code") let typecheck_code = RPC_service.post_service - ~description: "Typecheck a piece of code in the current context" - ~query: RPC_query.empty - ~input: (obj2 - (req "program" Script.expr_encoding) - (opt "gas" z)) - ~output: (obj2 - (req "type_map" Script_tc_errors_registration.type_map_enc) - (req "gas" Gas.encoding)) + ~description:"Typecheck a piece of code in the current context" + ~query:RPC_query.empty + ~input:(obj2 (req "program" Script.expr_encoding) (opt "gas" z)) + ~output: + (obj2 + (req "type_map" Script_tc_errors_registration.type_map_enc) + (req "gas" Gas.encoding)) RPC_path.(path / "typecheck_code") let typecheck_data = RPC_service.post_service - ~description: "Check that some data expression is well formed \ - and of a given type in the current context" - ~query: RPC_query.empty - ~input: (obj3 - (req "data" Script.expr_encoding) - (req "type" Script.expr_encoding) - (opt "gas" z)) - ~output: (obj1 (req "gas" Gas.encoding)) + ~description: + "Check that some data expression is well formed and of a given type \ + in the current context" + ~query:RPC_query.empty + ~input: + (obj3 + (req "data" Script.expr_encoding) + (req "type" Script.expr_encoding) + (opt "gas" z)) + ~output:(obj1 (req "gas" Gas.encoding)) RPC_path.(path / "typecheck_data") let pack_data = RPC_service.post_service - ~description: "Computes the serialized version of some data expression \ - using the same algorithm as script instruction PACK" - - ~input: (obj3 - (req "data" Script.expr_encoding) - (req "type" Script.expr_encoding) - (opt "gas" z)) - ~output: (obj2 - (req "packed" bytes) - (req "gas" Gas.encoding)) - ~query: RPC_query.empty + ~description: + "Computes the serialized version of some data expression using the \ + same algorithm as script instruction PACK" + ~input: + (obj3 + (req "data" Script.expr_encoding) + (req "type" Script.expr_encoding) + (opt "gas" z)) + ~output:(obj2 (req "packed" bytes) (req "gas" Gas.encoding)) + ~query:RPC_query.empty RPC_path.(path / "pack_data") let run_operation = RPC_service.post_service - ~description: - "Run an operation without signature checks" - ~query: RPC_query.empty - ~input: (obj2 - (req "operation" Operation.encoding) - (req "chain_id" Chain_id.encoding)) - ~output: Apply_results.operation_data_and_metadata_encoding + ~description:"Run an operation without signature checks" + ~query:RPC_query.empty + ~input: + (obj2 + (req "operation" Operation.encoding) + (req "chain_id" Chain_id.encoding)) + ~output:Apply_results.operation_data_and_metadata_encoding RPC_path.(path / "run_operation") let entrypoint_type = RPC_service.post_service - ~description: "Return the type of the given entrypoint" - ~query: RPC_query.empty - ~input: (obj2 - (req "script" Script.expr_encoding) - (dft "entrypoint" string "default")) - ~output: (obj1 - (req "entrypoint_type" Script.expr_encoding)) + ~description:"Return the type of the given entrypoint" + ~query:RPC_query.empty + ~input: + (obj2 + (req "script" Script.expr_encoding) + (dft "entrypoint" string "default")) + ~output:(obj1 (req "entrypoint_type" Script.expr_encoding)) RPC_path.(path / "entrypoint") - let list_entrypoints = RPC_service.post_service - ~description: "Return the list of entrypoints of the given script" - ~query: RPC_query.empty - ~input: (obj1 - (req "script" Script.expr_encoding)) - ~output: (obj2 - (dft "unreachable" - (Data_encoding.list - (obj1 (req "path" (Data_encoding.list Michelson_v1_primitives.prim_encoding)))) - []) - (req "entrypoints" - (assoc Script.expr_encoding))) + ~description:"Return the list of entrypoints of the given script" + ~query:RPC_query.empty + ~input:(obj1 (req "script" Script.expr_encoding)) + ~output: + (obj2 + (dft + "unreachable" + (Data_encoding.list + (obj1 + (req + "path" + (Data_encoding.list + Michelson_v1_primitives.prim_encoding)))) + []) + (req "entrypoints" (assoc Script.expr_encoding))) RPC_path.(path / "entrypoints") - end let register () = let open Services_registration in let originate_dummy_contract ctxt script = let ctxt = Contract.init_origination_nonce ctxt Operation_hash.zero in - Contract.fresh_contract_from_current_nonce ctxt >>=? fun (ctxt, dummy_contract) -> - let balance = match Tez.of_mutez 4_000_000_000_000L with - | Some balance -> balance - | None -> assert false in - Contract.originate ctxt dummy_contract + Contract.fresh_contract_from_current_nonce ctxt + >>=? fun (ctxt, dummy_contract) -> + let balance = + match Tez.of_mutez 4_000_000_000_000L with + | Some balance -> + balance + | None -> + assert false + in + Contract.originate + ctxt + dummy_contract ~balance - ~delegate: None - ~script: (script, None) >>=? fun ctxt -> - return (ctxt, dummy_contract) in - register0 S.run_code begin fun ctxt () - (code, storage, parameter, amount, chain_id, source, payer, gas, entrypoint) -> - let storage = Script.lazy_expr storage in - let code = Script.lazy_expr code in - originate_dummy_contract ctxt { storage ; code } >>=? fun (ctxt, dummy_contract) -> - let source, payer = match source, payer with - | Some source, Some payer -> source, payer - | Some source, None -> source, source - | None, Some payer -> payer, payer - | None, None -> dummy_contract, dummy_contract in - let gas = match gas with - | Some gas -> gas - | None -> Constants.hard_gas_limit_per_operation ctxt in - let ctxt = Gas.set_limit ctxt gas in - let step_constants = - let open Script_interpreter in - { source ; - payer ; - self = dummy_contract ; - amount ; - chain_id } in - Script_interpreter.execute - ctxt Readable - step_constants - ~script:{ storage ; code } - ~entrypoint - ~parameter - >>=? fun { Script_interpreter.storage ; operations ; big_map_diff ; _ } -> - return (storage, operations, big_map_diff) - end ; - register0 S.trace_code begin fun ctxt () - (code, storage, parameter, amount, chain_id, source, payer, gas, entrypoint) -> - let storage = Script.lazy_expr storage in - let code = Script.lazy_expr code in - originate_dummy_contract ctxt { storage ; code } >>=? fun (ctxt, dummy_contract) -> - let source, payer = match source, payer with - | Some source, Some payer -> source, payer - | Some source, None -> source, source - | None, Some payer -> payer, payer - | None, None -> dummy_contract, dummy_contract in - let gas = match gas with - | Some gas -> gas - | None -> Constants.hard_gas_limit_per_operation ctxt in - let ctxt = Gas.set_limit ctxt gas in - let step_constants = - let open Script_interpreter in - { source ; - payer ; - self = dummy_contract ; - amount ; - chain_id } in - Script_interpreter.trace - ctxt Readable - step_constants - ~script:{ storage ; code } - ~entrypoint - ~parameter - >>=? fun ({ Script_interpreter.storage ; operations ; big_map_diff ; _ }, trace) -> - return (storage, operations, trace, big_map_diff) - end ; - register0 S.typecheck_code begin fun ctxt () (expr, maybe_gas) -> - let ctxt = match maybe_gas with - | None -> Gas.set_unlimited ctxt - | Some gas -> Gas.set_limit ctxt gas in - Script_ir_translator.typecheck_code ctxt expr >>=? fun (res, ctxt) -> - return (res, Gas.level ctxt) - end ; - register0 S.typecheck_data begin fun ctxt () (data, ty, maybe_gas) -> - let ctxt = match maybe_gas with - | None -> Gas.set_unlimited ctxt - | Some gas -> Gas.set_limit ctxt gas in - Script_ir_translator.typecheck_data ctxt (data, ty) >>=? fun ctxt -> - return (Gas.level ctxt) - end ; - register0 S.pack_data begin fun ctxt () (expr, typ, maybe_gas) -> - let open Script_ir_translator in - let ctxt = match maybe_gas with - | None -> Gas.set_unlimited ctxt - | Some gas -> Gas.set_limit ctxt gas in - Lwt.return (parse_packable_ty ctxt ~legacy:true (Micheline.root typ)) >>=? fun (Ex_ty typ, ctxt) -> - parse_data ctxt ~legacy:true typ (Micheline.root expr) >>=? fun (data, ctxt) -> - Script_ir_translator.pack_data ctxt typ data >>=? fun (bytes, ctxt) -> - return (bytes, Gas.level ctxt) - end ; - register0 S.run_operation begin fun ctxt () - ({ shell ; protocol_data = Operation_data protocol_data }, chain_id) -> - (* this code is a duplicate of Apply without signature check *) - let partial_precheck_manager_contents - (type kind) ctxt (op : kind Kind.manager contents) - : context tzresult Lwt.t = - let Manager_operation { source ; fee ; counter ; operation ; gas_limit ; storage_limit } = op in - Lwt.return (Gas.check_limit ctxt gas_limit) >>=? fun () -> - let ctxt = Gas.set_limit ctxt gas_limit in - Lwt.return (Fees.check_storage_limit ctxt storage_limit) >>=? fun () -> - Contract.must_be_allocated ctxt (Contract.implicit_contract source) >>=? fun () -> - Contract.check_counter_increment ctxt source counter >>=? fun () -> - begin - match operation with + ~delegate:None + ~script:(script, None) + >>=? fun ctxt -> return (ctxt, dummy_contract) + in + register0 + S.run_code + (fun ctxt + () + ( code, + storage, + parameter, + amount, + chain_id, + source, + payer, + gas, + entrypoint ) + -> + let storage = Script.lazy_expr storage in + let code = Script.lazy_expr code in + originate_dummy_contract ctxt {storage; code} + >>=? fun (ctxt, dummy_contract) -> + let (source, payer) = + match (source, payer) with + | (Some source, Some payer) -> + (source, payer) + | (Some source, None) -> + (source, source) + | (None, Some payer) -> + (payer, payer) + | (None, None) -> + (dummy_contract, dummy_contract) + in + let gas = + match gas with + | Some gas -> + gas + | None -> + Constants.hard_gas_limit_per_operation ctxt + in + let ctxt = Gas.set_limit ctxt gas in + let step_constants = + let open Script_interpreter in + {source; payer; self = dummy_contract; amount; chain_id} + in + Script_interpreter.execute + ctxt + Readable + step_constants + ~script:{storage; code} + ~entrypoint + ~parameter + >>=? fun {Script_interpreter.storage; operations; big_map_diff; _} -> + return (storage, operations, big_map_diff)) ; + register0 + S.trace_code + (fun ctxt + () + ( code, + storage, + parameter, + amount, + chain_id, + source, + payer, + gas, + entrypoint ) + -> + let storage = Script.lazy_expr storage in + let code = Script.lazy_expr code in + originate_dummy_contract ctxt {storage; code} + >>=? fun (ctxt, dummy_contract) -> + let (source, payer) = + match (source, payer) with + | (Some source, Some payer) -> + (source, payer) + | (Some source, None) -> + (source, source) + | (None, Some payer) -> + (payer, payer) + | (None, None) -> + (dummy_contract, dummy_contract) + in + let gas = + match gas with + | Some gas -> + gas + | None -> + Constants.hard_gas_limit_per_operation ctxt + in + let ctxt = Gas.set_limit ctxt gas in + let step_constants = + let open Script_interpreter in + {source; payer; self = dummy_contract; amount; chain_id} + in + Script_interpreter.trace + ctxt + Readable + step_constants + ~script:{storage; code} + ~entrypoint + ~parameter + >>=? fun ( {Script_interpreter.storage; operations; big_map_diff; _}, + trace ) -> + return (storage, operations, trace, big_map_diff)) ; + register0 S.typecheck_code (fun ctxt () (expr, maybe_gas) -> + let ctxt = + match maybe_gas with + | None -> + Gas.set_unlimited ctxt + | Some gas -> + Gas.set_limit ctxt gas + in + Script_ir_translator.typecheck_code ctxt expr + >>=? fun (res, ctxt) -> return (res, Gas.level ctxt)) ; + register0 S.typecheck_data (fun ctxt () (data, ty, maybe_gas) -> + let ctxt = + match maybe_gas with + | None -> + Gas.set_unlimited ctxt + | Some gas -> + Gas.set_limit ctxt gas + in + Script_ir_translator.typecheck_data ctxt (data, ty) + >>=? fun ctxt -> return (Gas.level ctxt)) ; + register0 S.pack_data (fun ctxt () (expr, typ, maybe_gas) -> + let open Script_ir_translator in + let ctxt = + match maybe_gas with + | None -> + Gas.set_unlimited ctxt + | Some gas -> + Gas.set_limit ctxt gas + in + Lwt.return (parse_packable_ty ctxt ~legacy:true (Micheline.root typ)) + >>=? fun (Ex_ty typ, ctxt) -> + parse_data ctxt ~legacy:true typ (Micheline.root expr) + >>=? fun (data, ctxt) -> + Script_ir_translator.pack_data ctxt typ data + >>=? fun (bytes, ctxt) -> return (bytes, Gas.level ctxt)) ; + register0 + S.run_operation + (fun ctxt + () + ({shell; protocol_data = Operation_data protocol_data}, chain_id) + -> + (* this code is a duplicate of Apply without signature check *) + let partial_precheck_manager_contents (type kind) ctxt + (op : kind Kind.manager contents) : context tzresult Lwt.t = + let (Manager_operation + {source; fee; counter; operation; gas_limit; storage_limit}) = + op + in + Lwt.return (Gas.check_limit ctxt gas_limit) + >>=? fun () -> + let ctxt = Gas.set_limit ctxt gas_limit in + Lwt.return (Fees.check_storage_limit ctxt storage_limit) + >>=? fun () -> + Contract.must_be_allocated ctxt (Contract.implicit_contract source) + >>=? fun () -> + Contract.check_counter_increment ctxt source counter + >>=? fun () -> + ( match operation with | Reveal pk -> Contract.reveal_manager_key ctxt source pk - | Transaction { parameters ; _ } -> + | Transaction {parameters; _} -> (* Here the data comes already deserialized, so we need to fake the deserialization to mimic apply *) - let arg_bytes = Data_encoding.Binary.to_bytes_exn Script.lazy_expr_encoding parameters in - let arg = match Data_encoding.Binary.of_bytes Script.lazy_expr_encoding arg_bytes with - | Some arg -> arg - | None -> assert false in + let arg_bytes = + Data_encoding.Binary.to_bytes_exn + Script.lazy_expr_encoding + parameters + in + let arg = + match + Data_encoding.Binary.of_bytes + Script.lazy_expr_encoding + arg_bytes + with + | Some arg -> + arg + | None -> + assert false + in (* Fail quickly if not enough gas for minimal deserialization cost *) - Lwt.return @@ record_trace Apply.Gas_quota_exceeded_init_deserialize @@ - Gas.check_enough ctxt (Script.minimal_deserialize_cost arg) >>=? fun () -> + Lwt.return + @@ record_trace Apply.Gas_quota_exceeded_init_deserialize + @@ Gas.check_enough ctxt (Script.minimal_deserialize_cost arg) + >>=? fun () -> (* Fail if not enough gas for complete deserialization cost *) - trace Apply.Gas_quota_exceeded_init_deserialize @@ - Script.force_decode ctxt arg >>|? fun (_arg, ctxt) -> ctxt - | Origination { script = script ; _ } -> + trace Apply.Gas_quota_exceeded_init_deserialize + @@ Script.force_decode ctxt arg + >>|? fun (_arg, ctxt) -> ctxt + | Origination {script; _} -> (* Here the data comes already deserialized, so we need to fake the deserialization to mimic apply *) - let script_bytes = Data_encoding.Binary.to_bytes_exn Script.encoding script in - let script = match Data_encoding.Binary.of_bytes Script.encoding script_bytes with - | Some script -> script - | None -> assert false in + let script_bytes = + Data_encoding.Binary.to_bytes_exn Script.encoding script + in + let script = + match + Data_encoding.Binary.of_bytes Script.encoding script_bytes + with + | Some script -> + script + | None -> + assert false + in (* Fail quickly if not enough gas for minimal deserialization cost *) - Lwt.return @@ record_trace Apply.Gas_quota_exceeded_init_deserialize @@ - (Gas.consume ctxt (Script.minimal_deserialize_cost script.code) >>? fun ctxt -> - Gas.check_enough ctxt (Script.minimal_deserialize_cost script.storage)) >>=? fun () -> + Lwt.return + @@ record_trace Apply.Gas_quota_exceeded_init_deserialize + @@ ( Gas.consume + ctxt + (Script.minimal_deserialize_cost script.code) + >>? fun ctxt -> + Gas.check_enough + ctxt + (Script.minimal_deserialize_cost script.storage) ) + >>=? fun () -> (* Fail if not enough gas for complete deserialization cost *) - trace Apply.Gas_quota_exceeded_init_deserialize @@ - Script.force_decode ctxt script.code >>=? fun (_code, ctxt) -> - trace Apply.Gas_quota_exceeded_init_deserialize @@ - Script.force_decode ctxt script.storage >>|? fun (_storage, ctxt) -> ctxt - | _ -> return ctxt - end >>=? fun ctxt -> - Contract.get_manager_key ctxt source >>=? fun _public_key -> - (* signature check unplugged from here *) - Contract.increment_counter ctxt source >>=? fun ctxt -> - Contract.spend ctxt (Contract.implicit_contract source) fee >>=? fun ctxt -> - return ctxt in - let rec partial_precheck_manager_contents_list - : type kind. - Alpha_context.t -> kind Kind.manager contents_list -> - context tzresult Lwt.t = - fun ctxt contents_list -> + trace Apply.Gas_quota_exceeded_init_deserialize + @@ Script.force_decode ctxt script.code + >>=? fun (_code, ctxt) -> + trace Apply.Gas_quota_exceeded_init_deserialize + @@ Script.force_decode ctxt script.storage + >>|? fun (_storage, ctxt) -> ctxt + | _ -> + return ctxt ) + >>=? fun ctxt -> + Contract.get_manager_key ctxt source + >>=? fun _public_key -> + (* signature check unplugged from here *) + Contract.increment_counter ctxt source + >>=? fun ctxt -> + Contract.spend ctxt (Contract.implicit_contract source) fee + >>=? fun ctxt -> return ctxt + in + let rec partial_precheck_manager_contents_list : + type kind. + Alpha_context.t -> + kind Kind.manager contents_list -> + context tzresult Lwt.t = + fun ctxt contents_list -> match contents_list with | Single (Manager_operation _ as op) -> partial_precheck_manager_contents ctxt op - | Cons (Manager_operation _ as op, rest) -> - partial_precheck_manager_contents ctxt op >>=? fun ctxt -> - partial_precheck_manager_contents_list ctxt rest in - let return contents = - return (Operation_data protocol_data, - Apply_results.Operation_metadata { contents }) in - let operation : _ operation = { shell ; protocol_data } in - let hash = Operation.hash { shell ; protocol_data } in - let ctxt = Contract.init_origination_nonce ctxt hash in - let baker = Signature.Public_key_hash.zero in - match protocol_data.contents with - | Single (Manager_operation _) as op -> - partial_precheck_manager_contents_list ctxt op >>=? fun ctxt -> - Apply.apply_manager_contents_list ctxt Optimized baker chain_id op >>= fun (_ctxt, result) -> - return result - | Cons (Manager_operation _, _) as op -> - partial_precheck_manager_contents_list ctxt op >>=? fun ctxt -> - Apply.apply_manager_contents_list ctxt Optimized baker chain_id op >>= fun (_ctxt, result) -> - return result - | _ -> - Apply.apply_contents_list - ctxt chain_id Optimized shell.branch baker operation - operation.protocol_data.contents >>=? fun (_ctxt, result) -> - return result - end; - register0 S.entrypoint_type begin fun ctxt () (expr, entrypoint) -> - let ctxt = Gas.set_unlimited ctxt in - let legacy = false in - let open Script_ir_translator in - Lwt.return - begin - parse_toplevel ~legacy expr >>? fun (arg_type, _, _, root_name) -> - parse_ty ctxt ~legacy - ~allow_big_map:true ~allow_operation:false - ~allow_contract:true arg_type >>? fun (Ex_ty arg_type, _) -> - Script_ir_translator.find_entrypoint ~root_name arg_type - entrypoint - end >>=? fun (_f , Ex_ty ty)-> - unparse_ty ctxt ty >>=? fun (ty_node, _) -> - return (Micheline.strip_locations ty_node) - end ; - register0 S.list_entrypoints begin fun ctxt () expr -> - let ctxt = Gas.set_unlimited ctxt in - let legacy = false in - let open Script_ir_translator in - Lwt.return - begin - parse_toplevel ~legacy expr >>? fun (arg_type, _, _, root_name) -> - parse_ty ctxt ~legacy - ~allow_big_map:true ~allow_operation:false - ~allow_contract:true arg_type >>? fun (Ex_ty arg_type, _) -> - Script_ir_translator.list_entrypoints ~root_name arg_type ctxt - end >>=? fun (unreachable_entrypoint,map) -> - return - (unreachable_entrypoint, - Entrypoints_map.fold - begin fun entry (_,ty) acc -> - (entry , Micheline.strip_locations ty) ::acc end - map []) - end + | Cons ((Manager_operation _ as op), rest) -> + partial_precheck_manager_contents ctxt op + >>=? fun ctxt -> partial_precheck_manager_contents_list ctxt rest + in + let return contents = + return + ( Operation_data protocol_data, + Apply_results.Operation_metadata {contents} ) + in + let operation : _ operation = {shell; protocol_data} in + let hash = Operation.hash {shell; protocol_data} in + let ctxt = Contract.init_origination_nonce ctxt hash in + let baker = Signature.Public_key_hash.zero in + match protocol_data.contents with + | Single (Manager_operation _) as op -> + partial_precheck_manager_contents_list ctxt op + >>=? fun ctxt -> + Apply.apply_manager_contents_list ctxt Optimized baker chain_id op + >>= fun (_ctxt, result) -> return result + | Cons (Manager_operation _, _) as op -> + partial_precheck_manager_contents_list ctxt op + >>=? fun ctxt -> + Apply.apply_manager_contents_list ctxt Optimized baker chain_id op + >>= fun (_ctxt, result) -> return result + | _ -> + Apply.apply_contents_list + ctxt + chain_id + Optimized + shell.branch + baker + operation + operation.protocol_data.contents + >>=? fun (_ctxt, result) -> return result) ; + register0 S.entrypoint_type (fun ctxt () (expr, entrypoint) -> + let ctxt = Gas.set_unlimited ctxt in + let legacy = false in + let open Script_ir_translator in + Lwt.return + ( parse_toplevel ~legacy expr + >>? fun (arg_type, _, _, root_name) -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:true + arg_type + >>? fun (Ex_ty arg_type, _) -> + Script_ir_translator.find_entrypoint ~root_name arg_type entrypoint + ) + >>=? fun (_f, Ex_ty ty) -> + unparse_ty ctxt ty + >>=? fun (ty_node, _) -> return (Micheline.strip_locations ty_node)) ; + register0 S.list_entrypoints (fun ctxt () expr -> + let ctxt = Gas.set_unlimited ctxt in + let legacy = false in + let open Script_ir_translator in + Lwt.return + ( parse_toplevel ~legacy expr + >>? fun (arg_type, _, _, root_name) -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:true + arg_type + >>? fun (Ex_ty arg_type, _) -> + Script_ir_translator.list_entrypoints ~root_name arg_type ctxt ) + >>=? fun (unreachable_entrypoint, map) -> + return + ( unreachable_entrypoint, + Entrypoints_map.fold + (fun entry (_, ty) acc -> + (entry, Micheline.strip_locations ty) :: acc) + map + [] )) - let run_code ctxt block code (storage, input, amount, chain_id, source, payer, gas, entrypoint) = - RPC_context.make_call0 S.run_code ctxt - block () (code, storage, input, amount, chain_id, source, payer, gas, entrypoint) + let run_code ctxt block code + (storage, input, amount, chain_id, source, payer, gas, entrypoint) = + RPC_context.make_call0 + S.run_code + ctxt + block + () + (code, storage, input, amount, chain_id, source, payer, gas, entrypoint) - let trace_code ctxt block code (storage, input, amount, chain_id, source, payer, gas, entrypoint) = - RPC_context.make_call0 S.trace_code ctxt - block () (code, storage, input, amount, chain_id, source, payer, gas, entrypoint) + let trace_code ctxt block code + (storage, input, amount, chain_id, source, payer, gas, entrypoint) = + RPC_context.make_call0 + S.trace_code + ctxt + block + () + (code, storage, input, amount, chain_id, source, payer, gas, entrypoint) let typecheck_code ctxt block = RPC_context.make_call0 S.typecheck_code ctxt block () @@ -414,8 +548,7 @@ module Scripts = struct let typecheck_data ctxt block = RPC_context.make_call0 S.typecheck_data ctxt block () - let pack_data ctxt block = - RPC_context.make_call0 S.pack_data ctxt block () + let pack_data ctxt block = RPC_context.make_call0 S.pack_data ctxt block () let run_operation ctxt block = RPC_context.make_call0 S.run_operation ctxt block () @@ -425,14 +558,10 @@ module Scripts = struct let list_entrypoints ctxt block = RPC_context.make_call0 S.list_entrypoints ctxt block () - - end module Forge = struct - module S = struct - open Data_encoding let path = RPC_path.(path / "forge") @@ -440,158 +569,206 @@ module Forge = struct let operations = RPC_service.post_service ~description:"Forge an operation" - ~query: RPC_query.empty - ~input: Operation.unsigned_encoding - ~output: bytes - RPC_path.(path / "operations" ) + ~query:RPC_query.empty + ~input:Operation.unsigned_encoding + ~output:bytes + RPC_path.(path / "operations") let empty_proof_of_work_nonce = MBytes.of_string - (String.make Constants_repr.proof_of_work_nonce_size '\000') + (String.make Constants_repr.proof_of_work_nonce_size '\000') let protocol_data = RPC_service.post_service - ~description: "Forge the protocol-specific part of a block header" - ~query: RPC_query.empty + ~description:"Forge the protocol-specific part of a block header" + ~query:RPC_query.empty ~input: (obj3 (req "priority" uint16) (opt "nonce_hash" Nonce_hash.encoding) - (dft "proof_of_work_nonce" - (Fixed.bytes - Alpha_context.Constants.proof_of_work_nonce_size) + (dft + "proof_of_work_nonce" + (Fixed.bytes Alpha_context.Constants.proof_of_work_nonce_size) empty_proof_of_work_nonce)) - ~output: (obj1 (req "protocol_data" bytes)) + ~output:(obj1 (req "protocol_data" bytes)) RPC_path.(path / "protocol_data") - end let register () = let open Services_registration in - register0_noctxt S.operations begin fun () (shell, proto) -> - return (Data_encoding.Binary.to_bytes_exn - Operation.unsigned_encoding (shell, proto)) - end ; - register0_noctxt S.protocol_data begin fun () - (priority, seed_nonce_hash, proof_of_work_nonce) -> - return (Data_encoding.Binary.to_bytes_exn - Block_header.contents_encoding - { priority ; seed_nonce_hash ; proof_of_work_nonce }) - end + register0_noctxt S.operations (fun () (shell, proto) -> + return + (Data_encoding.Binary.to_bytes_exn + Operation.unsigned_encoding + (shell, proto))) ; + register0_noctxt + S.protocol_data + (fun () (priority, seed_nonce_hash, proof_of_work_nonce) -> + return + (Data_encoding.Binary.to_bytes_exn + Block_header.contents_encoding + {priority; seed_nonce_hash; proof_of_work_nonce})) module Manager = struct - - let operations ctxt - block ~branch ~source ?sourcePubKey ~counter ~fee + let operations ctxt block ~branch ~source ?sourcePubKey ~counter ~fee ~gas_limit ~storage_limit operations = - Contract_services.manager_key ctxt block source >>= function - | Error _ as e -> Lwt.return e + Contract_services.manager_key ctxt block source + >>= function + | Error _ as e -> + Lwt.return e | Ok revealed -> let ops = List.map (fun (Manager operation) -> - Contents - (Manager_operation { source ; - counter ; operation ; fee ; - gas_limit ; storage_limit })) - operations in + Contents + (Manager_operation + { + source; + counter; + operation; + fee; + gas_limit; + storage_limit; + })) + operations + in let ops = - match sourcePubKey, revealed with - | None, _ | _, Some _ -> ops - | Some pk, None -> + match (sourcePubKey, revealed) with + | (None, _) | (_, Some _) -> + ops + | (Some pk, None) -> let operation = Reveal pk in Contents - (Manager_operation { source ; - counter ; operation ; fee ; - gas_limit ; storage_limit }) :: ops in - RPC_context.make_call0 S.operations ctxt block - () ({ branch }, Operation.of_list ops) + (Manager_operation + { + source; + counter; + operation; + fee; + gas_limit; + storage_limit; + }) + :: ops + in + RPC_context.make_call0 + S.operations + ctxt + block + () + ({branch}, Operation.of_list ops) - let reveal ctxt - block ~branch ~source ~sourcePubKey ~counter ~fee () = - operations ctxt block ~branch ~source ~sourcePubKey ~counter ~fee - ~gas_limit:Z.zero ~storage_limit:Z.zero [] + let reveal ctxt block ~branch ~source ~sourcePubKey ~counter ~fee () = + operations + ctxt + block + ~branch + ~source + ~sourcePubKey + ~counter + ~fee + ~gas_limit:Z.zero + ~storage_limit:Z.zero + [] - let transaction ctxt - block ~branch ~source ?sourcePubKey ~counter - ~amount ~destination ?(entrypoint = "default") ?parameters - ~gas_limit ~storage_limit ~fee ()= - let parameters = Option.unopt_map ~f:Script.lazy_expr ~default:Script.unit_parameter parameters in - operations ctxt block ~branch ~source ?sourcePubKey ~counter - ~fee ~gas_limit ~storage_limit - [Manager (Transaction { amount ; parameters ; destination ; entrypoint })] + let transaction ctxt block ~branch ~source ?sourcePubKey ~counter ~amount + ~destination ?(entrypoint = "default") ?parameters ~gas_limit + ~storage_limit ~fee () = + let parameters = + Option.unopt_map + ~f:Script.lazy_expr + ~default:Script.unit_parameter + parameters + in + operations + ctxt + block + ~branch + ~source + ?sourcePubKey + ~counter + ~fee + ~gas_limit + ~storage_limit + [Manager (Transaction {amount; parameters; destination; entrypoint})] - let origination ctxt - block ~branch - ~source ?sourcePubKey ~counter - ~balance - ?delegatePubKey ~script - ~gas_limit ~storage_limit ~fee () = - operations ctxt block ~branch ~source ?sourcePubKey ~counter - ~fee ~gas_limit ~storage_limit - [Manager (Origination { delegate = delegatePubKey ; - script ; - credit = balance ; - preorigination = None })] + let origination ctxt block ~branch ~source ?sourcePubKey ~counter ~balance + ?delegatePubKey ~script ~gas_limit ~storage_limit ~fee () = + operations + ctxt + block + ~branch + ~source + ?sourcePubKey + ~counter + ~fee + ~gas_limit + ~storage_limit + [ Manager + (Origination + { + delegate = delegatePubKey; + script; + credit = balance; + preorigination = None; + }) ] - let delegation ctxt - block ~branch ~source ?sourcePubKey ~counter ~fee delegate = - operations ctxt block ~branch ~source ?sourcePubKey ~counter ~fee - ~gas_limit:Z.zero ~storage_limit:Z.zero + let delegation ctxt block ~branch ~source ?sourcePubKey ~counter ~fee + delegate = + operations + ctxt + block + ~branch + ~source + ?sourcePubKey + ~counter + ~fee + ~gas_limit:Z.zero + ~storage_limit:Z.zero [Manager (Delegation delegate)] - end - let operation ctxt - block ~branch operation = - RPC_context.make_call0 S.operations ctxt block - () ({ branch }, Contents_list (Single operation)) + let operation ctxt block ~branch operation = + RPC_context.make_call0 + S.operations + ctxt + block + () + ({branch}, Contents_list (Single operation)) - let endorsement ctxt - b ~branch ~level () = - operation ctxt b ~branch - (Endorsement { level }) + let endorsement ctxt b ~branch ~level () = + operation ctxt b ~branch (Endorsement {level}) - let proposals ctxt - b ~branch ~source ~period ~proposals () = - operation ctxt b ~branch - (Proposals { source ; period ; proposals }) + let proposals ctxt b ~branch ~source ~period ~proposals () = + operation ctxt b ~branch (Proposals {source; period; proposals}) - let ballot ctxt - b ~branch ~source ~period ~proposal ~ballot () = - operation ctxt b ~branch - (Ballot { source ; period ; proposal ; ballot }) + let ballot ctxt b ~branch ~source ~period ~proposal ~ballot () = + operation ctxt b ~branch (Ballot {source; period; proposal; ballot}) - let seed_nonce_revelation ctxt - block ~branch ~level ~nonce () = - operation ctxt block ~branch (Seed_nonce_revelation { level ; nonce }) + let seed_nonce_revelation ctxt block ~branch ~level ~nonce () = + operation ctxt block ~branch (Seed_nonce_revelation {level; nonce}) - let double_baking_evidence ctxt - block ~branch ~bh1 ~bh2 () = - operation ctxt block ~branch (Double_baking_evidence { bh1 ; bh2 }) + let double_baking_evidence ctxt block ~branch ~bh1 ~bh2 () = + operation ctxt block ~branch (Double_baking_evidence {bh1; bh2}) - let double_endorsement_evidence ctxt - block ~branch ~op1 ~op2 () = - operation ctxt block ~branch (Double_endorsement_evidence { op1 ; op2 }) + let double_endorsement_evidence ctxt block ~branch ~op1 ~op2 () = + operation ctxt block ~branch (Double_endorsement_evidence {op1; op2}) let empty_proof_of_work_nonce = MBytes.of_string - (String.make Constants_repr.proof_of_work_nonce_size '\000') + (String.make Constants_repr.proof_of_work_nonce_size '\000') - let protocol_data ctxt + let protocol_data ctxt block ~priority ?seed_nonce_hash + ?(proof_of_work_nonce = empty_proof_of_work_nonce) () = + RPC_context.make_call0 + S.protocol_data + ctxt block - ~priority ?seed_nonce_hash - ?(proof_of_work_nonce = empty_proof_of_work_nonce) - () = - RPC_context.make_call0 S.protocol_data - ctxt block () (priority, seed_nonce_hash, proof_of_work_nonce) - + () + (priority, seed_nonce_hash, proof_of_work_nonce) end module Parse = struct - module S = struct - open Data_encoding let path = RPC_path.(path / "parse") @@ -599,22 +776,21 @@ module Parse = struct let operations = RPC_service.post_service ~description:"Parse operations" - ~query: RPC_query.empty + ~query:RPC_query.empty ~input: (obj2 (req "operations" (list (dynamic_size Operation.raw_encoding))) (opt "check_signature" bool)) - ~output: (list (dynamic_size Operation.encoding)) - RPC_path.(path / "operations" ) + ~output:(list (dynamic_size Operation.encoding)) + RPC_path.(path / "operations") let block = RPC_service.post_service ~description:"Parse a block" - ~query: RPC_query.empty - ~input: Block_header.raw_encoding - ~output: Block_header.protocol_data_encoding - RPC_path.(path / "block" ) - + ~query:RPC_query.empty + ~input:Block_header.raw_encoding + ~output:Block_header.protocol_data_encoding + RPC_path.(path / "block") end let parse_protocol_data protocol_data = @@ -623,68 +799,70 @@ module Parse = struct Block_header.protocol_data_encoding protocol_data with - | None -> failwith "Cant_parse_protocol_data" - | Some protocol_data -> return protocol_data + | None -> + failwith "Cant_parse_protocol_data" + | Some protocol_data -> + return protocol_data let register () = let open Services_registration in - register0 S.operations begin fun _ctxt () (operations, check) -> - map_s begin fun raw -> - Lwt.return (parse_operation raw) >>=? fun op -> - begin match check with - | Some true -> - return_unit (* FIXME *) - (* I.check_signature ctxt *) - (* op.protocol_data.signature op.shell op.protocol_data.contents *) - | Some false | None -> return_unit - end >>|? fun () -> op - end operations - end ; - register0_noctxt S.block begin fun () raw_block -> - parse_protocol_data raw_block.protocol_data - end + register0 S.operations (fun _ctxt () (operations, check) -> + map_s + (fun raw -> + Lwt.return (parse_operation raw) + >>=? fun op -> + ( match check with + | Some true -> + return_unit (* FIXME *) + (* I.check_signature ctxt *) + (* op.protocol_data.signature op.shell op.protocol_data.contents *) + | Some false | None -> + return_unit ) + >>|? fun () -> op) + operations) ; + register0_noctxt S.block (fun () raw_block -> + parse_protocol_data raw_block.protocol_data) let operations ctxt block ?check operations = - RPC_context.make_call0 - S.operations ctxt block () (operations, check) + RPC_context.make_call0 S.operations ctxt block () (operations, check) + let block ctxt block shell protocol_data = RPC_context.make_call0 - S.block ctxt block () ({ shell ; protocol_data } : Block_header.raw) - + S.block + ctxt + block + () + ({shell; protocol_data} : Block_header.raw) end module S = struct - open Data_encoding - type level_query = { - offset: int32 ; - } + type level_query = {offset : int32} + let level_query : level_query RPC_query.t = let open RPC_query in - query (fun offset -> { offset }) + query (fun offset -> {offset}) |+ field "offset" RPC_arg.int32 0l (fun t -> t.offset) |> seal let current_level = RPC_service.get_service ~description: - "Returns the level of the interrogated block, or the one of a \ - block located `offset` blocks after in the chain (or before \ - when negative). For instance, the next block if `offset` is 1." - ~query: level_query - ~output: Level.encoding + "Returns the level of the interrogated block, or the one of a block \ + located `offset` blocks after in the chain (or before when \ + negative). For instance, the next block if `offset` is 1." + ~query:level_query + ~output:Level.encoding RPC_path.(path / "current_level") let levels_in_current_cycle = RPC_service.get_service - ~description: "Levels of a cycle" - ~query: level_query - ~output: (obj2 - (req "first" Raw_level.encoding) - (req "last" Raw_level.encoding)) + ~description:"Levels of a cycle" + ~query:level_query + ~output: + (obj2 (req "first" Raw_level.encoding) (req "last" Raw_level.encoding)) RPC_path.(path / "levels_in_current_cycle") - end let register () = @@ -692,22 +870,21 @@ let register () = Forge.register () ; Parse.register () ; let open Services_registration in - register0 S.current_level begin fun ctxt q () -> - let level = Level.current ctxt in - return (Level.from_raw ctxt ~offset:q.offset level.level) - end ; - register0 S.levels_in_current_cycle begin fun ctxt q () -> - let levels = Level.levels_in_current_cycle ctxt ~offset:q.offset () in - match levels with - | [] -> raise Not_found - | _ -> - let first = List.hd (List.rev levels) in - let last = List.hd levels in - return (first.level, last.level) - end + register0 S.current_level (fun ctxt q () -> + let level = Level.current ctxt in + return (Level.from_raw ctxt ~offset:q.offset level.level)) ; + register0 S.levels_in_current_cycle (fun ctxt q () -> + let levels = Level.levels_in_current_cycle ctxt ~offset:q.offset () in + match levels with + | [] -> + raise Not_found + | _ -> + let first = List.hd (List.rev levels) in + let last = List.hd levels in + return (first.level, last.level)) let current_level ctxt ?(offset = 0l) block = - RPC_context.make_call0 S.current_level ctxt block { offset } () + RPC_context.make_call0 S.current_level ctxt block {offset} () let levels_in_current_cycle ctxt ?(offset = 0l) block = - RPC_context.make_call0 S.levels_in_current_cycle ctxt block { offset } () + RPC_context.make_call0 S.levels_in_current_cycle ctxt block {offset} () diff --git a/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.mli b/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.mli index fc205d97b..ba0150594 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/helpers_services.mli @@ -27,69 +27,99 @@ open Alpha_context type error += Cannot_parse_operation (* `Branch *) -val current_level: - 'a #RPC_context.simple -> - ?offset:int32 -> 'a -> Level.t shell_tzresult Lwt.t +val current_level : + 'a #RPC_context.simple -> ?offset:int32 -> 'a -> Level.t shell_tzresult Lwt.t -val levels_in_current_cycle: +val levels_in_current_cycle : 'a #RPC_context.simple -> - ?offset:int32 -> 'a -> (Raw_level.t * Raw_level.t) shell_tzresult Lwt.t + ?offset:int32 -> + 'a -> + (Raw_level.t * Raw_level.t) shell_tzresult Lwt.t module Scripts : sig - - val run_code: + val run_code : 'a #RPC_context.simple -> - 'a -> Script.expr -> - (Script.expr * Script.expr * Tez.t * Chain_id.t * Contract.t option * Contract.t option * Z.t option * string) -> - (Script.expr * - packed_internal_operation list * - Contract.big_map_diff option) shell_tzresult Lwt.t + 'a -> + Script.expr -> + Script.expr + * Script.expr + * Tez.t + * Chain_id.t + * Contract.t option + * Contract.t option + * Z.t option + * string -> + ( Script.expr + * packed_internal_operation list + * Contract.big_map_diff option ) + shell_tzresult + Lwt.t - val trace_code: + val trace_code : 'a #RPC_context.simple -> - 'a -> Script.expr -> - (Script.expr * Script.expr * Tez.t * Chain_id.t * Contract.t option * Contract.t option * Z.t option * string) -> - (Script.expr * - packed_internal_operation list * - Script_interpreter.execution_trace * - Contract.big_map_diff option) shell_tzresult Lwt.t + 'a -> + Script.expr -> + Script.expr + * Script.expr + * Tez.t + * Chain_id.t + * Contract.t option + * Contract.t option + * Z.t option + * string -> + ( Script.expr + * packed_internal_operation list + * Script_interpreter.execution_trace + * Contract.big_map_diff option ) + shell_tzresult + Lwt.t - val typecheck_code: + val typecheck_code : 'a #RPC_context.simple -> - 'a -> (Script.expr * Z.t option) -> + 'a -> + Script.expr * Z.t option -> (Script_tc_errors.type_map * Gas.t) shell_tzresult Lwt.t - val typecheck_data: + val typecheck_data : 'a #RPC_context.simple -> - 'a -> Script.expr * Script.expr * Z.t option -> Gas.t shell_tzresult Lwt.t + 'a -> + Script.expr * Script.expr * Z.t option -> + Gas.t shell_tzresult Lwt.t - val pack_data: + val pack_data : 'a #RPC_context.simple -> - 'a -> Script.expr * Script.expr * Z.t option -> (MBytes.t * Gas.t) shell_tzresult Lwt.t + 'a -> + Script.expr * Script.expr * Z.t option -> + (MBytes.t * Gas.t) shell_tzresult Lwt.t - val run_operation: + val run_operation : 'a #RPC_context.simple -> - 'a -> packed_operation * Chain_id.t -> - (packed_protocol_data * Apply_results.packed_operation_metadata) shell_tzresult Lwt.t + 'a -> + packed_operation * Chain_id.t -> + (packed_protocol_data * Apply_results.packed_operation_metadata) + shell_tzresult + Lwt.t - val entrypoint_type: + val entrypoint_type : 'a #RPC_context.simple -> - 'a -> Script.expr * string -> Script.expr shell_tzresult Lwt.t + 'a -> + Script.expr * string -> + Script.expr shell_tzresult Lwt.t - val list_entrypoints: + val list_entrypoints : 'a #RPC_context.simple -> - 'a -> Script.expr -> - (Michelson_v1_primitives.prim list list * - (string * Script.expr) list) shell_tzresult Lwt.t - + 'a -> + Script.expr -> + (Michelson_v1_primitives.prim list list * (string * Script.expr) list) + shell_tzresult + Lwt.t end module Forge : sig - module Manager : sig - - val operations: - 'a #RPC_context.simple -> 'a -> + val operations : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> @@ -97,19 +127,23 @@ module Forge : sig fee:Tez.t -> gas_limit:Z.t -> storage_limit:Z.t -> - packed_manager_operation list -> MBytes.t shell_tzresult Lwt.t + packed_manager_operation list -> + MBytes.t shell_tzresult Lwt.t - val reveal: - 'a #RPC_context.simple -> 'a -> + val reveal : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> source:public_key_hash -> sourcePubKey:public_key -> counter:counter -> fee:Tez.t -> - unit -> MBytes.t shell_tzresult Lwt.t + unit -> + MBytes.t shell_tzresult Lwt.t - val transaction: - 'a #RPC_context.simple -> 'a -> + val transaction : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> @@ -121,24 +155,28 @@ module Forge : sig gas_limit:Z.t -> storage_limit:Z.t -> fee:Tez.t -> - unit -> MBytes.t shell_tzresult Lwt.t + unit -> + MBytes.t shell_tzresult Lwt.t - val origination: - 'a #RPC_context.simple -> 'a -> + val origination : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> counter:counter -> balance:Tez.t -> - ?delegatePubKey: public_key_hash -> + ?delegatePubKey:public_key_hash -> script:Script.t -> gas_limit:Z.t -> storage_limit:Z.t -> - fee:Tez.t-> - unit -> MBytes.t shell_tzresult Lwt.t + fee:Tez.t -> + unit -> + MBytes.t shell_tzresult Lwt.t - val delegation: - 'a #RPC_context.simple -> 'a -> + val delegation : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> @@ -146,74 +184,88 @@ module Forge : sig fee:Tez.t -> public_key_hash option -> MBytes.t shell_tzresult Lwt.t - end - val endorsement: - 'a #RPC_context.simple -> 'a -> + val endorsement : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> level:Raw_level.t -> - unit -> MBytes.t shell_tzresult Lwt.t + unit -> + MBytes.t shell_tzresult Lwt.t - val proposals: - 'a #RPC_context.simple -> 'a -> + val proposals : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> source:public_key_hash -> period:Voting_period.t -> proposals:Protocol_hash.t list -> - unit -> MBytes.t shell_tzresult Lwt.t + unit -> + MBytes.t shell_tzresult Lwt.t - val ballot: - 'a #RPC_context.simple -> 'a -> + val ballot : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> source:public_key_hash -> period:Voting_period.t -> proposal:Protocol_hash.t -> ballot:Vote.ballot -> - unit -> MBytes.t shell_tzresult Lwt.t + unit -> + MBytes.t shell_tzresult Lwt.t - val seed_nonce_revelation: - 'a #RPC_context.simple -> 'a -> + val seed_nonce_revelation : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> level:Raw_level.t -> nonce:Nonce.t -> - unit -> MBytes.t shell_tzresult Lwt.t + unit -> + MBytes.t shell_tzresult Lwt.t - val double_baking_evidence: - 'a #RPC_context.simple -> 'a -> + val double_baking_evidence : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> - bh1: Block_header.t -> - bh2: Block_header.t -> - unit -> MBytes.t shell_tzresult Lwt.t + bh1:Block_header.t -> + bh2:Block_header.t -> + unit -> + MBytes.t shell_tzresult Lwt.t - val double_endorsement_evidence: - 'a #RPC_context.simple -> 'a -> + val double_endorsement_evidence : + 'a #RPC_context.simple -> + 'a -> branch:Block_hash.t -> - op1: Kind.endorsement operation -> - op2: Kind.endorsement operation -> - unit -> MBytes.t shell_tzresult Lwt.t - - val protocol_data: - 'a #RPC_context.simple -> 'a -> - priority: int -> - ?seed_nonce_hash: Nonce_hash.t -> - ?proof_of_work_nonce: MBytes.t -> - unit -> MBytes.t shell_tzresult Lwt.t + op1:Kind.endorsement operation -> + op2:Kind.endorsement operation -> + unit -> + MBytes.t shell_tzresult Lwt.t + val protocol_data : + 'a #RPC_context.simple -> + 'a -> + priority:int -> + ?seed_nonce_hash:Nonce_hash.t -> + ?proof_of_work_nonce:MBytes.t -> + unit -> + MBytes.t shell_tzresult Lwt.t end module Parse : sig - - val operations: - 'a #RPC_context.simple -> 'a -> - ?check:bool -> Operation.raw list -> + val operations : + 'a #RPC_context.simple -> + 'a -> + ?check:bool -> + Operation.raw list -> Operation.packed list shell_tzresult Lwt.t - val block: - 'a #RPC_context.simple -> 'a -> - Block_header.shell_header -> MBytes.t -> + val block : + 'a #RPC_context.simple -> + 'a -> + Block_header.shell_header -> + MBytes.t -> Block_header.protocol_data shell_tzresult Lwt.t - end -val register: unit -> unit +val register : unit -> unit diff --git a/vendors/ligo-utils/tezos-protocol-alpha/init_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/init_storage.ml index 2a098b457..76d657cfb 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/init_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/init_storage.ml @@ -2,7 +2,6 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) -(* Copyright (c) 2019 Nomadic Labs *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -24,355 +23,36 @@ (* *) (*****************************************************************************) -(* Delegated storage changed type of value from Contract_hash to - Contract_repr. Move all 'delegated' data into a storage with - the original type, then copy over into the new storage. *) -let migrate_delegated ctxt contract = - let path = "contracts" :: (* module Contract *) - "index" :: (* module Indexed_context *) - Contract_repr.Index.to_path contract [ - "delegated" ; (* module Delegated *) - ] in - let path_tmp = "contracts" :: (* module Contract *) - "index" :: (* module Indexed_context *) - Contract_repr.Index.to_path contract [ - "delegated_004" ; (* module Delegated *) - ] in - Raw_context.dir_mem ctxt path >>= fun exists -> - if exists then - Raw_context.copy ctxt path path_tmp >>=? fun ctxt -> - Raw_context.remove_rec ctxt path >>= fun ctxt -> - Storage.Contract.Delegated_004.fold (ctxt, contract) ~init:(Ok ctxt) ~f:(fun delegated ctxt -> - Lwt.return ctxt >>=? fun ctxt -> - let originated = Contract_repr.originated_contract_004 delegated in - Storage.Contract.Delegated.add (ctxt, contract) originated >>= fun ctxt -> - return ctxt - ) >>=? fun ctxt -> - Raw_context.remove_rec ctxt path_tmp >>= fun ctxt -> - return ctxt - else - return ctxt - -let transform_script: - (manager_pkh: Signature.Public_key_hash.t -> - script_code: Script_repr.lazy_expr -> - script_storage: Script_repr.lazy_expr -> - (Script_repr.lazy_expr * Script_repr.lazy_expr) tzresult Lwt.t) -> - manager_pkh: Signature.Public_key_hash.t -> - Raw_context.t -> - Contract_repr.t -> - Script_repr.lazy_expr -> - Raw_context.t tzresult Lwt.t = - fun transformation ~manager_pkh ctxt contract code -> - Storage.Contract.Storage.get ctxt contract >>=? fun (_ctxt, storage) -> - transformation manager_pkh code storage >>=? fun (migrated_code, migrated_storage) -> - (* Set the migrated script code for free *) - Storage.Contract.Code.set_free ctxt contract migrated_code >>=? fun (ctxt, code_size_diff) -> - (* Set the migrated script storage for free *) - Storage.Contract.Storage.set_free ctxt contract migrated_storage >>=? fun (ctxt, storage_size_diff) -> - Storage.Contract.Used_storage_space.get ctxt contract >>=? fun used_space -> - let total_size = Z.(add (of_int code_size_diff) (add (of_int storage_size_diff) used_space)) in - (* Free storage space for migrated contracts *) - Storage.Contract.Used_storage_space.set ctxt contract total_size >>=? fun ctxt -> - Storage.Contract.Paid_storage_space.get ctxt contract >>=? fun paid_space -> - if Compare.Z.(paid_space < total_size) then - Storage.Contract.Paid_storage_space.set ctxt contract total_size >>=? fun ctxt -> - return ctxt - else - return ctxt - -let manager_script_storage: Signature.Public_key_hash.t -> Script_repr.lazy_expr = - fun manager_pkh -> - let open Micheline in - Script_repr.lazy_expr @@ strip_locations @@ - (* store in optimized binary representation - as unparsed with [Optimized]. *) - let bytes = Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding manager_pkh in - Bytes (0, bytes) - -(* If the given contract is not allocated, we'll allocate it with 1 mutez, - so that the migrated contracts' managers don't have to pay origination burn *) -let allocate_contract ctxt contract = - Contract_storage.allocated ctxt contract >>=? function - | true -> - return ctxt - | false -> - Contract_storage.credit ctxt contract Tez_repr.one_mutez - -(* Process an individual contract *) -let process_contract_add_manager contract ctxt = - let open Legacy_script_support_repr in - match Contract_repr.is_originated contract with - | None -> return ctxt (* Only process originated contracts *) - | Some _ -> begin - Storage.Contract.Counter.remove ctxt contract >>= fun ctxt -> - Storage.Contract.Spendable_004.mem ctxt contract >>= fun is_spendable -> - Storage.Contract.Delegatable_004.mem ctxt contract >>= fun is_delegatable -> - Storage.Contract.Spendable_004.del ctxt contract >>= fun ctxt -> - Storage.Contract.Delegatable_004.del ctxt contract >>= fun ctxt -> - (* Try to get script code (ignore ctxt update to discard the initialization) *) - Storage.Contract.Code.get_option ctxt contract >>=? fun (_ctxt, code) -> - (* Get the manager of the originated contract *) - Contract_storage.get_manager_004 ctxt contract >>=? fun manager_pkh -> - let manager = Contract_repr.implicit_contract manager_pkh in - Storage.Contract.Manager.remove ctxt contract >>= fun ctxt -> - match code with - | Some code -> - (* - | spendable | delegatable | template | - |-----------+-------------+------------------| - | true | true | add_do | - | true | false | add_do | - | false | true | add_set_delegate | - | false | false | nothing | - *) - if is_spendable then - transform_script add_do ~manager_pkh ctxt contract code >>=? fun ctxt -> - allocate_contract ctxt manager - else if is_delegatable then - transform_script add_set_delegate ~manager_pkh ctxt contract code >>=? fun ctxt -> - allocate_contract ctxt manager - else if has_default_entrypoint code then - transform_script - (fun ~manager_pkh:_ ~script_code ~script_storage -> - add_root_entrypoint script_code >>=? fun script_code -> - return (script_code, script_storage)) - ~manager_pkh ctxt contract code - else - return ctxt - | None -> begin - (* Initialize the script code for free *) - Storage.Contract.Code.init_free ctxt contract manager_script_code >>=? fun (ctxt, code_size) -> - let storage = manager_script_storage manager_pkh in - (* Initialize the script storage for free *) - Storage.Contract.Storage.init_free ctxt contract storage >>=? fun (ctxt, storage_size) -> - let total_size = Z.(add (of_int code_size) (of_int storage_size)) in - (* Free storage space for migrated contracts *) - Storage.Contract.Paid_storage_space.init_set ctxt contract total_size >>= fun ctxt -> - Storage.Contract.Used_storage_space.init_set ctxt contract total_size >>= fun ctxt -> - allocate_contract ctxt manager - end - end - -(* The [[update_contract_script]] function returns a copy of its - argument (the Micheline AST of a contract script) with "ADDRESS" - replaced by "ADDRESS; CHAIN_ID; PAIR". - - [[Micheline.strip_locations]] should be called on the resulting - Micheline AST to get meaningful locations. *) - -let rec update_contract_script : ('l, 'p) Micheline.node -> ('l, 'p) Micheline.node - = function - | Micheline.Seq (_, - Micheline.Prim (_, Michelson_v1_primitives.I_ADDRESS, [], []) :: - l) -> - Micheline.Seq (0, - Micheline.Prim (0, Michelson_v1_primitives.I_ADDRESS, [], []) :: - Micheline.Prim (0, Michelson_v1_primitives.I_CHAIN_ID, [], []) :: - Micheline.Prim (0, Michelson_v1_primitives.I_PAIR, [], []) :: l) - | Micheline.Seq (_, a :: l) -> - let a' = update_contract_script a in - let b = Micheline.Seq (0, l) in - let b' = update_contract_script b in - begin match b' with - | Micheline.Seq (_, l') -> - Micheline.Seq (0, a' :: l') - | _ -> assert false - end - | Micheline.Prim (_, p, l, annot) -> - Micheline.Prim (0, p, List.map update_contract_script l, annot) - | script -> script - -let migrate_multisig_script (ctxt : Raw_context.t) (contract : Contract_repr.t) - (code : Script_repr.expr) : Raw_context.t tzresult Lwt.t = - let migrated_code = - Script_repr.lazy_expr @@ Micheline.strip_locations @@ - update_contract_script @@ Micheline.root code - in - Storage.Contract.Code.set_free ctxt contract migrated_code >>=? fun (ctxt, _code_size_diff) -> - (* Set the spendable and delegatable flags to false so that no entrypoint gets added by - the [[process_contract_add_manager]] function. *) - Storage.Contract.Spendable_004.set ctxt contract false >>= fun ctxt -> - Storage.Contract.Delegatable_004.set ctxt contract false >>= fun ctxt -> - return ctxt - -(* The hash of the multisig contract; only contracts with this exact - hash are going to be updated by the [[update_contract_script]] - function. *) -let multisig_hash : Script_expr_hash.t = - Script_expr_hash.of_bytes_exn @@ - MBytes.of_hex @@ - `Hex "475e37a6386d0b85890eb446db1faad67f85fc814724ad07473cac8c0a124b31" - -let process_contract_multisig (contract : Contract_repr.t) (ctxt : Raw_context.t) = - Contract_storage.get_script ctxt contract >>=? fun (ctxt, script_opt) -> - match script_opt with - | None -> - (* Do nothing on scriptless contracts *) - return ctxt - | Some { Script_repr.code = code ; Script_repr.storage = _storage } -> - (* The contract has some script, only try to modify it if it has - the hash of the multisig contract *) - Lwt.return (Script_repr.force_decode code) >>=? fun (code, _gas_cost) -> - let bytes = - Data_encoding.Binary.to_bytes_exn Script_repr.expr_encoding code - in - let hash = Script_expr_hash.hash_bytes [ bytes ] in - if Script_expr_hash.(hash = multisig_hash) then - migrate_multisig_script ctxt contract code - else - return ctxt - -(* Process an individual contract *) -let process_contract contract ctxt = - process_contract_multisig contract ctxt >>=? fun ctxt -> - process_contract_add_manager contract ctxt >>=? fun ctxt -> - return ctxt - -let invoice_contract ctxt kt1_addr amount = - let amount = Tez_repr.of_mutez_exn (Int64.(mul 1_000_000L (of_int amount))) in - match Contract_repr.of_b58check kt1_addr with - | Ok recipient -> begin - Contract_storage.credit ctxt recipient amount >>= function - | Ok ctxt -> return ctxt - | Error _ -> return ctxt end - | Error _ -> return ctxt - -(* Extract Big_maps from their parent contract directory, - recompute their used space, and assign them an ID. *) -let migrate_contract_big_map ctxt contract = - Storage.Contract.Code.get_option ctxt contract >>=? function - | ctxt, None -> return ctxt - | ctxt, Some code -> - Storage.Contract.Storage.get ctxt contract >>=? fun (ctxt, storage) -> - let extract_big_map_types expr = - let open Michelson_v1_primitives in - let open Micheline in - match Micheline.root expr with - | Seq (_, [ Prim (_, K_storage, [ expr ], _) ; _ ; _ ]) - | Seq (_, [ _ ; Prim (_, K_storage, [ expr ], _) ; _ ]) - | Seq (_, [ _ ; _ ; Prim (_, K_storage, [ expr ], _) ]) -> - begin match expr with - | Prim (_, T_pair, [ Prim (_, T_big_map, [ kt ; vt ], _ ) ; _ ], _) -> Some (kt, vt) - | _ -> None - end - | _ -> None in - let rewrite_big_map expr id = - let open Michelson_v1_primitives in - let open Micheline in - match Micheline.root expr with - | Prim (_, D_Pair, [ Seq (_, _ (* ignore_unused_origination_literal *)) ; pannot ], sannot) -> - Micheline.strip_locations (Prim (0, D_Pair, [ Int (0, id) ; pannot ], sannot)) - | _ -> assert false in - Lwt.return (Script_repr.force_decode code) >>=? fun (code, _) -> - match extract_big_map_types code with - | None -> return ctxt - | Some (kt, vt) -> - Lwt.return (Script_repr.force_decode storage) >>=? fun (storage, _) -> - Storage.Big_map.Next.incr ctxt >>=? fun (ctxt, id) -> - let contract_path suffix = - "contracts" :: (* module Contract *) - "index" :: (* module Indexed_context *) - Contract_repr.Index.to_path contract suffix in - let old_path = contract_path [ "big_map" ] in - let storage = rewrite_big_map storage id in - Storage.Contract.Storage.set ctxt contract (Script_repr.lazy_expr storage) >>=? fun (ctxt, _) -> - let kt = Micheline.strip_locations (Script_repr.strip_annotations kt) in - let vt = Micheline.strip_locations (Script_repr.strip_annotations vt) in - Storage.Big_map.Key_type.init ctxt id kt >>=? fun ctxt -> - Storage.Big_map.Value_type.init ctxt id vt >>=? fun ctxt -> - Raw_context.dir_mem ctxt old_path >>= fun exists -> - if exists then - let read_size ctxt key = - Raw_context.get ctxt key >>=? fun len -> - match Data_encoding.(Binary.of_bytes int31) len with - | None -> assert false - | Some len -> return len in - let iter_sizes f (ctxt, acc) = - let rec dig i path (ctxt, acc) = - if Compare.Int.(i <= 0) then - Raw_context.fold ctxt path ~init:(ok (ctxt, acc)) ~f:begin fun k acc -> - Lwt.return acc >>=? fun (ctxt, acc) -> - match k with - | `Dir _ -> return (ctxt, acc) - | `Key file -> - match List.rev file with - | last :: _ when Compare.String.(last = "data") -> - return (ctxt, acc) - | last :: _ when Compare.String.(last = "len") -> - read_size ctxt file >>=? fun len -> - return (ctxt, f len acc) - | _ -> assert false - end - else - Raw_context.fold ctxt path ~init:(ok (ctxt, acc)) ~f:begin fun k acc -> - Lwt.return acc >>=? fun (ctxt, acc) -> - match k with - | `Dir k -> dig (i-1) k (ctxt, acc) - | `Key _ -> return (ctxt, acc) - end in - dig Script_expr_hash.path_length old_path (ctxt, acc) in - iter_sizes - (fun s acc -> (acc |> Z.add (Z.of_int s) |> Z.add (Z.of_int 65))) - (ctxt, (Z.of_int 0)) >>=? fun (ctxt, total_bytes) -> - Storage.Big_map.Total_bytes.init ctxt id total_bytes >>=? fun ctxt -> - let new_path = "big_maps" :: (* module Big_map *) - "index" :: (* module Indexed_context *) - Storage.Big_map.Index.to_path id [ - "contents" ; (* module Delegated *) - ] in - Raw_context.copy ctxt old_path new_path >>=? fun ctxt -> - Raw_context.remove_rec ctxt old_path >>= fun ctxt -> - read_size ctxt (contract_path [ "len" ; "code" ]) >>=? fun code_size -> - read_size ctxt (contract_path [ "len" ; "storage" ]) >>=? fun storage_size -> - let total_bytes = - total_bytes |> - Z.add (Z.of_int 33) |> - Z.add (Z.of_int code_size) |> - Z.add (Z.of_int storage_size) in - Storage.Contract.Used_storage_space.get ctxt contract >>=? fun previous_size -> - Storage.Contract.Paid_storage_space.get ctxt contract >>=? fun paid_bytes -> - let change = Z.sub paid_bytes previous_size in - Storage.Contract.Used_storage_space.set ctxt contract total_bytes >>=? fun ctxt -> - Storage.Contract.Paid_storage_space.set ctxt contract (Z.add total_bytes change) - else - Storage.Big_map.Total_bytes.init ctxt id Z.zero >>=? fun ctxt -> - return ctxt - +(* This is the genesis protocol: initialise the state *) let prepare_first_block ctxt ~typecheck ~level ~timestamp ~fitness = - Raw_context.prepare_first_block - ~level ~timestamp ~fitness ctxt >>=? fun (previous_protocol, ctxt) -> - Storage.Big_map.Next.init ctxt >>=? fun ctxt -> + Raw_context.prepare_first_block ~level ~timestamp ~fitness ctxt + >>=? fun (previous_protocol, ctxt) -> match previous_protocol with | Genesis param -> - Commitment_storage.init ctxt param.commitments >>=? fun ctxt -> - Roll_storage.init ctxt >>=? fun ctxt -> - Seed_storage.init ctxt >>=? fun ctxt -> - Contract_storage.init ctxt >>=? fun ctxt -> - Bootstrap_storage.init ctxt + Commitment_storage.init ctxt param.commitments + >>=? fun ctxt -> + Roll_storage.init ctxt + >>=? fun ctxt -> + Seed_storage.init ctxt + >>=? fun ctxt -> + Contract_storage.init ctxt + >>=? fun ctxt -> + Bootstrap_storage.init + ctxt ~typecheck ?ramp_up_cycles:param.security_deposit_ramp_up_cycles ?no_reward_cycles:param.no_reward_cycles param.bootstrap_accounts - param.bootstrap_contracts >>=? fun ctxt -> - Roll_storage.init_first_cycles ctxt >>=? fun ctxt -> - Vote_storage.init ctxt >>=? fun ctxt -> - Storage.Block_priority.init ctxt 0 >>=? fun ctxt -> - Vote_storage.freeze_listings ctxt >>=? fun ctxt -> - return ctxt - | Athens_004 -> - Storage.Vote.Current_quorum_004.get ctxt >>=? fun quorum -> - Storage.Vote.Participation_ema.init ctxt quorum >>=? fun ctxt -> - Storage.Vote.Current_quorum_004.delete ctxt >>=? fun ctxt -> - Storage.Block_priority.init ctxt 0 >>=? fun ctxt -> - Storage.Last_block_priority.delete ctxt >>=? fun ctxt -> - Storage.Contract.fold ctxt ~init:(Ok ctxt) - ~f:(fun contract ctxt -> - Lwt.return ctxt >>=? fun ctxt -> - migrate_delegated ctxt contract >>=? fun ctxt -> - migrate_contract_big_map ctxt contract >>=? fun ctxt -> - process_contract contract ctxt) + param.bootstrap_contracts >>=? fun ctxt -> - invoice_contract ctxt "KT1DUfaMfTRZZkvZAYQT5b3byXnvqoAykc43" 500 >>=? fun ctxt -> + Roll_storage.init_first_cycles ctxt + >>=? fun ctxt -> + Vote_storage.init ctxt + >>=? fun ctxt -> + Storage.Block_priority.init ctxt 0 + >>=? fun ctxt -> + Vote_storage.freeze_listings ctxt >>=? fun ctxt -> return ctxt + | Babylon_005 -> return ctxt let prepare ctxt ~level ~predecessor_timestamp ~timestamp ~fitness = diff --git a/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.ml index e9c74fae8..80de6f216 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.ml @@ -25,101 +25,129 @@ (* *) (*****************************************************************************) -let manager_script_code: Script_repr.lazy_expr = +let manager_script_code : Script_repr.lazy_expr = let open Micheline in let open Michelson_v1_primitives in - Script_repr.lazy_expr @@ strip_locations @@ - Seq (0, [ - Prim (0, K_parameter, [ - Prim (0, T_or, [ - Prim (0, T_lambda, [ - Prim (0, T_unit, [], []); - Prim (0, T_list, [ - Prim (0, T_operation, [], []) - ], []) - ], ["%do"]); - Prim (0, T_unit, [], ["%default"]) - ], []) - ], []); - Prim (0, K_storage, [ - Prim (0, T_key_hash, [], []) - ], []); - Prim (0, K_code, [ - Seq (0, [ - Seq (0, [ - Seq (0, [ - Prim (0, I_DUP, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_CDR, [], []) - ]) - ], []) - ]) - ]); - Prim (0, I_IF_LEFT, [ - Seq (0, [ - Prim (0, I_PUSH, [ - Prim (0, T_mutez, [], []); - Int (0, Z.zero) - ], []); - Prim (0, I_AMOUNT, [], []); - Seq (0, [ - Seq (0, [ - Prim (0, I_COMPARE, [], []); - Prim (0, I_EQ, [], []) - ]); - Prim (0, I_IF, [ - Seq (0, []); - Seq (0, [ - Seq (0, [ - Prim (0, I_UNIT, [], []); - Prim (0, I_FAILWITH, [], []) - ]) - ]) - ], []) - ]); - Seq (0, [ - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_DUP, [], []) - ]) - ], []); - Prim (0, I_SWAP, [], []) - ]); - Prim (0, I_IMPLICIT_ACCOUNT, [], []); - Prim (0, I_ADDRESS, [], []); - Prim (0, I_SENDER, [], []); - Seq (0, [ - Seq (0, [ - Prim (0, I_COMPARE, [], []); - Prim (0, I_EQ, [], []) - ]); - Prim (0, I_IF, [ - Seq (0, []); - Seq (0, [ - Seq (0, [ - Prim (0, I_UNIT, [], []); - Prim (0, I_FAILWITH, [], []) - ]) - ]) - ], []) - ]); - Prim (0, I_UNIT, [], []); - Prim (0, I_EXEC, [], []); - Prim (0, I_PAIR, [], []) - ]); - Seq (0, [ - Prim (0, I_DROP, [], []); - Prim (0, I_NIL, [ - Prim (0, T_operation, [], []) - ], []); - Prim (0, I_PAIR, [], []) - ]) - ], []) - ]) - ], []) - ]) + Script_repr.lazy_expr @@ strip_locations + @@ Seq + ( 0, + [ Prim + ( 0, + K_parameter, + [ Prim + ( 0, + T_or, + [ Prim + ( 0, + T_lambda, + [ Prim (0, T_unit, [], []); + Prim + (0, T_list, [Prim (0, T_operation, [], [])], []) + ], + ["%do"] ); + Prim (0, T_unit, [], ["%default"]) ], + [] ) ], + [] ); + Prim (0, K_storage, [Prim (0, T_key_hash, [], [])], []); + Prim + ( 0, + K_code, + [ Seq + ( 0, + [ Seq + ( 0, + [ Seq + ( 0, + [ Prim (0, I_DUP, [], []); + Prim (0, I_CAR, [], []); + Prim + ( 0, + I_DIP, + [Seq (0, [Prim (0, I_CDR, [], [])])], + [] ) ] ) ] ); + Prim + ( 0, + I_IF_LEFT, + [ Seq + ( 0, + [ Prim + ( 0, + I_PUSH, + [ Prim (0, T_mutez, [], []); + Int (0, Z.zero) ], + [] ); + Prim (0, I_AMOUNT, [], []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim (0, I_COMPARE, [], []); + Prim (0, I_EQ, [], []) ] ); + Prim + ( 0, + I_IF, + [ Seq (0, []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim + (0, I_UNIT, [], []); + Prim + ( 0, + I_FAILWITH, + [], + [] ) ] ) ] ) ], + [] ) ] ); + Seq + ( 0, + [ Prim + ( 0, + I_DIP, + [ Seq + (0, [Prim (0, I_DUP, [], [])]) + ], + [] ); + Prim (0, I_SWAP, [], []) ] ); + Prim (0, I_IMPLICIT_ACCOUNT, [], []); + Prim (0, I_ADDRESS, [], []); + Prim (0, I_SENDER, [], []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim (0, I_COMPARE, [], []); + Prim (0, I_EQ, [], []) ] ); + Prim + ( 0, + I_IF, + [ Seq (0, []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim + (0, I_UNIT, [], []); + Prim + ( 0, + I_FAILWITH, + [], + [] ) ] ) ] ) ], + [] ) ] ); + Prim (0, I_UNIT, [], []); + Prim (0, I_EXEC, [], []); + Prim (0, I_PAIR, [], []) ] ); + Seq + ( 0, + [ Prim (0, I_DROP, [], []); + Prim + ( 0, + I_NIL, + [Prim (0, T_operation, [], [])], + [] ); + Prim (0, I_PAIR, [], []) ] ) ], + [] ) ] ) ], + [] ) ] ) (* Find the toplevel expression with a given prim type from list, because they can be in arbitrary order. *) @@ -127,406 +155,674 @@ let find_toplevel toplevel exprs = let open Micheline in let rec iter toplevel = function | (Prim (_, prim, _, _) as found) :: _ - when String.equal toplevel (Michelson_v1_primitives.string_of_prim prim) -> + when String.equal toplevel (Michelson_v1_primitives.string_of_prim prim) + -> Some found | _ :: rest -> iter toplevel rest | [] -> - None in + None + in iter (Michelson_v1_primitives.string_of_prim toplevel) exprs -let add_do: - manager_pkh: Signature.Public_key_hash.t -> - script_code: Script_repr.lazy_expr -> - script_storage: Script_repr.lazy_expr -> - (Script_repr.lazy_expr * Script_repr.lazy_expr) tzresult Lwt.t = - fun ~manager_pkh ~script_code ~script_storage -> +let add_do : + manager_pkh:Signature.Public_key_hash.t -> + script_code:Script_repr.lazy_expr -> + script_storage:Script_repr.lazy_expr -> + (Script_repr.lazy_expr * Script_repr.lazy_expr) tzresult Lwt.t = + fun ~manager_pkh ~script_code ~script_storage -> let open Micheline in let open Michelson_v1_primitives in - Lwt.return (Script_repr.force_decode script_code) >>=? fun (script_code_expr, _gas_cost) -> - Lwt.return (Script_repr.force_decode script_storage) >>|? fun (script_storage_expr, _gas_cost) -> + Lwt.return (Script_repr.force_decode script_code) + >>=? fun (script_code_expr, _gas_cost) -> + Lwt.return (Script_repr.force_decode script_storage) + >>|? fun (script_storage_expr, _gas_cost) -> let storage_expr = root script_storage_expr in match root script_code_expr with - | Seq (_, toplevel) - -> begin - match find_toplevel K_parameter toplevel, - find_toplevel K_storage toplevel, - find_toplevel K_code toplevel with - Some (Prim (_, K_parameter, [ - Prim (_, parameter_type, parameter_expr, parameter_annot) - ], prim_param_annot)), - Some (Prim (_, K_storage, [ - Prim (_, code_storage_type, code_storage_expr, code_storage_annot) - ], k_storage_annot)), - Some (Prim (_, K_code, [code_expr], code_annot)) -> - (* Note that we intentionally don't deal with potential duplicate entrypoints in this migration as there already might be some in contracts that we don't touch. *) - - let migrated_code = - Seq (0, [ - Prim (0, K_parameter, [ - Prim (0, T_or, [ - Prim (0, T_lambda, [ - Prim (0, T_unit, [], []); - Prim (0, T_list, [ - Prim (0, T_operation, [], []) - ], []) - ], ["%do"]); - Prim (0, parameter_type, parameter_expr, "%default" :: parameter_annot) - ], []) - ], prim_param_annot); - Prim (0, K_storage, [ - Prim (0, T_pair, [ - Prim (0, T_key_hash, [], []); - Prim (0, code_storage_type, code_storage_expr, code_storage_annot) - ], []) - ], k_storage_annot); - Prim (0, K_code, [ - Seq (0, [ - Prim (0, I_DUP, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_IF_LEFT, [ - Seq (0, [ - Prim (0, I_PUSH, [ - Prim (0, T_mutez, [], []); - Int (0, Z.zero) - ], []); - Prim (0, I_AMOUNT, [], []); - Seq (0, [ - Seq (0, [ - Prim (0, I_COMPARE, [], []); - Prim (0, I_EQ, [], []) - ]); - Prim (0, I_IF, [ - Seq (0, []); - Seq (0, [ - Seq (0, [ - Prim (0, I_UNIT, [], []); - Prim (0, I_FAILWITH, [], []) - ]) - ]) - ], []) - ]); - Seq (0, [ - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_DUP, [], []) - ]) - ], []); - Prim (0, I_SWAP, [], []) - ]); - Prim (0, I_CDR, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_IMPLICIT_ACCOUNT, [], []); - Prim (0, I_ADDRESS, [], []); - Prim (0, I_SENDER, [], []); - Seq (0, [ - Prim (0, I_COMPARE, [], []); - Prim (0, I_NEQ, [], []); - Prim (0, I_IF, [ - Seq (0, [ - Prim (0, I_SENDER, [], []); - Prim (0, I_PUSH, [ - Prim (0, T_string, [], []); - String (0, "Only the owner can operate.") - ], []); - Prim (0, I_PAIR, [], []); - Prim (0, I_FAILWITH, [], []) - ]); - Seq (0, [ - Prim (0, I_UNIT, [], []); - Prim (0, I_EXEC, [], []); - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_CDR, [], []) - ]) - ], []); - Prim (0, I_PAIR, [], []) - ]) - ], []) - ]) - ]); - Seq (0, [ - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_CDR, [], []); - Prim (0, I_DUP, [], []); - Prim (0, I_CDR, [], []) - ]) - ], []); - Prim (0, I_PAIR, [], []); - - code_expr; - - Prim (0, I_SWAP, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_SWAP, [], []); - Seq (0, [ - Seq (0, [ - Prim (0, I_DUP, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_CDR, [], []) - ]) - ], []) - ]) - ]); - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_SWAP, [], []); - Prim (0, I_PAIR, [], []) - ]) - ], []); - Prim (0, I_PAIR, [], []) - ]) - ], []) - ]) - ], code_annot) - ]) - in - let migrated_storage = Prim (0, D_Pair, [ - (* Instead of + | Seq (_, toplevel) -> ( + match + ( find_toplevel K_parameter toplevel, + find_toplevel K_storage toplevel, + find_toplevel K_code toplevel ) + with + | ( Some + (Prim + ( _, + K_parameter, + [Prim (_, parameter_type, parameter_expr, parameter_annot)], + prim_param_annot )), + Some + (Prim + ( _, + K_storage, + [ Prim + (_, code_storage_type, code_storage_expr, code_storage_annot) + ], + k_storage_annot )), + Some (Prim (_, K_code, [code_expr], code_annot)) ) -> + (* Note that we intentionally don't deal with potential duplicate entrypoints in this migration as there already might be some in contracts that we don't touch. *) + let migrated_code = + Seq + ( 0, + [ Prim + ( 0, + K_parameter, + [ Prim + ( 0, + T_or, + [ Prim + ( 0, + T_lambda, + [ Prim (0, T_unit, [], []); + Prim + ( 0, + T_list, + [Prim (0, T_operation, [], [])], + [] ) ], + ["%do"] ); + Prim + ( 0, + parameter_type, + parameter_expr, + "%default" :: parameter_annot ) ], + [] ) ], + prim_param_annot ); + Prim + ( 0, + K_storage, + [ Prim + ( 0, + T_pair, + [ Prim (0, T_key_hash, [], []); + Prim + ( 0, + code_storage_type, + code_storage_expr, + code_storage_annot ) ], + [] ) ], + k_storage_annot ); + Prim + ( 0, + K_code, + [ Seq + ( 0, + [ Prim (0, I_DUP, [], []); + Prim (0, I_CAR, [], []); + Prim + ( 0, + I_IF_LEFT, + [ Seq + ( 0, + [ Prim + ( 0, + I_PUSH, + [ Prim (0, T_mutez, [], []); + Int (0, Z.zero) ], + [] ); + Prim (0, I_AMOUNT, [], []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim (0, I_COMPARE, [], []); + Prim (0, I_EQ, [], []) ] ); + Prim + ( 0, + I_IF, + [ Seq (0, []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim + ( 0, + I_UNIT, + [], + [] ); + Prim + ( 0, + I_FAILWITH, + [], + [] ) ] ) ] + ) ], + [] ) ] ); + Seq + ( 0, + [ Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim + (0, I_DUP, [], []) + ] ) ], + [] ); + Prim (0, I_SWAP, [], []) ] ); + Prim (0, I_CDR, [], []); + Prim (0, I_CAR, [], []); + Prim (0, I_IMPLICIT_ACCOUNT, [], []); + Prim (0, I_ADDRESS, [], []); + Prim (0, I_SENDER, [], []); + Seq + ( 0, + [ Prim (0, I_COMPARE, [], []); + Prim (0, I_NEQ, [], []); + Prim + ( 0, + I_IF, + [ Seq + ( 0, + [ Prim + ( 0, + I_SENDER, + [], + [] ); + Prim + ( 0, + I_PUSH, + [ Prim + ( 0, + T_string, + [], + [] ); + String + ( 0, + "Only the \ + owner \ + can \ + operate." + ) ], + [] ); + Prim + (0, I_PAIR, [], []); + Prim + ( 0, + I_FAILWITH, + [], + [] ) ] ); + Seq + ( 0, + [ Prim + (0, I_UNIT, [], []); + Prim + (0, I_EXEC, [], []); + Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim + ( 0, + I_CDR, + [], + [] ) + ] ) ], + [] ); + Prim + (0, I_PAIR, [], []) + ] ) ], + [] ) ] ) ] ); + Seq + ( 0, + [ Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim (0, I_CDR, [], []); + Prim (0, I_DUP, [], []); + Prim (0, I_CDR, [], []) ] + ) ], + [] ); + Prim (0, I_PAIR, [], []); + code_expr; + Prim (0, I_SWAP, [], []); + Prim (0, I_CAR, [], []); + Prim (0, I_SWAP, [], []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim (0, I_DUP, [], []); + Prim (0, I_CAR, [], []); + Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim + ( 0, + I_CDR, + [], + [] ) ] ) ], + [] ) ] ) ] ); + Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim (0, I_SWAP, [], []); + Prim (0, I_PAIR, [], []) ] + ) ], + [] ); + Prim (0, I_PAIR, [], []) ] ) ], + [] ) ] ) ], + code_annot ) ] ) + in + let migrated_storage = + Prim + ( 0, + D_Pair, + [ (* Instead of `String (0, Signature.Public_key_hash.to_b58check manager_pkh)` the storage is written as unparsed with [Optimized] *) - Bytes (0, Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding manager_pkh) ; - storage_expr - ], []) in - Script_repr.lazy_expr @@ strip_locations migrated_code, - Script_repr.lazy_expr @@ strip_locations migrated_storage - | _ -> - script_code, script_storage - end + Bytes + ( 0, + Data_encoding.Binary.to_bytes_exn + Signature.Public_key_hash.encoding + manager_pkh ); + storage_expr ], + [] ) + in + ( Script_repr.lazy_expr @@ strip_locations migrated_code, + Script_repr.lazy_expr @@ strip_locations migrated_storage ) + | _ -> + (script_code, script_storage) ) | _ -> - script_code, script_storage + (script_code, script_storage) - - -let add_set_delegate: - manager_pkh: Signature.Public_key_hash.t -> - script_code: Script_repr.lazy_expr -> - script_storage: Script_repr.lazy_expr -> - (Script_repr.lazy_expr * Script_repr.lazy_expr) tzresult Lwt.t = - fun ~manager_pkh ~script_code ~script_storage -> +let add_set_delegate : + manager_pkh:Signature.Public_key_hash.t -> + script_code:Script_repr.lazy_expr -> + script_storage:Script_repr.lazy_expr -> + (Script_repr.lazy_expr * Script_repr.lazy_expr) tzresult Lwt.t = + fun ~manager_pkh ~script_code ~script_storage -> let open Micheline in let open Michelson_v1_primitives in - Lwt.return (Script_repr.force_decode script_code) >>=? fun (script_code_expr, _gas_cost) -> - Lwt.return (Script_repr.force_decode script_storage) >>|? fun (script_storage_expr, _gas_cost) -> + Lwt.return (Script_repr.force_decode script_code) + >>=? fun (script_code_expr, _gas_cost) -> + Lwt.return (Script_repr.force_decode script_storage) + >>|? fun (script_storage_expr, _gas_cost) -> let storage_expr = root script_storage_expr in match root script_code_expr with - | Seq (_, toplevel) - -> begin - match find_toplevel K_parameter toplevel, - find_toplevel K_storage toplevel, - find_toplevel K_code toplevel with - Some (Prim (_, K_parameter, [ - Prim (_, parameter_type, parameter_expr, parameter_annot) - ], prim_param_annot)), - Some (Prim (_, K_storage, [ - Prim (_, code_storage_type, code_storage_expr, code_storage_annot) - ], k_storage_annot)), - Some (Prim (_, K_code, [code_expr], code_annot)) -> - (* Note that we intentionally don't deal with potential duplicate entrypoints in this migration as there already might be some in contracts that we don't touch. *) - - let migrated_code = - Seq (0, [ - Prim (0, K_parameter, [ - Prim (0, T_or, [ - Prim (0, T_or, [ - Prim (0, T_key_hash, [], ["%set_delegate"]); - Prim (0, T_unit, [], ["%remove_delegate"]) - ], []); - Prim (0, parameter_type, parameter_expr, "%default" :: parameter_annot) - ], []) - ], prim_param_annot); - Prim (0, K_storage, [ - Prim (0, T_pair, [ - Prim (0, T_key_hash, [], []); - Prim (0, code_storage_type, code_storage_expr, code_storage_annot) - ], []) - ], k_storage_annot); - Prim (0, K_code, [ - Seq (0, [ - Prim (0, I_DUP, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_IF_LEFT, [ - Seq (0, [ - Prim (0, I_PUSH, [ - Prim (0, T_mutez, [], []); - Int (0, Z.zero) - ], []); - Prim (0, I_AMOUNT, [], []); - Seq (0, [ - Seq (0, [ - Prim (0, I_COMPARE, [], []); - Prim (0, I_EQ, [], []) - ]); - Prim (0, I_IF, [ - Seq (0, []); - Seq (0, [ - Seq (0, [ - Prim (0, I_UNIT, [], []); - Prim (0, I_FAILWITH, [], []) - ]) - ]) - ], []) - ]); - Seq (0, [ - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_DUP, [], []) - ]) - ], []); - Prim (0, I_SWAP, [], []) - ]); - Prim (0, I_CDR, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_IMPLICIT_ACCOUNT, [], []); - Prim (0, I_ADDRESS, [], []); - Prim (0, I_SENDER, [], []); - Seq (0, [ - Prim (0, I_COMPARE, [], []); - Prim (0, I_NEQ, [], []); - Prim (0, I_IF, [ - Seq (0, [ - Prim (0, I_SENDER, [], []); - Prim (0, I_PUSH, [ - Prim (0, T_string, [], []); - String (0, "Only the owner can operate.") - ], []); - Prim (0, I_PAIR, [], []); - Prim (0, I_FAILWITH, [], []) - ]); - Seq (0, [ - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_CDR, [], []); - Prim (0, I_NIL, [ - Prim (0, T_operation, [], []) - ], []) - ]) - ], []); - Prim (0, I_IF_LEFT, [ - Seq (0, [ - Prim (0, I_SOME, [], []); - Prim (0, I_SET_DELEGATE, [], []); - Prim (0, I_CONS, [], []); - Prim (0, I_PAIR, [], []) - ]); - Seq (0, [ - Prim (0, I_DROP, [], []); - Prim (0, I_NONE, [ - Prim (0, T_key_hash, [], []) - ], []); - Prim (0, I_SET_DELEGATE, [], []); - Prim (0, I_CONS, [], []); - Prim (0, I_PAIR, [], []) - ]) - ], []) - ]) - ], []) - ]) - ]); - Seq (0, [ - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_CDR, [], []); - Prim (0, I_DUP, [], []); - Prim (0, I_CDR, [], []) - ]) - ], []); - Prim (0, I_PAIR, [], []); - - code_expr; - - Prim (0, I_SWAP, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_SWAP, [], []); - Seq (0, [ - Seq (0, [ - Prim (0, I_DUP, [], []); - Prim (0, I_CAR, [], []); - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_CDR, [], []) - ]) - ], []) - ]) - ]); - Prim (0, I_DIP, [ - Seq (0, [ - Prim (0, I_SWAP, [], []); - Prim (0, I_PAIR, [], []) - ]) - ], []); - Prim (0, I_PAIR, [], []) - ]) - ], []) - ]) - ], code_annot) - ]) - in - let migrated_storage = Prim (0, D_Pair, [ - (* Instead of + | Seq (_, toplevel) -> ( + match + ( find_toplevel K_parameter toplevel, + find_toplevel K_storage toplevel, + find_toplevel K_code toplevel ) + with + | ( Some + (Prim + ( _, + K_parameter, + [Prim (_, parameter_type, parameter_expr, parameter_annot)], + prim_param_annot )), + Some + (Prim + ( _, + K_storage, + [ Prim + (_, code_storage_type, code_storage_expr, code_storage_annot) + ], + k_storage_annot )), + Some (Prim (_, K_code, [code_expr], code_annot)) ) -> + (* Note that we intentionally don't deal with potential duplicate entrypoints in this migration as there already might be some in contracts that we don't touch. *) + let migrated_code = + Seq + ( 0, + [ Prim + ( 0, + K_parameter, + [ Prim + ( 0, + T_or, + [ Prim + ( 0, + T_or, + [ Prim (0, T_key_hash, [], ["%set_delegate"]); + Prim (0, T_unit, [], ["%remove_delegate"]) ], + [] ); + Prim + ( 0, + parameter_type, + parameter_expr, + "%default" :: parameter_annot ) ], + [] ) ], + prim_param_annot ); + Prim + ( 0, + K_storage, + [ Prim + ( 0, + T_pair, + [ Prim (0, T_key_hash, [], []); + Prim + ( 0, + code_storage_type, + code_storage_expr, + code_storage_annot ) ], + [] ) ], + k_storage_annot ); + Prim + ( 0, + K_code, + [ Seq + ( 0, + [ Prim (0, I_DUP, [], []); + Prim (0, I_CAR, [], []); + Prim + ( 0, + I_IF_LEFT, + [ Seq + ( 0, + [ Prim + ( 0, + I_PUSH, + [ Prim (0, T_mutez, [], []); + Int (0, Z.zero) ], + [] ); + Prim (0, I_AMOUNT, [], []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim (0, I_COMPARE, [], []); + Prim (0, I_EQ, [], []) ] ); + Prim + ( 0, + I_IF, + [ Seq (0, []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim + ( 0, + I_UNIT, + [], + [] ); + Prim + ( 0, + I_FAILWITH, + [], + [] ) ] ) ] + ) ], + [] ) ] ); + Seq + ( 0, + [ Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim + (0, I_DUP, [], []) + ] ) ], + [] ); + Prim (0, I_SWAP, [], []) ] ); + Prim (0, I_CDR, [], []); + Prim (0, I_CAR, [], []); + Prim (0, I_IMPLICIT_ACCOUNT, [], []); + Prim (0, I_ADDRESS, [], []); + Prim (0, I_SENDER, [], []); + Seq + ( 0, + [ Prim (0, I_COMPARE, [], []); + Prim (0, I_NEQ, [], []); + Prim + ( 0, + I_IF, + [ Seq + ( 0, + [ Prim + ( 0, + I_SENDER, + [], + [] ); + Prim + ( 0, + I_PUSH, + [ Prim + ( 0, + T_string, + [], + [] ); + String + ( 0, + "Only the \ + owner \ + can \ + operate." + ) ], + [] ); + Prim + (0, I_PAIR, [], []); + Prim + ( 0, + I_FAILWITH, + [], + [] ) ] ); + Seq + ( 0, + [ Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim + ( 0, + I_CDR, + [], + [] ); + Prim + ( 0, + I_NIL, + [ Prim + ( + 0, + T_operation, + [], + [] + ) + ], + [] ) + ] ) ], + [] ); + Prim + ( 0, + I_IF_LEFT, + [ Seq + ( 0, + [ Prim + ( 0, + I_SOME, + [], + [] ); + Prim + ( 0, + I_SET_DELEGATE, + [], + [] ); + Prim + ( 0, + I_CONS, + [], + [] ); + Prim + ( 0, + I_PAIR, + [], + [] ) + ] ); + Seq + ( 0, + [ Prim + ( 0, + I_DROP, + [], + [] ); + Prim + ( 0, + I_NONE, + [ Prim + ( + 0, + T_key_hash, + [], + [] + ) + ], + [] ); + Prim + ( 0, + I_SET_DELEGATE, + [], + [] ); + Prim + ( 0, + I_CONS, + [], + [] ); + Prim + ( 0, + I_PAIR, + [], + [] ) + ] ) ], + [] ) ] ) ], + [] ) ] ) ] ); + Seq + ( 0, + [ Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim (0, I_CDR, [], []); + Prim (0, I_DUP, [], []); + Prim (0, I_CDR, [], []) ] + ) ], + [] ); + Prim (0, I_PAIR, [], []); + code_expr; + Prim (0, I_SWAP, [], []); + Prim (0, I_CAR, [], []); + Prim (0, I_SWAP, [], []); + Seq + ( 0, + [ Seq + ( 0, + [ Prim (0, I_DUP, [], []); + Prim (0, I_CAR, [], []); + Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim + ( 0, + I_CDR, + [], + [] ) ] ) ], + [] ) ] ) ] ); + Prim + ( 0, + I_DIP, + [ Seq + ( 0, + [ Prim (0, I_SWAP, [], []); + Prim (0, I_PAIR, [], []) ] + ) ], + [] ); + Prim (0, I_PAIR, [], []) ] ) ], + [] ) ] ) ], + code_annot ) ] ) + in + let migrated_storage = + Prim + ( 0, + D_Pair, + [ (* Instead of `String (0, Signature.Public_key_hash.to_b58check manager_pkh)` the storage is written as unparsed with [Optimized] *) - Bytes (0, Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding manager_pkh) ; - storage_expr - ], []) in - Script_repr.lazy_expr @@ strip_locations migrated_code, - Script_repr.lazy_expr @@ strip_locations migrated_storage - | _ -> - script_code, script_storage - end + Bytes + ( 0, + Data_encoding.Binary.to_bytes_exn + Signature.Public_key_hash.encoding + manager_pkh ); + storage_expr ], + [] ) + in + ( Script_repr.lazy_expr @@ strip_locations migrated_code, + Script_repr.lazy_expr @@ strip_locations migrated_storage ) + | _ -> + (script_code, script_storage) ) | _ -> - script_code, script_storage + (script_code, script_storage) let has_default_entrypoint expr = let open Micheline in let open Michelson_v1_primitives in match Script_repr.force_decode expr with - | Error _ -> false - | Ok (expr, _) -> - match root expr with - | Seq (_, toplevel) -> begin - match find_toplevel K_parameter toplevel with - | Some (Prim (_, K_parameter, [ _ ], [ "%default" ])) -> false - | Some (Prim (_, K_parameter, [ parameter_expr ], _)) -> - let rec has_default = function - | Prim (_, T_or, [ l ; r ], annots) -> - List.exists (String.equal "%default") annots || has_default l || has_default r - | Prim (_, _, _, annots) -> - List.exists (String.equal "%default") annots - | _ -> false - in - has_default parameter_expr - | Some _ | None -> false - end - | _ -> false - -let add_root_entrypoint - : script_code: Script_repr.lazy_expr -> Script_repr.lazy_expr tzresult Lwt.t - = fun ~script_code -> - let open Micheline in - let open Michelson_v1_primitives in - Lwt.return (Script_repr.force_decode script_code) >>|? fun (script_code_expr, _gas_cost) -> - match root script_code_expr with - | Seq (_, toplevel) -> - let migrated_code = - Seq (0, List.map (function - | Prim (_, K_parameter, [ parameter_expr ], _) -> - Prim (0, K_parameter, [ parameter_expr ], [ "%root" ]) - | Prim (_, K_code, exprs, annots) -> - let rec rewrite_self = function - | Int _ | String _ | Bytes _ | Prim (_, I_CREATE_CONTRACT, _, _) as leaf -> leaf - | Prim (_, I_SELF, [], annots) -> - Prim (0, I_SELF, [], "%root" :: annots) - | Prim (_, name, args, annots) -> - Prim (0, name, List.map rewrite_self args, annots) - | Seq (_, args) -> - Seq (0, List.map rewrite_self args) in - Prim (0, K_code, List.map rewrite_self exprs, annots) - | other -> other) - toplevel) in - Script_repr.lazy_expr @@ strip_locations migrated_code + | Error _ -> + false + | Ok (expr, _) -> ( + match root expr with + | Seq (_, toplevel) -> ( + match find_toplevel K_parameter toplevel with + | Some (Prim (_, K_parameter, [_], ["%default"])) -> + false + | Some (Prim (_, K_parameter, [parameter_expr], _)) -> + let rec has_default = function + | Prim (_, T_or, [l; r], annots) -> + List.exists (String.equal "%default") annots + || has_default l || has_default r + | Prim (_, _, _, annots) -> + List.exists (String.equal "%default") annots + | _ -> + false + in + has_default parameter_expr + | Some _ | None -> + false ) | _ -> - script_code + false ) + +let add_root_entrypoint : + script_code:Script_repr.lazy_expr -> Script_repr.lazy_expr tzresult Lwt.t = + fun ~script_code -> + let open Micheline in + let open Michelson_v1_primitives in + Lwt.return (Script_repr.force_decode script_code) + >>|? fun (script_code_expr, _gas_cost) -> + match root script_code_expr with + | Seq (_, toplevel) -> + let migrated_code = + Seq + ( 0, + List.map + (function + | Prim (_, K_parameter, [parameter_expr], _) -> + Prim (0, K_parameter, [parameter_expr], ["%root"]) + | Prim (_, K_code, exprs, annots) -> + let rec rewrite_self = function + | ( Int _ + | String _ + | Bytes _ + | Prim (_, I_CREATE_CONTRACT, _, _) ) as leaf -> + leaf + | Prim (_, I_SELF, [], annots) -> + Prim (0, I_SELF, [], "%root" :: annots) + | Prim (_, name, args, annots) -> + Prim (0, name, List.map rewrite_self args, annots) + | Seq (_, args) -> + Seq (0, List.map rewrite_self args) + in + Prim (0, K_code, List.map rewrite_self exprs, annots) + | other -> + other) + toplevel ) + in + Script_repr.lazy_expr @@ strip_locations migrated_code + | _ -> + script_code diff --git a/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.mli index 0b69d3393..cbdfd459f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/legacy_script_support_repr.mli @@ -31,7 +31,7 @@ https://gitlab.com/nomadic-labs/mi-cho-coq/blob/7b42f2e970e1541af54f8a9b6820b4f18e847575/src/contracts/manager.tz The formal proof is at: https://gitlab.com/nomadic-labs/mi-cho-coq/blob/a7603e12021166e15890f6d504feebec2f945502/src/contracts_coq/manager.v *) -val manager_script_code: Script_repr.lazy_expr +val manager_script_code : Script_repr.lazy_expr (** This code mimics the now defunct "spendable" flags of KT1s by adding a [do] entrypoint, preserving the original script's at @@ -39,10 +39,10 @@ val manager_script_code: Script_repr.lazy_expr The pseudo-code for the applied transformations is from: https://gitlab.com/nomadic-labs/mi-cho-coq/blob/7b42f2e970e1541af54f8a9b6820b4f18e847575/src/contracts/transform/add_do.tz *) -val add_do: - manager_pkh: Signature.Public_key_hash.t -> - script_code: Script_repr.lazy_expr -> - script_storage: Script_repr.lazy_expr -> +val add_do : + manager_pkh:Signature.Public_key_hash.t -> + script_code:Script_repr.lazy_expr -> + script_storage:Script_repr.lazy_expr -> (Script_repr.lazy_expr * Script_repr.lazy_expr) tzresult Lwt.t (** This code mimics the now defunct "spendable" flags of KT1s by @@ -51,19 +51,17 @@ val add_do: The pseudo-code for the applied transformations is from: https://gitlab.com/nomadic-labs/mi-cho-coq/blob/7b42f2e970e1541af54f8a9b6820b4f18e847575/src/contracts/transform/add_set_delegate.tz *) -val add_set_delegate: - manager_pkh: Signature.Public_key_hash.t -> - script_code: Script_repr.lazy_expr -> - script_storage: Script_repr.lazy_expr -> +val add_set_delegate : + manager_pkh:Signature.Public_key_hash.t -> + script_code:Script_repr.lazy_expr -> + script_storage:Script_repr.lazy_expr -> (Script_repr.lazy_expr * Script_repr.lazy_expr) tzresult Lwt.t (** Checks if a contract was declaring a default entrypoint somewhere else than at the root, in which case its type changes when entrypoints are activated. *) -val has_default_entrypoint: - Script_repr.lazy_expr -> bool +val has_default_entrypoint : Script_repr.lazy_expr -> bool (** Adds a [%root] annotation on the toplevel parameter construct. *) -val add_root_entrypoint: - script_code: Script_repr.lazy_expr -> - Script_repr.lazy_expr tzresult Lwt.t +val add_root_entrypoint : + script_code:Script_repr.lazy_expr -> Script_repr.lazy_expr tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/level_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/level_repr.ml index 957e58883..5a8dca1cd 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/level_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/level_repr.ml @@ -24,125 +24,162 @@ (*****************************************************************************) type t = { - level: Raw_level_repr.t ; - level_position: int32 ; - cycle: Cycle_repr.t ; - cycle_position: int32 ; - voting_period: Voting_period_repr.t ; - voting_period_position: int32 ; - expected_commitment: bool ; + level : Raw_level_repr.t; + level_position : int32; + cycle : Cycle_repr.t; + cycle_position : int32; + voting_period : Voting_period_repr.t; + voting_period_position : int32; + expected_commitment : bool; } -include Compare.Make(struct - type nonrec t = t - let compare { level = l1 } { level = l2 } = Raw_level_repr.compare l1 l2 - end) +include Compare.Make (struct + type nonrec t = t + + let compare {level = l1} {level = l2} = Raw_level_repr.compare l1 l2 +end) type level = t -let pp ppf { level } = Raw_level_repr.pp ppf level +let pp ppf {level} = Raw_level_repr.pp ppf level let pp_full ppf l = - Format.fprintf ppf + Format.fprintf + ppf "%a.%ld (cycle %a.%ld) (vote %a.%ld)" - Raw_level_repr.pp l.level l.level_position - Cycle_repr.pp l.cycle l.cycle_position - Voting_period_repr.pp l.voting_period l.voting_period_position + Raw_level_repr.pp + l.level + l.level_position + Cycle_repr.pp + l.cycle + l.cycle_position + Voting_period_repr.pp + l.voting_period + l.voting_period_position let encoding = let open Data_encoding in conv - (fun { level ; level_position ; - cycle ; cycle_position ; - voting_period; voting_period_position ; + (fun { level; + level_position; + cycle; + cycle_position; + voting_period; + voting_period_position; expected_commitment } -> - (level, level_position, - cycle, cycle_position, - voting_period, voting_period_position, - expected_commitment)) - (fun (level, level_position, - cycle, cycle_position, - voting_period, voting_period_position, - expected_commitment) -> - { level ; level_position ; - cycle ; cycle_position ; - voting_period ; voting_period_position ; - expected_commitment }) + ( level, + level_position, + cycle, + cycle_position, + voting_period, + voting_period_position, + expected_commitment )) + (fun ( level, + level_position, + cycle, + cycle_position, + voting_period, + voting_period_position, + expected_commitment ) -> + { + level; + level_position; + cycle; + cycle_position; + voting_period; + voting_period_position; + expected_commitment; + }) (obj7 - (req "level" + (req + "level" ~description: - "The level of the block relative to genesis. This is also \ - the Shell's notion of level" + "The level of the block relative to genesis. This is also the \ + Shell's notion of level" Raw_level_repr.encoding) - (req "level_position" + (req + "level_position" ~description: "The level of the block relative to the block that starts \ - protocol alpha. This is specific to the protocol \ - alpha. Other protocols might or might not include a \ - similar notion." + protocol alpha. This is specific to the protocol alpha. Other \ + protocols might or might not include a similar notion." int32) - (req "cycle" + (req + "cycle" ~description: "The current cycle's number. Note that cycles are a \ - protocol-specific notion. As a result, the cycle number starts at 0 \ - with the first block of protocol alpha." + protocol-specific notion. As a result, the cycle number starts \ + at 0 with the first block of protocol alpha." Cycle_repr.encoding) - (req "cycle_position" + (req + "cycle_position" ~description: - "The current level of the block relative to the first \ - block of the current cycle." + "The current level of the block relative to the first block of \ + the current cycle." int32) - (req "voting_period" + (req + "voting_period" ~description: "The current voting period's index. Note that cycles are a \ - protocol-specific notion. As a result, the voting period \ - index starts at 0 with the first block of protocol alpha." + protocol-specific notion. As a result, the voting period index \ + starts at 0 with the first block of protocol alpha." Voting_period_repr.encoding) - (req "voting_period_position" + (req + "voting_period_position" ~description: - "The current level of the block relative to the first \ - block of the current voting period." + "The current level of the block relative to the first block of \ + the current voting period." int32) - (req "expected_commitment" + (req + "expected_commitment" ~description: - "Tells wether the baker of this block has to commit a seed \ - nonce hash." + "Tells wether the baker of this block has to commit a seed nonce \ + hash." bool)) let root first_level = - { level = first_level ; - level_position = 0l ; - cycle = Cycle_repr.root ; - cycle_position = 0l ; - voting_period = Voting_period_repr.root ; - voting_period_position = 0l ; - expected_commitment = false ; + { + level = first_level; + level_position = 0l; + cycle = Cycle_repr.root; + cycle_position = 0l; + voting_period = Voting_period_repr.root; + voting_period_position = 0l; + expected_commitment = false; } -let from_raw - ~first_level ~blocks_per_cycle ~blocks_per_voting_period - ~blocks_per_commitment - level = +let from_raw ~first_level ~blocks_per_cycle ~blocks_per_voting_period + ~blocks_per_commitment level = let raw_level = Raw_level_repr.to_int32 level in let first_level = Raw_level_repr.to_int32 first_level in let level_position = - Compare.Int32.max 0l (Int32.sub raw_level first_level) in + Compare.Int32.max 0l (Int32.sub raw_level first_level) + in let cycle = - Cycle_repr.of_int32_exn (Int32.div level_position blocks_per_cycle) in + Cycle_repr.of_int32_exn (Int32.div level_position blocks_per_cycle) + in let cycle_position = Int32.rem level_position blocks_per_cycle in let voting_period = Voting_period_repr.of_int32_exn - (Int32.div level_position blocks_per_voting_period) in + (Int32.div level_position blocks_per_voting_period) + in let voting_period_position = - Int32.rem level_position blocks_per_voting_period in + Int32.rem level_position blocks_per_voting_period + in let expected_commitment = - Compare.Int32.(Int32.rem cycle_position blocks_per_commitment = - Int32.pred blocks_per_commitment) in - { level ; level_position ; - cycle ; cycle_position ; - voting_period ; voting_period_position ; - expected_commitment } + Compare.Int32.( + Int32.rem cycle_position blocks_per_commitment + = Int32.pred blocks_per_commitment) + in + { + level; + level_position; + cycle; + cycle_position; + voting_period; + voting_period_position; + expected_commitment; + } -let diff { level = l1 ; _ } { level = l2 ; _ } = +let diff {level = l1; _} {level = l2; _} = Int32.sub (Raw_level_repr.to_int32 l1) (Raw_level_repr.to_int32 l2) - diff --git a/vendors/ligo-utils/tezos-protocol-alpha/level_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/level_repr.mli index d0ac31664..eddda5ba4 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/level_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/level_repr.mli @@ -24,21 +24,25 @@ (*****************************************************************************) type t = private { - level: Raw_level_repr.t (** The level of the block relative to genesis. This - is also the Shell's notion of level. *); - level_position: int32 (** The level of the block relative to the block that + level : Raw_level_repr.t; + (** The level of the block relative to genesis. This + is also the Shell's notion of level. *) + level_position : int32; + (** The level of the block relative to the block that starts protocol alpha. This is specific to the protocol alpha. Other protocols might or might not - include a similar notion. *); - cycle: Cycle_repr.t (** The current cycle's number. Note that cycles are a + include a similar notion. *) + cycle : Cycle_repr.t; + (** The current cycle's number. Note that cycles are a protocol-specific notion. As a result, the cycle number starts at 0 with the first block of protocol - alpha. *); - cycle_position: int32 (** The current level of the block relative to the first - block of the current cycle. *); - voting_period: Voting_period_repr.t ; - voting_period_position: int32 ; - expected_commitment: bool ; + alpha. *) + cycle_position : int32; + (** The current level of the block relative to the first + block of the current cycle. *) + voting_period : Voting_period_repr.t; + voting_period_position : int32; + expected_commitment : bool; } (* Note that, the type `t` above must respect some invariants (hence the @@ -47,23 +51,24 @@ type t = private { level_position = cycle * blocks_per_cycle + cycle_position *) - - type level = t include Compare.S with type t := level -val encoding: level Data_encoding.t -val pp: Format.formatter -> level -> unit -val pp_full: Format.formatter -> level -> unit +val encoding : level Data_encoding.t -val root: Raw_level_repr.t -> level +val pp : Format.formatter -> level -> unit -val from_raw: +val pp_full : Format.formatter -> level -> unit + +val root : Raw_level_repr.t -> level + +val from_raw : first_level:Raw_level_repr.t -> blocks_per_cycle:int32 -> blocks_per_voting_period:int32 -> blocks_per_commitment:int32 -> - Raw_level_repr.t -> level + Raw_level_repr.t -> + level -val diff: level -> level -> int32 +val diff : level -> level -> int32 diff --git a/vendors/ligo-utils/tezos-protocol-alpha/level_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/level_storage.ml index 956234416..896391e5f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/level_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/level_storage.ml @@ -28,8 +28,11 @@ open Level_repr let from_raw c ?offset l = let l = match offset with - | None -> l - | Some o -> Raw_level_repr.(of_int32_exn (Int32.add (to_int32 l) o)) in + | None -> + l + | Some o -> + Raw_level_repr.(of_int32_exn (Int32.add (to_int32 l) o)) + in let constants = Raw_context.constants c in let first_level = Raw_context.first_level c in Level_repr.from_raw @@ -39,27 +42,32 @@ let from_raw c ?offset l = ~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment l -let root c = - Level_repr.root (Raw_context.first_level c) +let root c = Level_repr.root (Raw_context.first_level c) let succ c l = from_raw c (Raw_level_repr.succ l.level) + let pred c l = match Raw_level_repr.pred l.Level_repr.level with - | None -> None - | Some l -> Some (from_raw c l) + | None -> + None + | Some l -> + Some (from_raw c l) let current ctxt = Raw_context.current_level ctxt let previous ctxt = let l = current ctxt in match pred ctxt l with - | None -> assert false (* We never validate the Genesis... *) - | Some p -> p + | None -> + assert false (* We never validate the Genesis... *) + | Some p -> + p let first_level_in_cycle ctxt c = let constants = Raw_context.constants ctxt in let first_level = Raw_context.first_level ctxt in - from_raw ctxt + from_raw + ctxt (Raw_level_repr.of_int32_exn (Int32.add (Raw_level_repr.to_int32 first_level) @@ -69,14 +77,15 @@ let first_level_in_cycle ctxt c = let last_level_in_cycle ctxt c = match pred ctxt (first_level_in_cycle ctxt (Cycle_repr.succ c)) with - | None -> assert false - | Some x -> x + | None -> + assert false + | Some x -> + x let levels_in_cycle ctxt cycle = let first = first_level_in_cycle ctxt cycle in let rec loop n acc = - if Cycle_repr.(n.cycle = first.cycle) - then loop (succ ctxt n) (n :: acc) + if Cycle_repr.(n.cycle = first.cycle) then loop (succ ctxt n) (n :: acc) else acc in loop first [] @@ -84,8 +93,7 @@ let levels_in_cycle ctxt cycle = let levels_in_current_cycle ctxt ?(offset = 0l) () = let current_cycle = Cycle_repr.to_int32 (current ctxt).cycle in let cycle = Int32.add current_cycle offset in - if Compare.Int32.(cycle < 0l) then - [] + if Compare.Int32.(cycle < 0l) then [] else let cycle = Cycle_repr.of_int32_exn cycle in levels_in_cycle ctxt cycle @@ -93,20 +101,18 @@ let levels_in_current_cycle ctxt ?(offset = 0l) () = let levels_with_commitments_in_cycle ctxt c = let first = first_level_in_cycle ctxt c in let rec loop n acc = - if Cycle_repr.(n.cycle = first.cycle) - then - if n.expected_commitment then - loop (succ ctxt n) (n :: acc) - else - loop (succ ctxt n) acc + if Cycle_repr.(n.cycle = first.cycle) then + if n.expected_commitment then loop (succ ctxt n) (n :: acc) + else loop (succ ctxt n) acc else acc in loop first [] - let last_allowed_fork_level c = let level = Raw_context.current_level c in let preserved_cycles = Constants_storage.preserved_cycles c in match Cycle_repr.sub level.cycle preserved_cycles with - | None -> Raw_level_repr.root - | Some cycle -> (first_level_in_cycle c cycle).level + | None -> + Raw_level_repr.root + | Some cycle -> + (first_level_in_cycle c cycle).level diff --git a/vendors/ligo-utils/tezos-protocol-alpha/level_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/level_storage.mli index 03b2c2991..047fcbb40 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/level_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/level_storage.mli @@ -23,22 +23,29 @@ (* *) (*****************************************************************************) -val current: Raw_context.t -> Level_repr.t -val previous: Raw_context.t -> Level_repr.t +val current : Raw_context.t -> Level_repr.t -val root: Raw_context.t -> Level_repr.t +val previous : Raw_context.t -> Level_repr.t -val from_raw: Raw_context.t -> ?offset:int32 -> Raw_level_repr.t -> Level_repr.t -val pred: Raw_context.t -> Level_repr.t -> Level_repr.t option -val succ: Raw_context.t -> Level_repr.t -> Level_repr.t +val root : Raw_context.t -> Level_repr.t -val first_level_in_cycle: Raw_context.t -> Cycle_repr.t -> Level_repr.t -val last_level_in_cycle: Raw_context.t -> Cycle_repr.t -> Level_repr.t -val levels_in_cycle: Raw_context.t -> Cycle_repr.t -> Level_repr.t list -val levels_in_current_cycle: +val from_raw : + Raw_context.t -> ?offset:int32 -> Raw_level_repr.t -> Level_repr.t + +val pred : Raw_context.t -> Level_repr.t -> Level_repr.t option + +val succ : Raw_context.t -> Level_repr.t -> Level_repr.t + +val first_level_in_cycle : Raw_context.t -> Cycle_repr.t -> Level_repr.t + +val last_level_in_cycle : Raw_context.t -> Cycle_repr.t -> Level_repr.t + +val levels_in_cycle : Raw_context.t -> Cycle_repr.t -> Level_repr.t list + +val levels_in_current_cycle : Raw_context.t -> ?offset:int32 -> unit -> Level_repr.t list -val levels_with_commitments_in_cycle: +val levels_with_commitments_in_cycle : Raw_context.t -> Cycle_repr.t -> Level_repr.t list -val last_allowed_fork_level: Raw_context.t -> Raw_level_repr.t +val last_allowed_fork_level : Raw_context.t -> Raw_level_repr.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/main.ml b/vendors/ligo-utils/tezos-protocol-alpha/main.ml index 61e5ba0f2..2065a9402 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/main.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/main.ml @@ -26,51 +26,66 @@ (* Tezos Protocol Implementation - Protocol Signature Instance *) type block_header_data = Alpha_context.Block_header.protocol_data + type block_header = Alpha_context.Block_header.t = { - shell: Block_header.shell_header ; - protocol_data: block_header_data ; + shell : Block_header.shell_header; + protocol_data : block_header_data; } -let block_header_data_encoding = Alpha_context.Block_header.protocol_data_encoding +let block_header_data_encoding = + Alpha_context.Block_header.protocol_data_encoding type block_header_metadata = Apply_results.block_metadata + let block_header_metadata_encoding = Apply_results.block_metadata_encoding type operation_data = Alpha_context.packed_protocol_data = - | Operation_data : 'kind Alpha_context.Operation.protocol_data -> operation_data + | Operation_data : + 'kind Alpha_context.Operation.protocol_data + -> operation_data + let operation_data_encoding = Alpha_context.Operation.protocol_data_encoding type operation_receipt = Apply_results.packed_operation_metadata = - | Operation_metadata : 'kind Apply_results.operation_metadata -> operation_receipt - | No_operation_metadata: operation_receipt -let operation_receipt_encoding = - Apply_results.operation_metadata_encoding + | Operation_metadata : + 'kind Apply_results.operation_metadata + -> operation_receipt + | No_operation_metadata : operation_receipt + +let operation_receipt_encoding = Apply_results.operation_metadata_encoding let operation_data_and_receipt_encoding = Apply_results.operation_data_and_metadata_encoding type operation = Alpha_context.packed_operation = { - shell: Operation.shell_header ; - protocol_data: operation_data ; + shell : Operation.shell_header; + protocol_data : operation_data; } let acceptable_passes = Alpha_context.Operation.acceptable_passes -let max_block_length = - Alpha_context.Block_header.max_header_length +let max_block_length = Alpha_context.Block_header.max_header_length let max_operation_data_length = Alpha_context.Constants.max_operation_data_length let validation_passes = let max_anonymous_operations = - Alpha_context.Constants.max_revelations_per_block + - (* allow 100 wallet activations or denunciations per block *) 100 in - Updater.[ { max_size = 32 * 1024 ; max_op = Some 32 } ; (* 32 endorsements *) - { max_size = 32 * 1024 ; max_op = None } ; (* 32k of voting operations *) - { max_size = max_anonymous_operations * 1024 ; - max_op = Some max_anonymous_operations } ; - { max_size = 512 * 1024 ; max_op = None } ] (* 512kB *) + Alpha_context.Constants.max_revelations_per_block + + (* allow 100 wallet activations or denunciations per block *) 100 + in + Updater. + [ {max_size = 32 * 1024; max_op = Some 32}; + (* 32 endorsements *) + {max_size = 32 * 1024; max_op = None}; + (* 32k of voting operations *) + { + max_size = max_anonymous_operations * 1024; + max_op = Some max_anonymous_operations; + }; + {max_size = 512 * 1024; max_op = None} ] + +(* 512kB *) let rpc_services = Alpha_services.register () ; @@ -78,168 +93,186 @@ let rpc_services = type validation_mode = | Application of { - block_header : Alpha_context.Block_header.t ; - baker : Alpha_context.public_key_hash ; - block_delay : Alpha_context.Period.t ; + block_header : Alpha_context.Block_header.t; + baker : Alpha_context.public_key_hash; + block_delay : Alpha_context.Period.t; } | Partial_application of { - block_header : Alpha_context.Block_header.t ; - baker : Alpha_context.public_key_hash ; - block_delay : Alpha_context.Period.t ; - } - | Partial_construction of { - predecessor : Block_hash.t ; + block_header : Alpha_context.Block_header.t; + baker : Alpha_context.public_key_hash; + block_delay : Alpha_context.Period.t; } + | Partial_construction of {predecessor : Block_hash.t} | Full_construction of { - predecessor : Block_hash.t ; - protocol_data : Alpha_context.Block_header.contents ; - baker : Alpha_context.public_key_hash ; - block_delay : Alpha_context.Period.t ; + predecessor : Block_hash.t; + protocol_data : Alpha_context.Block_header.contents; + baker : Alpha_context.public_key_hash; + block_delay : Alpha_context.Period.t; } -type validation_state = - { mode : validation_mode ; - chain_id : Chain_id.t ; - ctxt : Alpha_context.t ; - op_count : int ; - } +type validation_state = { + mode : validation_mode; + chain_id : Chain_id.t; + ctxt : Alpha_context.t; + op_count : int; +} -let current_context { ctxt ; _ } = - return (Alpha_context.finalize ctxt).context +let current_context {ctxt; _} = return (Alpha_context.finalize ctxt).context -let begin_partial_application - ~chain_id - ~ancestor_context:ctxt - ~predecessor_timestamp - ~predecessor_fitness +let begin_partial_application ~chain_id ~ancestor_context:ctxt + ~predecessor_timestamp ~predecessor_fitness (block_header : Alpha_context.Block_header.t) = let level = block_header.shell.level in let fitness = predecessor_fitness in let timestamp = block_header.shell.timestamp in - Alpha_context.prepare ~level ~predecessor_timestamp ~timestamp ~fitness ctxt >>=? fun ctxt -> - Apply.begin_application - ctxt chain_id block_header predecessor_timestamp >>=? fun (ctxt, baker, block_delay) -> + Alpha_context.prepare ~level ~predecessor_timestamp ~timestamp ~fitness ctxt + >>=? fun ctxt -> + Apply.begin_application ctxt chain_id block_header predecessor_timestamp + >>=? fun (ctxt, baker, block_delay) -> let mode = Partial_application - { block_header ; baker = Signature.Public_key.hash baker ; block_delay } in - return { mode ; chain_id ; ctxt ; op_count = 0 } + {block_header; baker = Signature.Public_key.hash baker; block_delay} + in + return {mode; chain_id; ctxt; op_count = 0} -let begin_application - ~chain_id - ~predecessor_context:ctxt - ~predecessor_timestamp - ~predecessor_fitness +let begin_application ~chain_id ~predecessor_context:ctxt + ~predecessor_timestamp ~predecessor_fitness (block_header : Alpha_context.Block_header.t) = let level = block_header.shell.level in let fitness = predecessor_fitness in let timestamp = block_header.shell.timestamp in - Alpha_context.prepare ~level ~predecessor_timestamp ~timestamp ~fitness ctxt >>=? fun ctxt -> - Apply.begin_application - ctxt chain_id block_header predecessor_timestamp >>=? fun (ctxt, baker, block_delay) -> + Alpha_context.prepare ~level ~predecessor_timestamp ~timestamp ~fitness ctxt + >>=? fun ctxt -> + Apply.begin_application ctxt chain_id block_header predecessor_timestamp + >>=? fun (ctxt, baker, block_delay) -> let mode = - Application { block_header ; baker = Signature.Public_key.hash baker ; block_delay } in - return { mode ; chain_id ; ctxt ; op_count = 0 } + Application + {block_header; baker = Signature.Public_key.hash baker; block_delay} + in + return {mode; chain_id; ctxt; op_count = 0} -let begin_construction - ~chain_id - ~predecessor_context:ctxt - ~predecessor_timestamp - ~predecessor_level:pred_level - ~predecessor_fitness:pred_fitness - ~predecessor - ~timestamp - ?(protocol_data : block_header_data option) - () = +let begin_construction ~chain_id ~predecessor_context:ctxt + ~predecessor_timestamp ~predecessor_level:pred_level + ~predecessor_fitness:pred_fitness ~predecessor ~timestamp + ?(protocol_data : block_header_data option) () = let level = Int32.succ pred_level in let fitness = pred_fitness in - Alpha_context.prepare ~level ~predecessor_timestamp ~timestamp ~fitness ctxt >>=? fun ctxt -> - begin - match protocol_data with - | None -> - Apply.begin_partial_construction ctxt >>=? fun ctxt -> - let mode = Partial_construction { predecessor } in - return (mode, ctxt) - | Some proto_header -> - Apply.begin_full_construction - ctxt predecessor_timestamp - proto_header.contents >>=? fun (ctxt, protocol_data, baker, block_delay) -> - let mode = - let baker = Signature.Public_key.hash baker in - Full_construction { predecessor ; baker ; protocol_data ; block_delay } in - return (mode, ctxt) - end >>=? fun (mode, ctxt) -> - return { mode ; chain_id ; ctxt ; op_count = 0 } + Alpha_context.prepare ~level ~predecessor_timestamp ~timestamp ~fitness ctxt + >>=? fun ctxt -> + ( match protocol_data with + | None -> + Apply.begin_partial_construction ctxt + >>=? fun ctxt -> + let mode = Partial_construction {predecessor} in + return (mode, ctxt) + | Some proto_header -> + Apply.begin_full_construction + ctxt + predecessor_timestamp + proto_header.contents + >>=? fun (ctxt, protocol_data, baker, block_delay) -> + let mode = + let baker = Signature.Public_key.hash baker in + Full_construction {predecessor; baker; protocol_data; block_delay} + in + return (mode, ctxt) ) + >>=? fun (mode, ctxt) -> return {mode; chain_id; ctxt; op_count = 0} -let apply_operation - ({ mode ; chain_id ; ctxt ; op_count ; _ } as data) +let apply_operation ({mode; chain_id; ctxt; op_count; _} as data) (operation : Alpha_context.packed_operation) = match mode with - | Partial_application _ when - not (List.exists - (Compare.Int.equal 0) - (Alpha_context.Operation.acceptable_passes operation)) -> + | Partial_application _ + when not + (List.exists + (Compare.Int.equal 0) + (Alpha_context.Operation.acceptable_passes operation)) -> (* Multipass validation only considers operations in pass 0. *) let op_count = op_count + 1 in - return ({ data with ctxt ; op_count }, No_operation_metadata) + return ({data with ctxt; op_count}, No_operation_metadata) | _ -> - let { shell ; protocol_data = Operation_data protocol_data } = operation in - let operation : _ Alpha_context.operation = { shell ; protocol_data } in - let predecessor, baker = + let {shell; protocol_data = Operation_data protocol_data} = operation in + let operation : _ Alpha_context.operation = {shell; protocol_data} in + let (predecessor, baker) = match mode with | Partial_application - { block_header = { shell = { predecessor ; _ } ; _ } ; baker } - | Application - { block_header = { shell = { predecessor ; _ } ; _ } ; baker } - | Full_construction { predecessor ; baker ; _ } - -> predecessor, baker - | Partial_construction { predecessor } - -> predecessor, Signature.Public_key_hash.zero + {block_header = {shell = {predecessor; _}; _}; baker} + | Application {block_header = {shell = {predecessor; _}; _}; baker} + | Full_construction {predecessor; baker; _} -> + (predecessor, baker) + | Partial_construction {predecessor} -> + (predecessor, Signature.Public_key_hash.zero) in - Apply.apply_operation ctxt chain_id Optimized predecessor baker + Apply.apply_operation + ctxt + chain_id + Optimized + predecessor + baker (Alpha_context.Operation.hash operation) - operation >>=? fun (ctxt, result) -> + operation + >>=? fun (ctxt, result) -> let op_count = op_count + 1 in - return ({ data with ctxt ; op_count }, Operation_metadata result) + return ({data with ctxt; op_count}, Operation_metadata result) -let finalize_block { mode ; ctxt ; op_count } = +let finalize_block {mode; ctxt; op_count} = match mode with | Partial_construction _ -> let level = Alpha_context.Level.current ctxt in - Alpha_context.Vote.get_current_period_kind ctxt >>=? fun voting_period_kind -> + Alpha_context.Vote.get_current_period_kind ctxt + >>=? fun voting_period_kind -> let baker = Signature.Public_key_hash.zero in Signature.Public_key_hash.Map.fold (fun delegate deposit ctxt -> - ctxt >>=? fun ctxt -> - Alpha_context.Delegate.freeze_deposit ctxt delegate deposit) + ctxt + >>=? fun ctxt -> + Alpha_context.Delegate.freeze_deposit ctxt delegate deposit) (Alpha_context.get_deposits ctxt) - (return ctxt) >>=? fun ctxt -> + (return ctxt) + >>=? fun ctxt -> let ctxt = Alpha_context.finalize ctxt in - return (ctxt, Apply_results.{ baker ; - level ; - voting_period_kind ; - nonce_hash = None ; - consumed_gas = Z.zero ; - deactivated = []; - balance_updates = []}) - | Partial_application { block_header ; baker ; block_delay } -> + return + ( ctxt, + Apply_results. + { + baker; + level; + voting_period_kind; + nonce_hash = None; + consumed_gas = Z.zero; + deactivated = []; + balance_updates = []; + } ) + | Partial_application {block_header; baker; block_delay} -> let level = Alpha_context.Level.current ctxt in let included_endorsements = Alpha_context.included_endorsements ctxt in - Apply.check_minimum_endorsements ctxt + Apply.check_minimum_endorsements + ctxt block_header.protocol_data.contents - block_delay included_endorsements >>=? fun () -> - Alpha_context.Vote.get_current_period_kind ctxt >>=? fun voting_period_kind -> + block_delay + included_endorsements + >>=? fun () -> + Alpha_context.Vote.get_current_period_kind ctxt + >>=? fun voting_period_kind -> let ctxt = Alpha_context.finalize ctxt in - return (ctxt, Apply_results.{ baker ; - level ; - voting_period_kind ; - nonce_hash = None ; - consumed_gas = Z.zero ; - deactivated = []; - balance_updates = []}) + return + ( ctxt, + Apply_results. + { + baker; + level; + voting_period_kind; + nonce_hash = None; + consumed_gas = Z.zero; + deactivated = []; + balance_updates = []; + } ) | Application - { baker ; block_delay ; block_header = { protocol_data = { contents = protocol_data ; _ } ; _ } } - | Full_construction { protocol_data ; baker ; block_delay ; _ } -> - Apply.finalize_application ctxt protocol_data baker ~block_delay >>=? fun (ctxt, receipt) -> + { baker; + block_delay; + block_header = {protocol_data = {contents = protocol_data; _}; _} } + | Full_construction {protocol_data; baker; block_delay; _} -> + Apply.finalize_application ctxt protocol_data baker ~block_delay + >>=? fun (ctxt, receipt) -> let level = Alpha_context.Level.current ctxt in let priority = protocol_data.priority in let raw_level = Alpha_context.Raw_level.to_int32 level.level in @@ -247,69 +280,101 @@ let finalize_block { mode ; ctxt ; op_count } = let commit_message = Format.asprintf "lvl %ld, fit 1:%Ld, prio %d, %d ops" - raw_level fitness priority op_count in + raw_level + fitness + priority + op_count + in let ctxt = Alpha_context.finalize ~commit_message ctxt in return (ctxt, receipt) let compare_operations op1 op2 = let open Alpha_context in - let Operation_data op1 = op1.protocol_data in - let Operation_data op2 = op2.protocol_data in - match op1.contents, op2.contents with - | Single (Endorsement _), Single (Endorsement _) -> 0 - | _, Single (Endorsement _) -> 1 - | Single (Endorsement _), _ -> -1 - - | Single (Seed_nonce_revelation _), Single (Seed_nonce_revelation _) -> 0 - | _, Single (Seed_nonce_revelation _) -> 1 - | Single (Seed_nonce_revelation _), _ -> -1 - - | Single (Double_endorsement_evidence _), Single (Double_endorsement_evidence _) -> 0 - | _, Single (Double_endorsement_evidence _) -> 1 - | Single (Double_endorsement_evidence _), _ -> -1 - - | Single (Double_baking_evidence _), Single (Double_baking_evidence _) -> 0 - | _, Single (Double_baking_evidence _) -> 1 - | Single (Double_baking_evidence _), _ -> -1 - - | Single (Activate_account _), Single (Activate_account _) -> 0 - | _, Single (Activate_account _) -> 1 - | Single (Activate_account _), _ -> -1 - - | Single (Proposals _), Single (Proposals _) -> 0 - | _, Single (Proposals _) -> 1 - | Single (Proposals _), _ -> -1 - - | Single (Ballot _), Single (Ballot _) -> 0 - | _, Single (Ballot _) -> 1 - | Single (Ballot _), _ -> -1 - + let (Operation_data op1) = op1.protocol_data in + let (Operation_data op2) = op2.protocol_data in + match (op1.contents, op2.contents) with + | (Single (Endorsement _), Single (Endorsement _)) -> + 0 + | (_, Single (Endorsement _)) -> + 1 + | (Single (Endorsement _), _) -> + -1 + | (Single (Seed_nonce_revelation _), Single (Seed_nonce_revelation _)) -> + 0 + | (_, Single (Seed_nonce_revelation _)) -> + 1 + | (Single (Seed_nonce_revelation _), _) -> + -1 + | ( Single (Double_endorsement_evidence _), + Single (Double_endorsement_evidence _) ) -> + 0 + | (_, Single (Double_endorsement_evidence _)) -> + 1 + | (Single (Double_endorsement_evidence _), _) -> + -1 + | (Single (Double_baking_evidence _), Single (Double_baking_evidence _)) -> + 0 + | (_, Single (Double_baking_evidence _)) -> + 1 + | (Single (Double_baking_evidence _), _) -> + -1 + | (Single (Activate_account _), Single (Activate_account _)) -> + 0 + | (_, Single (Activate_account _)) -> + 1 + | (Single (Activate_account _), _) -> + -1 + | (Single (Proposals _), Single (Proposals _)) -> + 0 + | (_, Single (Proposals _)) -> + 1 + | (Single (Proposals _), _) -> + -1 + | (Single (Ballot _), Single (Ballot _)) -> + 0 + | (_, Single (Ballot _)) -> + 1 + | (Single (Ballot _), _) -> + -1 (* Manager operations with smaller counter are pre-validated first. *) - | Single (Manager_operation op1), Single (Manager_operation op2) -> + | (Single (Manager_operation op1), Single (Manager_operation op2)) -> Z.compare op1.counter op2.counter - | Cons (Manager_operation op1, _), Single (Manager_operation op2) -> + | (Cons (Manager_operation op1, _), Single (Manager_operation op2)) -> Z.compare op1.counter op2.counter - | Single (Manager_operation op1), Cons (Manager_operation op2, _) -> + | (Single (Manager_operation op1), Cons (Manager_operation op2, _)) -> Z.compare op1.counter op2.counter - | Cons (Manager_operation op1, _), Cons (Manager_operation op2, _) -> + | (Cons (Manager_operation op1, _), Cons (Manager_operation op2, _)) -> Z.compare op1.counter op2.counter let init ctxt block_header = let level = block_header.Block_header.level in let fitness = block_header.fitness in let timestamp = block_header.timestamp in - let typecheck (ctxt:Alpha_context.context) (script:Alpha_context.Script.t) = - Script_ir_translator.parse_script ctxt ~legacy:false script >>=? fun (Ex_script parsed_script, ctxt) -> - Script_ir_translator.extract_big_map_diff ctxt Optimized parsed_script.storage_type parsed_script.storage - ~to_duplicate: Script_ir_translator.no_big_map_id - ~to_update: Script_ir_translator.no_big_map_id - ~temporary:false >>=? fun (storage, big_map_diff, ctxt) -> - Script_ir_translator.unparse_data ctxt Optimized parsed_script.storage_type storage >>=? fun (storage, ctxt) -> - let storage = Alpha_context.Script.lazy_expr (Micheline.strip_locations storage) in - return (({ script with storage }, big_map_diff), ctxt) + let typecheck (ctxt : Alpha_context.context) + (script : Alpha_context.Script.t) = + Script_ir_translator.parse_script ctxt ~legacy:false script + >>=? fun (Ex_script parsed_script, ctxt) -> + Script_ir_translator.extract_big_map_diff + ctxt + Optimized + parsed_script.storage_type + parsed_script.storage + ~to_duplicate:Script_ir_translator.no_big_map_id + ~to_update:Script_ir_translator.no_big_map_id + ~temporary:false + >>=? fun (storage, big_map_diff, ctxt) -> + Script_ir_translator.unparse_data + ctxt + Optimized + parsed_script.storage_type + storage + >>=? fun (storage, ctxt) -> + let storage = + Alpha_context.Script.lazy_expr (Micheline.strip_locations storage) + in + return (({script with storage}, big_map_diff), ctxt) in - Alpha_context.prepare_first_block - ~typecheck - ~level ~timestamp ~fitness ctxt >>=? fun ctxt -> - return (Alpha_context.finalize ctxt) -(* Vanity nonce: 415767323 *) + Alpha_context.prepare_first_block ~typecheck ~level ~timestamp ~fitness ctxt + >>=? fun ctxt -> return (Alpha_context.finalize ctxt) + +(* Vanity nonce: 0050006865723388 *) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/main.mli b/vendors/ligo-utils/tezos-protocol-alpha/main.mli index c0d9f66c3..5b41eb2bf 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/main.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/main.mli @@ -27,44 +27,43 @@ type validation_mode = | Application of { - block_header : Alpha_context.Block_header.t ; - baker : Alpha_context.public_key_hash ; - block_delay : Alpha_context.Period.t ; + block_header : Alpha_context.Block_header.t; + baker : Alpha_context.public_key_hash; + block_delay : Alpha_context.Period.t; } | Partial_application of { - block_header : Alpha_context.Block_header.t ; - baker : Alpha_context.public_key_hash ; - block_delay : Alpha_context.Period.t ; - } - | Partial_construction of { - predecessor : Block_hash.t ; + block_header : Alpha_context.Block_header.t; + baker : Alpha_context.public_key_hash; + block_delay : Alpha_context.Period.t; } + | Partial_construction of {predecessor : Block_hash.t} | Full_construction of { - predecessor : Block_hash.t ; - protocol_data : Alpha_context.Block_header.contents ; - baker : Alpha_context.public_key_hash ; - block_delay : Alpha_context.Period.t ; + predecessor : Block_hash.t; + protocol_data : Alpha_context.Block_header.contents; + baker : Alpha_context.public_key_hash; + block_delay : Alpha_context.Period.t; } -type validation_state = - { mode : validation_mode ; - chain_id : Chain_id.t ; - ctxt : Alpha_context.t ; - op_count : int ; - } +type validation_state = { + mode : validation_mode; + chain_id : Chain_id.t; + ctxt : Alpha_context.t; + op_count : int; +} type operation_data = Alpha_context.packed_protocol_data type operation = Alpha_context.packed_operation = { - shell: Operation.shell_header ; - protocol_data: operation_data ; + shell : Operation.shell_header; + protocol_data : operation_data; } -include Updater.PROTOCOL - with type block_header_data = Alpha_context.Block_header.protocol_data - and type block_header_metadata = Apply_results.block_metadata - and type block_header = Alpha_context.Block_header.t - and type operation_data := operation_data - and type operation_receipt = Apply_results.packed_operation_metadata - and type operation := operation - and type validation_state := validation_state +include + Updater.PROTOCOL + with type block_header_data = Alpha_context.Block_header.protocol_data + and type block_header_metadata = Apply_results.block_metadata + and type block_header = Alpha_context.Block_header.t + and type operation_data := operation_data + and type operation_receipt = Apply_results.packed_operation_metadata + and type operation := operation + and type validation_state := validation_state diff --git a/vendors/ligo-utils/tezos-protocol-alpha/manager_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/manager_repr.ml index 8b7561aeb..b96a51401 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/manager_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/manager_repr.ml @@ -34,27 +34,19 @@ type t = manager_key open Data_encoding let hash_case tag = - case tag + case + tag ~title:"Public_key_hash" Signature.Public_key_hash.encoding - (function - | Hash hash -> Some hash - | _ -> None) + (function Hash hash -> Some hash | _ -> None) (fun hash -> Hash hash) let pubkey_case tag = - case tag + case + tag ~title:"Public_key" Signature.Public_key.encoding - (function - | Public_key hash -> Some hash - | _ -> None) + (function Public_key hash -> Some hash | _ -> None) (fun hash -> Public_key hash) - -let encoding = - union [ - hash_case (Tag 0) ; - pubkey_case (Tag 1) ; - ] - +let encoding = union [hash_case (Tag 0); pubkey_case (Tag 1)] diff --git a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.ml b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.ml index f61e519fe..4bee0a364 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.ml @@ -27,125 +27,147 @@ open Alpha_context open Gas module Cost_of = struct - let log2 = - let rec help acc = function - | 0 -> acc - | n -> help (acc + 1) (n / 2) - in help 1 + let rec help acc = function 0 -> acc | n -> help (acc + 1) (n / 2) in + help 1 let z_bytes (z : Z.t) = let bits = Z.numbits z in (7 + bits) / 8 - let int_bytes (z : 'a Script_int.num) = - z_bytes (Script_int.to_zint z) + let int_bytes (z : 'a Script_int.num) = z_bytes (Script_int.to_zint z) let timestamp_bytes (t : Script_timestamp.t) = let z = Script_timestamp.to_zint t in z_bytes z (* For now, returns size in bytes, but this could get more complicated... *) - let rec size_of_comparable : type a b. (a, b) Script_typed_ir.comparable_struct -> a -> int = - fun wit v -> - match wit with - | Int_key _ -> int_bytes v - | Nat_key _ -> int_bytes v - | String_key _ -> String.length v - | Bytes_key _ -> MBytes.length v - | Bool_key _ -> 8 - | Key_hash_key _ -> Signature.Public_key_hash.size - | Timestamp_key _ -> timestamp_bytes v - | Address_key _ -> Signature.Public_key_hash.size - | Mutez_key _ -> 8 - | Pair_key ((l, _), (r, _), _) -> - let (lval, rval) = v in - size_of_comparable l lval + size_of_comparable r rval + let rec size_of_comparable : + type a b. (a, b) Script_typed_ir.comparable_struct -> a -> int = + fun wit v -> + match wit with + | Int_key _ -> + int_bytes v + | Nat_key _ -> + int_bytes v + | String_key _ -> + String.length v + | Bytes_key _ -> + MBytes.length v + | Bool_key _ -> + 8 + | Key_hash_key _ -> + Signature.Public_key_hash.size + | Timestamp_key _ -> + timestamp_bytes v + | Address_key _ -> + Signature.Public_key_hash.size + | Mutez_key _ -> + 8 + | Pair_key ((l, _), (r, _), _) -> + let (lval, rval) = v in + size_of_comparable l lval + size_of_comparable r rval - let string length = - alloc_bytes_cost length + let string length = alloc_bytes_cost length - let bytes length = - alloc_mbytes_cost length + let bytes length = alloc_mbytes_cost length let manager_operation = step_cost 10_000 module Legacy = struct - let zint z = - alloc_bits_cost (Z.numbits z) + let zint z = alloc_bits_cost (Z.numbits z) - let set_to_list : type item. item Script_typed_ir.set -> cost - = fun (module Box) -> - alloc_cost @@ Pervasives.(Box.size * 2) + let set_to_list : type item. item Script_typed_ir.set -> cost = + fun (module Box) -> alloc_cost @@ Pervasives.(Box.size * 2) let map_to_list : type key value. (key, value) Script_typed_ir.map -> cost - = fun (module Box) -> - let size = snd Box.boxed in - 3 *@ alloc_cost size + = + fun (module Box) -> + let size = snd Box.boxed in + 3 *@ alloc_cost size let z_to_int64 = step_cost 2 +@ alloc_cost 1 - let hash data len = 10 *@ step_cost (MBytes.length data) +@ bytes len + let hash data len = (10 *@ step_cost (MBytes.length data)) +@ bytes len - let set_access : type elt. elt -> elt Script_typed_ir.set -> int - = fun _key (module Box) -> - log2 @@ Box.size + let set_access : type elt. elt -> elt Script_typed_ir.set -> int = + fun _key (module Box) -> log2 @@ Box.size - let set_update key _presence set = - set_access key set *@ alloc_cost 3 + let set_update key _presence set = set_access key set *@ alloc_cost 3 end module Interpreter = struct let cycle = atomic_step_cost 10 + let nop = free + let stack_op = atomic_step_cost 10 + let push = atomic_step_cost 10 + let wrap = atomic_step_cost 10 + let variant_no_data = atomic_step_cost 10 + let branch = atomic_step_cost 10 + let pair = atomic_step_cost 10 + let pair_access = atomic_step_cost 10 + let cons = atomic_step_cost 10 + let loop_size = atomic_step_cost 5 + let loop_cycle = atomic_step_cost 10 + let loop_iter = atomic_step_cost 20 + let loop_map = atomic_step_cost 30 + let empty_set = atomic_step_cost 10 + let set_to_list : type elt. elt Script_typed_ir.set -> cost = - fun (module Box) -> - atomic_step_cost (Box.size * 20) + fun (module Box) -> atomic_step_cost (Box.size * 20) let set_mem : type elt. elt -> elt Script_typed_ir.set -> cost = - fun elt (module Box) -> - let elt_bytes = size_of_comparable Box.elt_ty elt in - atomic_step_cost ((1 + (elt_bytes / 82)) * log2 Box.size) + fun elt (module Box) -> + let elt_bytes = size_of_comparable Box.elt_ty elt in + atomic_step_cost ((1 + (elt_bytes / 82)) * log2 Box.size) let set_update : type elt. elt -> bool -> elt Script_typed_ir.set -> cost = - fun elt _ (module Box) -> - let elt_bytes = size_of_comparable Box.elt_ty elt in - atomic_step_cost ((1 + (elt_bytes / 82)) * log2 Box.size) + fun elt _ (module Box) -> + let elt_bytes = size_of_comparable Box.elt_ty elt in + atomic_step_cost ((1 + (elt_bytes / 82)) * log2 Box.size) let set_size = atomic_step_cost 10 - let empty_map = atomic_step_cost 10 - let map_to_list : type key value. (key, value) Script_typed_ir.map -> cost = - fun (module Box) -> - let size = snd Box.boxed in - atomic_step_cost (size * 20) - let map_access : type key value. key -> (key, value) Script_typed_ir.map -> cost - = fun key (module Box) -> - let map_card = snd Box.boxed in - let key_bytes = size_of_comparable Box.key_ty key in - atomic_step_cost ((1 + (key_bytes / 70)) * log2 map_card) + let empty_map = atomic_step_cost 10 + + let map_to_list : type key value. (key, value) Script_typed_ir.map -> cost + = + fun (module Box) -> + let size = snd Box.boxed in + atomic_step_cost (size * 20) + + let map_access : + type key value. key -> (key, value) Script_typed_ir.map -> cost = + fun key (module Box) -> + let map_card = snd Box.boxed in + let key_bytes = size_of_comparable Box.key_ty key in + atomic_step_cost ((1 + (key_bytes / 70)) * log2 map_card) let map_mem = map_access + let map_get = map_access - let map_update : type key value. key -> value option -> (key, value) Script_typed_ir.map -> cost - = fun key _value (module Box) -> - let map_card = snd Box.boxed in - let key_bytes = size_of_comparable Box.key_ty key in - atomic_step_cost ((1 + (key_bytes / 38)) * log2 map_card) + let map_update : + type key value. + key -> value option -> (key, value) Script_typed_ir.map -> cost = + fun key _value (module Box) -> + let map_card = snd Box.boxed in + let key_bytes = size_of_comparable Box.key_ty key in + atomic_step_cost ((1 + (key_bytes / 38)) * log2 map_card) let map_size = atomic_step_cost 10 @@ -153,16 +175,16 @@ module Cost_of = struct let bytes1 = timestamp_bytes t1 in let bytes2 = int_bytes t2 in atomic_step_cost (51 + (Compare.Int.max bytes1 bytes2 / 62)) + let sub_timestamp = add_timestamp + let diff_timestamps (t1 : Script_timestamp.t) (t2 : Script_timestamp.t) = let bytes1 = timestamp_bytes t1 in let bytes2 = timestamp_bytes t2 in atomic_step_cost (51 + (Compare.Int.max bytes1 bytes2 / 62)) let rec concat_loop l acc = - match l with - | [] -> 30 - | _ :: tl -> concat_loop tl (acc + 30) + match l with [] -> 30 | _ :: tl -> concat_loop tl (acc + 30) let concat_string string_list = atomic_step_cost (concat_loop string_list 0) @@ -170,19 +192,28 @@ module Cost_of = struct let slice_string string_length = atomic_step_cost (40 + (string_length / 70)) - let concat_bytes bytes_list = - atomic_step_cost (concat_loop bytes_list 0) + let concat_bytes bytes_list = atomic_step_cost (concat_loop bytes_list 0) let int64_op = atomic_step_cost 61 + let z_to_int64 = atomic_step_cost 20 + let int64_to_z = atomic_step_cost 20 + let bool_binop _ _ = atomic_step_cost 10 + let bool_unop _ = atomic_step_cost 10 - let abs int = atomic_step_cost (61 + ((int_bytes int) / 70)) + let abs int = atomic_step_cost (61 + (int_bytes int / 70)) + let int _int = free + let neg = abs - let add i1 i2 = atomic_step_cost (51 + (Compare.Int.max (int_bytes i1) (int_bytes i2) / 62)) + + let add i1 i2 = + atomic_step_cost + (51 + (Compare.Int.max (int_bytes i1) (int_bytes i2) / 62)) + let sub = add let mul i1 i2 = @@ -198,303 +229,537 @@ module Cost_of = struct atomic_step_cost (51 + (cost / 3151)) let shift_left _i _shift_bits = atomic_step_cost 30 + let shift_right _i _shift_bits = atomic_step_cost 30 + let logor i1 i2 = let bytes1 = int_bytes i1 in let bytes2 = int_bytes i2 in - atomic_step_cost (51 + ((Compare.Int.max bytes1 bytes2) / 70)) + atomic_step_cost (51 + (Compare.Int.max bytes1 bytes2 / 70)) + let logand i1 i2 = let bytes1 = int_bytes i1 in let bytes2 = int_bytes i2 in - atomic_step_cost (51 + ((Compare.Int.min bytes1 bytes2) / 70)) + atomic_step_cost (51 + (Compare.Int.min bytes1 bytes2 / 70)) + let logxor = logor - let lognot i = atomic_step_cost (51 + ((int_bytes i) / 20)) + + let lognot i = atomic_step_cost (51 + (int_bytes i / 20)) + let exec = atomic_step_cost 10 + let compare_bool _ _ = atomic_step_cost 30 let compare_string s1 s2 = let bytes1 = String.length s1 in let bytes2 = String.length s2 in - atomic_step_cost (30 + ((Compare.Int.min bytes1 bytes2) / 123)) + atomic_step_cost (30 + (Compare.Int.min bytes1 bytes2 / 123)) + let compare_bytes b1 b2 = let bytes1 = MBytes.length b1 in let bytes2 = MBytes.length b2 in - atomic_step_cost (30 + ((Compare.Int.min bytes1 bytes2) / 123)) + atomic_step_cost (30 + (Compare.Int.min bytes1 bytes2 / 123)) + let compare_tez _ _ = atomic_step_cost 30 + let compare_zint i1 i2 = - atomic_step_cost (51 + ((Compare.Int.min (int_bytes i1) (int_bytes i2)) / 82)) + atomic_step_cost + (51 + (Compare.Int.min (int_bytes i1) (int_bytes i2) / 82)) + let compare_key_hash _ _ = atomic_step_cost 92 let compare_timestamp t1 t2 = let bytes1 = timestamp_bytes t1 in let bytes2 = timestamp_bytes t2 in - atomic_step_cost (51 + ((Compare.Int.min bytes1 bytes2) / 82)) + atomic_step_cost (51 + (Compare.Int.min bytes1 bytes2 / 82)) let compare_address _ _ = atomic_step_cost 92 + let compare_res = atomic_step_cost 30 + let unpack_failed bytes = (* We cannot instrument failed deserialization, so we take worst case fees: a set of size 1 bytes values. *) let len = MBytes.length bytes in - (len *@ alloc_mbytes_cost 1) +@ - (len *@ (log2 len *@ (alloc_cost 3 +@ step_cost 1))) + (len *@ alloc_mbytes_cost 1) + +@ (len *@ (log2 len *@ (alloc_cost 3 +@ step_cost 1))) + let address = atomic_step_cost 10 + let contract = step_cost 10000 + let transfer = step_cost 10 + let create_account = step_cost 10 + let create_contract = step_cost 10 + let implicit_account = step_cost 10 + let set_delegate = step_cost 10 +@ write_bytes_cost (Z.of_int 32) + let balance = atomic_step_cost 10 + let now = atomic_step_cost 10 + let check_signature_secp256k1 bytes = atomic_step_cost (10342 + (bytes / 5)) + let check_signature_ed25519 bytes = atomic_step_cost (36864 + (bytes / 5)) + let check_signature_p256 bytes = atomic_step_cost (36864 + (bytes / 5)) + let check_signature (pkey : Signature.public_key) bytes = match pkey with - | Ed25519 _ -> check_signature_ed25519 (MBytes.length bytes) - | Secp256k1 _ -> check_signature_secp256k1 (MBytes.length bytes) - | P256 _ -> check_signature_p256 (MBytes.length bytes) + | Ed25519 _ -> + check_signature_ed25519 (MBytes.length bytes) + | Secp256k1 _ -> + check_signature_secp256k1 (MBytes.length bytes) + | P256 _ -> + check_signature_p256 (MBytes.length bytes) + let hash_key = atomic_step_cost 30 - let hash_blake2b b = atomic_step_cost (102 + ((MBytes.length b) / 5)) - let hash_sha256 b = atomic_step_cost (409 + (MBytes.length b)) + + let hash_blake2b b = atomic_step_cost (102 + (MBytes.length b / 5)) + + let hash_sha256 b = atomic_step_cost (409 + MBytes.length b) + let hash_sha512 b = - let bytes = MBytes.length b in atomic_step_cost (409 + ((bytes lsr 1) + (bytes lsr 4))) + let bytes = MBytes.length b in + atomic_step_cost (409 + ((bytes lsr 1) + (bytes lsr 4))) + let steps_to_quota = atomic_step_cost 10 + let source = atomic_step_cost 10 + let self = atomic_step_cost 10 + let amount = atomic_step_cost 10 + let chain_id = step_cost 1 - let stack_n_op n = atomic_step_cost (20 + (((n lsr 1) + (n lsr 2)) + (n lsr 4))) + + let stack_n_op n = + atomic_step_cost (20 + ((n lsr 1) + (n lsr 2) + (n lsr 4))) + let apply = alloc_cost 8 +@ step_cost 1 - let rec compare : type a s. (a, s) Script_typed_ir.comparable_struct -> a -> a -> cost = fun ty x y -> + let rec compare : + type a s. (a, s) Script_typed_ir.comparable_struct -> a -> a -> cost = + fun ty x y -> match ty with - | Bool_key _ -> compare_bool x y - | String_key _ -> compare_string x y - | Bytes_key _ -> compare_bytes x y - | Mutez_key _ -> compare_tez x y - | Int_key _ -> compare_zint x y - | Nat_key _ -> compare_zint x y - | Key_hash_key _ -> compare_key_hash x y - | Timestamp_key _ -> compare_timestamp x y - | Address_key _ -> compare_address x y + | Bool_key _ -> + compare_bool x y + | String_key _ -> + compare_string x y + | Bytes_key _ -> + compare_bytes x y + | Mutez_key _ -> + compare_tez x y + | Int_key _ -> + compare_zint x y + | Nat_key _ -> + compare_zint x y + | Key_hash_key _ -> + compare_key_hash x y + | Timestamp_key _ -> + compare_timestamp x y + | Address_key _ -> + compare_address x y | Pair_key ((tl, _), (tr, _), _) -> (* Reasonable over-approximation of the cost of lexicographic comparison. *) let (xl, xr) = x and (yl, yr) = y in compare tl xl yl +@ compare tr xr yr - end module Typechecking = struct let cycle = step_cost 1 + let bool = free + let unit = free + let string = string + let bytes = bytes + let z = Legacy.zint + let int_of_string str = - alloc_cost @@ (Pervasives.(/) (String.length str) 5) + alloc_cost @@ Pervasives.( / ) (String.length str) 5 + let tez = step_cost 1 +@ alloc_cost 1 + let string_timestamp = step_cost 3 +@ alloc_cost 3 + let key = step_cost 3 +@ alloc_cost 3 + let key_hash = step_cost 1 +@ alloc_cost 1 + let signature = step_cost 1 +@ alloc_cost 1 + let chain_id = step_cost 1 +@ alloc_cost 1 + let contract = step_cost 5 + let get_script = step_cost 20 +@ alloc_cost 5 + let contract_exists = step_cost 15 +@ alloc_cost 5 + let pair = alloc_cost 2 + let union = alloc_cost 1 + let lambda = alloc_cost 5 +@ step_cost 3 + let some = alloc_cost 1 + let none = alloc_cost 0 + let list_element = alloc_cost 2 +@ step_cost 1 + let set_element size = log2 size *@ (alloc_cost 3 +@ step_cost 2) + let map_element size = log2 size *@ (alloc_cost 4 +@ step_cost 2) + let primitive_type = alloc_cost 1 + let one_arg_type = alloc_cost 2 + let two_arg_type = alloc_cost 3 + let operation b = bytes b + let type_ nb_args = alloc_cost (nb_args + 1) (* Cost of parsing instruction, is cost of allocation of constructor + cost of contructor parameters + cost of allocation on the stack type *) - let instr - : type b a. (b, a) Script_typed_ir.instr -> cost - = fun i -> - let open Script_typed_ir in - alloc_cost 1 +@ (* cost of allocation of constructor *) - match i with - | Drop -> alloc_cost 0 - | Dup -> alloc_cost 1 - | Swap -> alloc_cost 0 - | Const _ -> alloc_cost 1 - | Cons_pair -> alloc_cost 2 - | Car -> alloc_cost 1 - | Cdr -> alloc_cost 1 - | Cons_some -> alloc_cost 2 - | Cons_none _ -> alloc_cost 3 - | If_none _ -> alloc_cost 2 - | Left -> alloc_cost 3 - | Right -> alloc_cost 3 - | If_left _ -> alloc_cost 2 - | Cons_list -> alloc_cost 1 - | Nil -> alloc_cost 1 - | If_cons _ -> alloc_cost 2 - | List_map _ -> alloc_cost 5 - | List_iter _ -> alloc_cost 4 - | List_size -> alloc_cost 1 - | Empty_set _ -> alloc_cost 1 - | Set_iter _ -> alloc_cost 4 - | Set_mem -> alloc_cost 1 - | Set_update -> alloc_cost 1 - | Set_size -> alloc_cost 1 - | Empty_map _ -> alloc_cost 2 - | Map_map _ -> alloc_cost 5 - | Map_iter _ -> alloc_cost 4 - | Map_mem -> alloc_cost 1 - | Map_get -> alloc_cost 1 - | Map_update -> alloc_cost 1 - | Map_size -> alloc_cost 1 - | Empty_big_map _ -> alloc_cost 2 - | Big_map_mem -> alloc_cost 1 - | Big_map_get -> alloc_cost 1 - | Big_map_update -> alloc_cost 1 - | Concat_string -> alloc_cost 1 - | Concat_string_pair -> alloc_cost 1 - | Concat_bytes -> alloc_cost 1 - | Concat_bytes_pair -> alloc_cost 1 - | Slice_string -> alloc_cost 1 - | Slice_bytes -> alloc_cost 1 - | String_size -> alloc_cost 1 - | Bytes_size -> alloc_cost 1 - | Add_seconds_to_timestamp -> alloc_cost 1 - | Add_timestamp_to_seconds -> alloc_cost 1 - | Sub_timestamp_seconds -> alloc_cost 1 - | Diff_timestamps -> alloc_cost 1 - | Add_tez -> alloc_cost 1 - | Sub_tez -> alloc_cost 1 - | Mul_teznat -> alloc_cost 1 - | Mul_nattez -> alloc_cost 1 - | Ediv_teznat -> alloc_cost 1 - | Ediv_tez -> alloc_cost 1 - | Or -> alloc_cost 1 - | And -> alloc_cost 1 - | Xor -> alloc_cost 1 - | Not -> alloc_cost 1 - | Is_nat -> alloc_cost 1 - | Neg_nat -> alloc_cost 1 - | Neg_int -> alloc_cost 1 - | Abs_int -> alloc_cost 1 - | Int_nat -> alloc_cost 1 - | Add_intint -> alloc_cost 1 - | Add_intnat -> alloc_cost 1 - | Add_natint -> alloc_cost 1 - | Add_natnat -> alloc_cost 1 - | Sub_int -> alloc_cost 1 - | Mul_intint -> alloc_cost 1 - | Mul_intnat -> alloc_cost 1 - | Mul_natint -> alloc_cost 1 - | Mul_natnat -> alloc_cost 1 - | Ediv_intint -> alloc_cost 1 - | Ediv_intnat -> alloc_cost 1 - | Ediv_natint -> alloc_cost 1 - | Ediv_natnat -> alloc_cost 1 - | Lsl_nat -> alloc_cost 1 - | Lsr_nat -> alloc_cost 1 - | Or_nat -> alloc_cost 1 - | And_nat -> alloc_cost 1 - | And_int_nat -> alloc_cost 1 - | Xor_nat -> alloc_cost 1 - | Not_nat -> alloc_cost 1 - | Not_int -> alloc_cost 1 - | Seq _ -> alloc_cost 8 - | If _ -> alloc_cost 8 - | Loop _ -> alloc_cost 4 - | Loop_left _ -> alloc_cost 5 - | Dip _ -> alloc_cost 4 - | Exec -> alloc_cost 1 - | Apply _ -> alloc_cost 1 - | Lambda _ -> alloc_cost 2 - | Failwith _ -> alloc_cost 1 - | Nop -> alloc_cost 0 - | Compare _ -> alloc_cost 1 - | Eq -> alloc_cost 1 - | Neq -> alloc_cost 1 - | Lt -> alloc_cost 1 - | Gt -> alloc_cost 1 - | Le -> alloc_cost 1 - | Ge -> alloc_cost 1 - | Address -> alloc_cost 1 - | Contract _ -> alloc_cost 2 - | Transfer_tokens -> alloc_cost 1 - | Create_account -> alloc_cost 2 - | Implicit_account -> alloc_cost 1 - | Create_contract _ -> alloc_cost 8 - (* Deducted the cost of removed arguments manager, spendable and delegatable: + let instr : type b a. (b, a) Script_typed_ir.instr -> cost = + fun i -> + let open Script_typed_ir in + alloc_cost 1 + +@ + (* cost of allocation of constructor *) + match i with + | Drop -> + alloc_cost 0 + | Dup -> + alloc_cost 1 + | Swap -> + alloc_cost 0 + | Const _ -> + alloc_cost 1 + | Cons_pair -> + alloc_cost 2 + | Car -> + alloc_cost 1 + | Cdr -> + alloc_cost 1 + | Cons_some -> + alloc_cost 2 + | Cons_none _ -> + alloc_cost 3 + | If_none _ -> + alloc_cost 2 + | Left -> + alloc_cost 3 + | Right -> + alloc_cost 3 + | If_left _ -> + alloc_cost 2 + | Cons_list -> + alloc_cost 1 + | Nil -> + alloc_cost 1 + | If_cons _ -> + alloc_cost 2 + | List_map _ -> + alloc_cost 5 + | List_iter _ -> + alloc_cost 4 + | List_size -> + alloc_cost 1 + | Empty_set _ -> + alloc_cost 1 + | Set_iter _ -> + alloc_cost 4 + | Set_mem -> + alloc_cost 1 + | Set_update -> + alloc_cost 1 + | Set_size -> + alloc_cost 1 + | Empty_map _ -> + alloc_cost 2 + | Map_map _ -> + alloc_cost 5 + | Map_iter _ -> + alloc_cost 4 + | Map_mem -> + alloc_cost 1 + | Map_get -> + alloc_cost 1 + | Map_update -> + alloc_cost 1 + | Map_size -> + alloc_cost 1 + | Empty_big_map _ -> + alloc_cost 2 + | Big_map_mem -> + alloc_cost 1 + | Big_map_get -> + alloc_cost 1 + | Big_map_update -> + alloc_cost 1 + | Concat_string -> + alloc_cost 1 + | Concat_string_pair -> + alloc_cost 1 + | Concat_bytes -> + alloc_cost 1 + | Concat_bytes_pair -> + alloc_cost 1 + | Slice_string -> + alloc_cost 1 + | Slice_bytes -> + alloc_cost 1 + | String_size -> + alloc_cost 1 + | Bytes_size -> + alloc_cost 1 + | Add_seconds_to_timestamp -> + alloc_cost 1 + | Add_timestamp_to_seconds -> + alloc_cost 1 + | Sub_timestamp_seconds -> + alloc_cost 1 + | Diff_timestamps -> + alloc_cost 1 + | Add_tez -> + alloc_cost 1 + | Sub_tez -> + alloc_cost 1 + | Mul_teznat -> + alloc_cost 1 + | Mul_nattez -> + alloc_cost 1 + | Ediv_teznat -> + alloc_cost 1 + | Ediv_tez -> + alloc_cost 1 + | Or -> + alloc_cost 1 + | And -> + alloc_cost 1 + | Xor -> + alloc_cost 1 + | Not -> + alloc_cost 1 + | Is_nat -> + alloc_cost 1 + | Neg_nat -> + alloc_cost 1 + | Neg_int -> + alloc_cost 1 + | Abs_int -> + alloc_cost 1 + | Int_nat -> + alloc_cost 1 + | Add_intint -> + alloc_cost 1 + | Add_intnat -> + alloc_cost 1 + | Add_natint -> + alloc_cost 1 + | Add_natnat -> + alloc_cost 1 + | Sub_int -> + alloc_cost 1 + | Mul_intint -> + alloc_cost 1 + | Mul_intnat -> + alloc_cost 1 + | Mul_natint -> + alloc_cost 1 + | Mul_natnat -> + alloc_cost 1 + | Ediv_intint -> + alloc_cost 1 + | Ediv_intnat -> + alloc_cost 1 + | Ediv_natint -> + alloc_cost 1 + | Ediv_natnat -> + alloc_cost 1 + | Lsl_nat -> + alloc_cost 1 + | Lsr_nat -> + alloc_cost 1 + | Or_nat -> + alloc_cost 1 + | And_nat -> + alloc_cost 1 + | And_int_nat -> + alloc_cost 1 + | Xor_nat -> + alloc_cost 1 + | Not_nat -> + alloc_cost 1 + | Not_int -> + alloc_cost 1 + | Seq _ -> + alloc_cost 8 + | If _ -> + alloc_cost 8 + | Loop _ -> + alloc_cost 4 + | Loop_left _ -> + alloc_cost 5 + | Dip _ -> + alloc_cost 4 + | Exec -> + alloc_cost 1 + | Apply _ -> + alloc_cost 1 + | Lambda _ -> + alloc_cost 2 + | Failwith _ -> + alloc_cost 1 + | Nop -> + alloc_cost 0 + | Compare _ -> + alloc_cost 1 + | Eq -> + alloc_cost 1 + | Neq -> + alloc_cost 1 + | Lt -> + alloc_cost 1 + | Gt -> + alloc_cost 1 + | Le -> + alloc_cost 1 + | Ge -> + alloc_cost 1 + | Address -> + alloc_cost 1 + | Contract _ -> + alloc_cost 2 + | Transfer_tokens -> + alloc_cost 1 + | Create_account -> + alloc_cost 2 + | Implicit_account -> + alloc_cost 1 + | Create_contract _ -> + alloc_cost 8 + (* Deducted the cost of removed arguments manager, spendable and delegatable: - manager: key_hash = 1 - spendable: bool = 0 - delegatable: bool = 0 *) - | Create_contract_2 _ -> alloc_cost 7 - | Set_delegate -> alloc_cost 1 - | Now -> alloc_cost 1 - | Balance -> alloc_cost 1 - | Check_signature -> alloc_cost 1 - | Hash_key -> alloc_cost 1 - | Pack _ -> alloc_cost 2 - | Unpack _ -> alloc_cost 2 - | Blake2b -> alloc_cost 1 - | Sha256 -> alloc_cost 1 - | Sha512 -> alloc_cost 1 - | Steps_to_quota -> alloc_cost 1 - | Source -> alloc_cost 1 - | Sender -> alloc_cost 1 - | Self _ -> alloc_cost 2 - | Amount -> alloc_cost 1 - | Dig (n,_) -> n *@ alloc_cost 1 (* _ is a unary development of n *) - | Dug (n,_) -> n *@ alloc_cost 1 - | Dipn (n,_,_) -> n *@ alloc_cost 1 - | Dropn (n,_) -> n *@ alloc_cost 1 - | ChainId -> alloc_cost 1 + | Create_contract_2 _ -> + alloc_cost 7 + | Set_delegate -> + alloc_cost 1 + | Now -> + alloc_cost 1 + | Balance -> + alloc_cost 1 + | Check_signature -> + alloc_cost 1 + | Hash_key -> + alloc_cost 1 + | Pack _ -> + alloc_cost 2 + | Unpack _ -> + alloc_cost 2 + | Blake2b -> + alloc_cost 1 + | Sha256 -> + alloc_cost 1 + | Sha512 -> + alloc_cost 1 + | Steps_to_quota -> + alloc_cost 1 + | Source -> + alloc_cost 1 + | Sender -> + alloc_cost 1 + | Self _ -> + alloc_cost 2 + | Amount -> + alloc_cost 1 + | Dig (n, _) -> + n *@ alloc_cost 1 (* _ is a unary development of n *) + | Dug (n, _) -> + n *@ alloc_cost 1 + | Dipn (n, _, _) -> + n *@ alloc_cost 1 + | Dropn (n, _) -> + n *@ alloc_cost 1 + | ChainId -> + alloc_cost 1 end module Unparse = struct let prim_cost l annot = Script.prim_node_cost_nonrec_of_length l annot + let seq_cost = Script.seq_node_cost_nonrec_of_length + let string_cost length = Script.string_node_cost_of_length length let cycle = step_cost 1 + let bool = prim_cost 0 [] + let unit = prim_cost 0 [] + (* We count the length of strings and bytes to prevent hidden miscalculations due to non detectable expansion of sharing. *) let string s = Script.string_node_cost s + let bytes s = Script.bytes_node_cost s + let z i = Script.int_node_cost i + let int i = Script.int_node_cost (Script_int.to_zint i) + let tez = Script.int_node_cost_of_numbits 60 (* int64 bound *) + let timestamp x = Script_timestamp.to_zint x |> Script_int.of_zint |> int + let operation bytes = Script.bytes_node_cost bytes + let chain_id bytes = Script.bytes_node_cost bytes + let key = string_cost 54 + let key_hash = string_cost 36 + let signature = string_cost 128 + let contract = string_cost 36 + let pair = prim_cost 2 [] + let union = prim_cost 1 [] + let some = prim_cost 1 [] + let none = prim_cost 0 [] + let list_element = alloc_cost 2 + let set_element = alloc_cost 2 + let map_element = alloc_cost 2 + let one_arg_type = prim_cost 1 + let two_arg_type = prim_cost 2 let set_to_list = Legacy.set_to_list + let map_to_list = Legacy.map_to_list end - end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.mli b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.mli index c950a7496..98205ee57 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_gas.mli @@ -26,107 +26,194 @@ open Alpha_context module Cost_of : sig - val manager_operation : Gas.cost module Legacy : sig val z_to_int64 : Gas.cost + val hash : MBytes.t -> int -> Gas.cost - val map_to_list : - ('b, 'c) Script_typed_ir.map -> Gas.cost + + val map_to_list : ('b, 'c) Script_typed_ir.map -> Gas.cost + val set_update : 'a -> bool -> 'a Script_typed_ir.set -> Gas.cost end module Interpreter : sig val cycle : Gas.cost + val loop_cycle : Gas.cost + val loop_size : Gas.cost + val loop_iter : Gas.cost + val loop_map : Gas.cost + val nop : Gas.cost + val stack_op : Gas.cost + val stack_n_op : int -> Gas.cost + val bool_binop : 'a -> 'b -> Gas.cost + val bool_unop : 'a -> Gas.cost + val pair : Gas.cost + val pair_access : Gas.cost + val cons : Gas.cost + val variant_no_data : Gas.cost + val branch : Gas.cost + val concat_string : string list -> Gas.cost + val concat_bytes : MBytes.t list -> Gas.cost + val slice_string : int -> Gas.cost - val map_mem : 'a -> ('a, 'b) Script_typed_ir.map -> Gas.cost + + val map_mem : 'a -> ('a, 'b) Script_typed_ir.map -> Gas.cost + val map_to_list : ('a, 'b) Script_typed_ir.map -> Gas.cost + val map_get : 'a -> ('a, 'b) Script_typed_ir.map -> Gas.cost - val map_update : 'a -> 'b option -> ('a, 'b) Script_typed_ir.map -> Gas.cost + + val map_update : + 'a -> 'b option -> ('a, 'b) Script_typed_ir.map -> Gas.cost + val map_size : Gas.cost + val set_to_list : 'a Script_typed_ir.set -> Gas.cost + val set_update : 'a -> bool -> 'a Script_typed_ir.set -> Gas.cost + val set_mem : 'a -> 'a Script_typed_ir.set -> Gas.cost + val mul : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val div : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val add : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val sub : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val abs : 'a Script_int.num -> Gas.cost + val neg : 'a Script_int.num -> Gas.cost + val int : 'a -> Gas.cost + val add_timestamp : Script_timestamp.t -> 'a Script_int.num -> Gas.cost + val sub_timestamp : Script_timestamp.t -> 'a Script_int.num -> Gas.cost + val diff_timestamps : Script_timestamp.t -> Script_timestamp.t -> Gas.cost + val empty_set : Gas.cost + val set_size : Gas.cost + val empty_map : Gas.cost + val int64_op : Gas.cost + val z_to_int64 : Gas.cost + val int64_to_z : Gas.cost + val logor : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val logand : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val logxor : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val lognot : 'a Script_int.num -> Gas.cost + val shift_left : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val shift_right : 'a Script_int.num -> 'b Script_int.num -> Gas.cost + val exec : Gas.cost + val push : Gas.cost + val compare_res : Gas.cost + val unpack_failed : MBytes.t -> Gas.cost + val address : Gas.cost + val contract : Gas.cost + val transfer : Gas.cost + val create_account : Gas.cost + val create_contract : Gas.cost + val implicit_account : Gas.cost + val set_delegate : Gas.cost + val balance : Gas.cost + val now : Gas.cost + val check_signature : public_key -> MBytes.t -> Gas.cost + val hash_key : Gas.cost + val hash_blake2b : MBytes.t -> Gas.cost + val hash_sha256 : MBytes.t -> Gas.cost + val hash_sha512 : MBytes.t -> Gas.cost + val steps_to_quota : Gas.cost + val source : Gas.cost + val self : Gas.cost + val amount : Gas.cost + val chain_id : Gas.cost + val wrap : Gas.cost + val compare : 'a Script_typed_ir.comparable_ty -> 'a -> 'a -> Gas.cost + val apply : Gas.cost end module Typechecking : sig val cycle : Gas.cost + val unit : Gas.cost + val bool : Gas.cost + val tez : Gas.cost + val z : Z.t -> Gas.cost + val string : int -> Gas.cost + val bytes : int -> Gas.cost + val int_of_string : string -> Gas.cost + val string_timestamp : Gas.cost + val key : Gas.cost + val key_hash : Gas.cost + val signature : Gas.cost + val chain_id : Gas.cost val contract : Gas.cost @@ -144,14 +231,19 @@ module Cost_of : sig val lambda : Gas.cost val some : Gas.cost + val none : Gas.cost val list_element : Gas.cost + val set_element : int -> Gas.cost + val map_element : int -> Gas.cost val primitive_type : Gas.cost + val one_arg_type : Gas.cost + val two_arg_type : Gas.cost val operation : int -> Gas.cost @@ -165,20 +257,35 @@ module Cost_of : sig module Unparse : sig val prim_cost : int -> Script.annot -> Gas.cost + val seq_cost : int -> Gas.cost + val cycle : Gas.cost + val unit : Gas.cost + val bool : Gas.cost + val z : Z.t -> Gas.cost + val int : 'a Script_int.num -> Gas.cost + val tez : Gas.cost + val string : string -> Gas.cost + val bytes : MBytes.t -> Gas.cost + val timestamp : Script_timestamp.t -> Gas.cost + val key : Gas.cost + val key_hash : Gas.cost + val signature : Gas.cost + val operation : MBytes.t -> Gas.cost + val chain_id : MBytes.t -> Gas.cost val contract : Gas.cost @@ -189,15 +296,21 @@ module Cost_of : sig val union : Gas.cost val some : Gas.cost + val none : Gas.cost val list_element : Gas.cost + val set_element : Gas.cost + val map_element : Gas.cost val one_arg_type : Script.annot -> Gas.cost + val two_arg_type : Script.annot -> Gas.cost + val set_to_list : 'a Script_typed_ir.set -> Gas.cost + val map_to_list : ('a, 'b) Script_typed_ir.map -> Gas.cost end end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.ml b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.ml index 6c6a1025b..a2f92870f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.ml @@ -26,8 +26,12 @@ open Micheline type error += Unknown_primitive_name of string + type error += Invalid_case of string -type error += Invalid_primitive_name of string Micheline.canonical * Micheline.canonical_location + +type error += + | Invalid_primitive_name of + string Micheline.canonical * Micheline.canonical_location type prim = | K_parameter @@ -150,486 +154,711 @@ type prim = | T_chain_id let valid_case name = - let is_lower = function '_' | 'a'..'z' -> true | _ -> false in - let is_upper = function '_' | 'A'..'Z' -> true | _ -> false in + let is_lower = function '_' | 'a' .. 'z' -> true | _ -> false in + let is_upper = function '_' | 'A' .. 'Z' -> true | _ -> false in let rec for_all a b f = - Compare.Int.(a > b) || f a && for_all (a + 1) b f in + Compare.Int.(a > b) || (f a && for_all (a + 1) b f) + in let len = String.length name in Compare.Int.(len <> 0) - && - Compare.Char.(String.get name 0 <> '_') - && - ((is_upper (String.get name 0) - && for_all 1 (len - 1) (fun i -> is_upper (String.get name i))) - || - (is_upper (String.get name 0) - && for_all 1 (len - 1) (fun i -> is_lower (String.get name i))) - || - (is_lower (String.get name 0) - && for_all 1 (len - 1) (fun i -> is_lower (String.get name i)))) + && Compare.Char.(name.[0] <> '_') + && ( (is_upper name.[0] && for_all 1 (len - 1) (fun i -> is_upper name.[i])) + || (is_upper name.[0] && for_all 1 (len - 1) (fun i -> is_lower name.[i])) + || (is_lower name.[0] && for_all 1 (len - 1) (fun i -> is_lower name.[i])) + ) let string_of_prim = function - | K_parameter -> "parameter" - | K_storage -> "storage" - | K_code -> "code" - | D_False -> "False" - | D_Elt -> "Elt" - | D_Left -> "Left" - | D_None -> "None" - | D_Pair -> "Pair" - | D_Right -> "Right" - | D_Some -> "Some" - | D_True -> "True" - | D_Unit -> "Unit" - | I_PACK -> "PACK" - | I_UNPACK -> "UNPACK" - | I_BLAKE2B -> "BLAKE2B" - | I_SHA256 -> "SHA256" - | I_SHA512 -> "SHA512" - | I_ABS -> "ABS" - | I_ADD -> "ADD" - | I_AMOUNT -> "AMOUNT" - | I_AND -> "AND" - | I_BALANCE -> "BALANCE" - | I_CAR -> "CAR" - | I_CDR -> "CDR" - | I_CHAIN_ID -> "CHAIN_ID" - | I_CHECK_SIGNATURE -> "CHECK_SIGNATURE" - | I_COMPARE -> "COMPARE" - | I_CONCAT -> "CONCAT" - | I_CONS -> "CONS" - | I_CREATE_ACCOUNT -> "CREATE_ACCOUNT" - | I_CREATE_CONTRACT -> "CREATE_CONTRACT" - | I_IMPLICIT_ACCOUNT -> "IMPLICIT_ACCOUNT" - | I_DIP -> "DIP" - | I_DROP -> "DROP" - | I_DUP -> "DUP" - | I_EDIV -> "EDIV" - | I_EMPTY_BIG_MAP -> "EMPTY_BIG_MAP" - | I_EMPTY_MAP -> "EMPTY_MAP" - | I_EMPTY_SET -> "EMPTY_SET" - | I_EQ -> "EQ" - | I_EXEC -> "EXEC" - | I_APPLY -> "APPLY" - | I_FAILWITH -> "FAILWITH" - | I_GE -> "GE" - | I_GET -> "GET" - | I_GT -> "GT" - | I_HASH_KEY -> "HASH_KEY" - | I_IF -> "IF" - | I_IF_CONS -> "IF_CONS" - | I_IF_LEFT -> "IF_LEFT" - | I_IF_NONE -> "IF_NONE" - | I_INT -> "INT" - | I_LAMBDA -> "LAMBDA" - | I_LE -> "LE" - | I_LEFT -> "LEFT" - | I_LOOP -> "LOOP" - | I_LSL -> "LSL" - | I_LSR -> "LSR" - | I_LT -> "LT" - | I_MAP -> "MAP" - | I_MEM -> "MEM" - | I_MUL -> "MUL" - | I_NEG -> "NEG" - | I_NEQ -> "NEQ" - | I_NIL -> "NIL" - | I_NONE -> "NONE" - | I_NOT -> "NOT" - | I_NOW -> "NOW" - | I_OR -> "OR" - | I_PAIR -> "PAIR" - | I_PUSH -> "PUSH" - | I_RIGHT -> "RIGHT" - | I_SIZE -> "SIZE" - | I_SOME -> "SOME" - | I_SOURCE -> "SOURCE" - | I_SENDER -> "SENDER" - | I_SELF -> "SELF" - | I_SLICE -> "SLICE" - | I_STEPS_TO_QUOTA -> "STEPS_TO_QUOTA" - | I_SUB -> "SUB" - | I_SWAP -> "SWAP" - | I_TRANSFER_TOKENS -> "TRANSFER_TOKENS" - | I_SET_DELEGATE -> "SET_DELEGATE" - | I_UNIT -> "UNIT" - | I_UPDATE -> "UPDATE" - | I_XOR -> "XOR" - | I_ITER -> "ITER" - | I_LOOP_LEFT -> "LOOP_LEFT" - | I_ADDRESS -> "ADDRESS" - | I_CONTRACT -> "CONTRACT" - | I_ISNAT -> "ISNAT" - | I_CAST -> "CAST" - | I_RENAME -> "RENAME" - | I_DIG -> "DIG" - | I_DUG -> "DUG" - | T_bool -> "bool" - | T_contract -> "contract" - | T_int -> "int" - | T_key -> "key" - | T_key_hash -> "key_hash" - | T_lambda -> "lambda" - | T_list -> "list" - | T_map -> "map" - | T_big_map -> "big_map" - | T_nat -> "nat" - | T_option -> "option" - | T_or -> "or" - | T_pair -> "pair" - | T_set -> "set" - | T_signature -> "signature" - | T_string -> "string" - | T_bytes -> "bytes" - | T_mutez -> "mutez" - | T_timestamp -> "timestamp" - | T_unit -> "unit" - | T_operation -> "operation" - | T_address -> "address" - | T_chain_id -> "chain_id" + | K_parameter -> + "parameter" + | K_storage -> + "storage" + | K_code -> + "code" + | D_False -> + "False" + | D_Elt -> + "Elt" + | D_Left -> + "Left" + | D_None -> + "None" + | D_Pair -> + "Pair" + | D_Right -> + "Right" + | D_Some -> + "Some" + | D_True -> + "True" + | D_Unit -> + "Unit" + | I_PACK -> + "PACK" + | I_UNPACK -> + "UNPACK" + | I_BLAKE2B -> + "BLAKE2B" + | I_SHA256 -> + "SHA256" + | I_SHA512 -> + "SHA512" + | I_ABS -> + "ABS" + | I_ADD -> + "ADD" + | I_AMOUNT -> + "AMOUNT" + | I_AND -> + "AND" + | I_BALANCE -> + "BALANCE" + | I_CAR -> + "CAR" + | I_CDR -> + "CDR" + | I_CHAIN_ID -> + "CHAIN_ID" + | I_CHECK_SIGNATURE -> + "CHECK_SIGNATURE" + | I_COMPARE -> + "COMPARE" + | I_CONCAT -> + "CONCAT" + | I_CONS -> + "CONS" + | I_CREATE_ACCOUNT -> + "CREATE_ACCOUNT" + | I_CREATE_CONTRACT -> + "CREATE_CONTRACT" + | I_IMPLICIT_ACCOUNT -> + "IMPLICIT_ACCOUNT" + | I_DIP -> + "DIP" + | I_DROP -> + "DROP" + | I_DUP -> + "DUP" + | I_EDIV -> + "EDIV" + | I_EMPTY_BIG_MAP -> + "EMPTY_BIG_MAP" + | I_EMPTY_MAP -> + "EMPTY_MAP" + | I_EMPTY_SET -> + "EMPTY_SET" + | I_EQ -> + "EQ" + | I_EXEC -> + "EXEC" + | I_APPLY -> + "APPLY" + | I_FAILWITH -> + "FAILWITH" + | I_GE -> + "GE" + | I_GET -> + "GET" + | I_GT -> + "GT" + | I_HASH_KEY -> + "HASH_KEY" + | I_IF -> + "IF" + | I_IF_CONS -> + "IF_CONS" + | I_IF_LEFT -> + "IF_LEFT" + | I_IF_NONE -> + "IF_NONE" + | I_INT -> + "INT" + | I_LAMBDA -> + "LAMBDA" + | I_LE -> + "LE" + | I_LEFT -> + "LEFT" + | I_LOOP -> + "LOOP" + | I_LSL -> + "LSL" + | I_LSR -> + "LSR" + | I_LT -> + "LT" + | I_MAP -> + "MAP" + | I_MEM -> + "MEM" + | I_MUL -> + "MUL" + | I_NEG -> + "NEG" + | I_NEQ -> + "NEQ" + | I_NIL -> + "NIL" + | I_NONE -> + "NONE" + | I_NOT -> + "NOT" + | I_NOW -> + "NOW" + | I_OR -> + "OR" + | I_PAIR -> + "PAIR" + | I_PUSH -> + "PUSH" + | I_RIGHT -> + "RIGHT" + | I_SIZE -> + "SIZE" + | I_SOME -> + "SOME" + | I_SOURCE -> + "SOURCE" + | I_SENDER -> + "SENDER" + | I_SELF -> + "SELF" + | I_SLICE -> + "SLICE" + | I_STEPS_TO_QUOTA -> + "STEPS_TO_QUOTA" + | I_SUB -> + "SUB" + | I_SWAP -> + "SWAP" + | I_TRANSFER_TOKENS -> + "TRANSFER_TOKENS" + | I_SET_DELEGATE -> + "SET_DELEGATE" + | I_UNIT -> + "UNIT" + | I_UPDATE -> + "UPDATE" + | I_XOR -> + "XOR" + | I_ITER -> + "ITER" + | I_LOOP_LEFT -> + "LOOP_LEFT" + | I_ADDRESS -> + "ADDRESS" + | I_CONTRACT -> + "CONTRACT" + | I_ISNAT -> + "ISNAT" + | I_CAST -> + "CAST" + | I_RENAME -> + "RENAME" + | I_DIG -> + "DIG" + | I_DUG -> + "DUG" + | T_bool -> + "bool" + | T_contract -> + "contract" + | T_int -> + "int" + | T_key -> + "key" + | T_key_hash -> + "key_hash" + | T_lambda -> + "lambda" + | T_list -> + "list" + | T_map -> + "map" + | T_big_map -> + "big_map" + | T_nat -> + "nat" + | T_option -> + "option" + | T_or -> + "or" + | T_pair -> + "pair" + | T_set -> + "set" + | T_signature -> + "signature" + | T_string -> + "string" + | T_bytes -> + "bytes" + | T_mutez -> + "mutez" + | T_timestamp -> + "timestamp" + | T_unit -> + "unit" + | T_operation -> + "operation" + | T_address -> + "address" + | T_chain_id -> + "chain_id" let prim_of_string = function - | "parameter" -> ok K_parameter - | "storage" -> ok K_storage - | "code" -> ok K_code - | "False" -> ok D_False - | "Elt" -> ok D_Elt - | "Left" -> ok D_Left - | "None" -> ok D_None - | "Pair" -> ok D_Pair - | "Right" -> ok D_Right - | "Some" -> ok D_Some - | "True" -> ok D_True - | "Unit" -> ok D_Unit - | "PACK" -> ok I_PACK - | "UNPACK" -> ok I_UNPACK - | "BLAKE2B" -> ok I_BLAKE2B - | "SHA256" -> ok I_SHA256 - | "SHA512" -> ok I_SHA512 - | "ABS" -> ok I_ABS - | "ADD" -> ok I_ADD - | "AMOUNT" -> ok I_AMOUNT - | "AND" -> ok I_AND - | "BALANCE" -> ok I_BALANCE - | "CAR" -> ok I_CAR - | "CDR" -> ok I_CDR - | "CHAIN_ID" -> ok I_CHAIN_ID - | "CHECK_SIGNATURE" -> ok I_CHECK_SIGNATURE - | "COMPARE" -> ok I_COMPARE - | "CONCAT" -> ok I_CONCAT - | "CONS" -> ok I_CONS - | "CREATE_ACCOUNT" -> ok I_CREATE_ACCOUNT - | "CREATE_CONTRACT" -> ok I_CREATE_CONTRACT - | "IMPLICIT_ACCOUNT" -> ok I_IMPLICIT_ACCOUNT - | "DIP" -> ok I_DIP - | "DROP" -> ok I_DROP - | "DUP" -> ok I_DUP - | "EDIV" -> ok I_EDIV - | "EMPTY_BIG_MAP" -> ok I_EMPTY_BIG_MAP - | "EMPTY_MAP" -> ok I_EMPTY_MAP - | "EMPTY_SET" -> ok I_EMPTY_SET - | "EQ" -> ok I_EQ - | "EXEC" -> ok I_EXEC - | "APPLY" -> ok I_APPLY - | "FAILWITH" -> ok I_FAILWITH - | "GE" -> ok I_GE - | "GET" -> ok I_GET - | "GT" -> ok I_GT - | "HASH_KEY" -> ok I_HASH_KEY - | "IF" -> ok I_IF - | "IF_CONS" -> ok I_IF_CONS - | "IF_LEFT" -> ok I_IF_LEFT - | "IF_NONE" -> ok I_IF_NONE - | "INT" -> ok I_INT - | "LAMBDA" -> ok I_LAMBDA - | "LE" -> ok I_LE - | "LEFT" -> ok I_LEFT - | "LOOP" -> ok I_LOOP - | "LSL" -> ok I_LSL - | "LSR" -> ok I_LSR - | "LT" -> ok I_LT - | "MAP" -> ok I_MAP - | "MEM" -> ok I_MEM - | "MUL" -> ok I_MUL - | "NEG" -> ok I_NEG - | "NEQ" -> ok I_NEQ - | "NIL" -> ok I_NIL - | "NONE" -> ok I_NONE - | "NOT" -> ok I_NOT - | "NOW" -> ok I_NOW - | "OR" -> ok I_OR - | "PAIR" -> ok I_PAIR - | "PUSH" -> ok I_PUSH - | "RIGHT" -> ok I_RIGHT - | "SIZE" -> ok I_SIZE - | "SOME" -> ok I_SOME - | "SOURCE" -> ok I_SOURCE - | "SENDER" -> ok I_SENDER - | "SELF" -> ok I_SELF - | "SLICE" -> ok I_SLICE - | "STEPS_TO_QUOTA" -> ok I_STEPS_TO_QUOTA - | "SUB" -> ok I_SUB - | "SWAP" -> ok I_SWAP - | "TRANSFER_TOKENS" -> ok I_TRANSFER_TOKENS - | "SET_DELEGATE" -> ok I_SET_DELEGATE - | "UNIT" -> ok I_UNIT - | "UPDATE" -> ok I_UPDATE - | "XOR" -> ok I_XOR - | "ITER" -> ok I_ITER - | "LOOP_LEFT" -> ok I_LOOP_LEFT - | "ADDRESS" -> ok I_ADDRESS - | "CONTRACT" -> ok I_CONTRACT - | "ISNAT" -> ok I_ISNAT - | "CAST" -> ok I_CAST - | "RENAME" -> ok I_RENAME - | "DIG" -> ok I_DIG - | "DUG" -> ok I_DUG - | "bool" -> ok T_bool - | "contract" -> ok T_contract - | "int" -> ok T_int - | "key" -> ok T_key - | "key_hash" -> ok T_key_hash - | "lambda" -> ok T_lambda - | "list" -> ok T_list - | "map" -> ok T_map - | "big_map" -> ok T_big_map - | "nat" -> ok T_nat - | "option" -> ok T_option - | "or" -> ok T_or - | "pair" -> ok T_pair - | "set" -> ok T_set - | "signature" -> ok T_signature - | "string" -> ok T_string - | "bytes" -> ok T_bytes - | "mutez" -> ok T_mutez - | "timestamp" -> ok T_timestamp - | "unit" -> ok T_unit - | "operation" -> ok T_operation - | "address" -> ok T_address - | "chain_id" -> ok T_chain_id + | "parameter" -> + ok K_parameter + | "storage" -> + ok K_storage + | "code" -> + ok K_code + | "False" -> + ok D_False + | "Elt" -> + ok D_Elt + | "Left" -> + ok D_Left + | "None" -> + ok D_None + | "Pair" -> + ok D_Pair + | "Right" -> + ok D_Right + | "Some" -> + ok D_Some + | "True" -> + ok D_True + | "Unit" -> + ok D_Unit + | "PACK" -> + ok I_PACK + | "UNPACK" -> + ok I_UNPACK + | "BLAKE2B" -> + ok I_BLAKE2B + | "SHA256" -> + ok I_SHA256 + | "SHA512" -> + ok I_SHA512 + | "ABS" -> + ok I_ABS + | "ADD" -> + ok I_ADD + | "AMOUNT" -> + ok I_AMOUNT + | "AND" -> + ok I_AND + | "BALANCE" -> + ok I_BALANCE + | "CAR" -> + ok I_CAR + | "CDR" -> + ok I_CDR + | "CHAIN_ID" -> + ok I_CHAIN_ID + | "CHECK_SIGNATURE" -> + ok I_CHECK_SIGNATURE + | "COMPARE" -> + ok I_COMPARE + | "CONCAT" -> + ok I_CONCAT + | "CONS" -> + ok I_CONS + | "CREATE_ACCOUNT" -> + ok I_CREATE_ACCOUNT + | "CREATE_CONTRACT" -> + ok I_CREATE_CONTRACT + | "IMPLICIT_ACCOUNT" -> + ok I_IMPLICIT_ACCOUNT + | "DIP" -> + ok I_DIP + | "DROP" -> + ok I_DROP + | "DUP" -> + ok I_DUP + | "EDIV" -> + ok I_EDIV + | "EMPTY_BIG_MAP" -> + ok I_EMPTY_BIG_MAP + | "EMPTY_MAP" -> + ok I_EMPTY_MAP + | "EMPTY_SET" -> + ok I_EMPTY_SET + | "EQ" -> + ok I_EQ + | "EXEC" -> + ok I_EXEC + | "APPLY" -> + ok I_APPLY + | "FAILWITH" -> + ok I_FAILWITH + | "GE" -> + ok I_GE + | "GET" -> + ok I_GET + | "GT" -> + ok I_GT + | "HASH_KEY" -> + ok I_HASH_KEY + | "IF" -> + ok I_IF + | "IF_CONS" -> + ok I_IF_CONS + | "IF_LEFT" -> + ok I_IF_LEFT + | "IF_NONE" -> + ok I_IF_NONE + | "INT" -> + ok I_INT + | "LAMBDA" -> + ok I_LAMBDA + | "LE" -> + ok I_LE + | "LEFT" -> + ok I_LEFT + | "LOOP" -> + ok I_LOOP + | "LSL" -> + ok I_LSL + | "LSR" -> + ok I_LSR + | "LT" -> + ok I_LT + | "MAP" -> + ok I_MAP + | "MEM" -> + ok I_MEM + | "MUL" -> + ok I_MUL + | "NEG" -> + ok I_NEG + | "NEQ" -> + ok I_NEQ + | "NIL" -> + ok I_NIL + | "NONE" -> + ok I_NONE + | "NOT" -> + ok I_NOT + | "NOW" -> + ok I_NOW + | "OR" -> + ok I_OR + | "PAIR" -> + ok I_PAIR + | "PUSH" -> + ok I_PUSH + | "RIGHT" -> + ok I_RIGHT + | "SIZE" -> + ok I_SIZE + | "SOME" -> + ok I_SOME + | "SOURCE" -> + ok I_SOURCE + | "SENDER" -> + ok I_SENDER + | "SELF" -> + ok I_SELF + | "SLICE" -> + ok I_SLICE + | "STEPS_TO_QUOTA" -> + ok I_STEPS_TO_QUOTA + | "SUB" -> + ok I_SUB + | "SWAP" -> + ok I_SWAP + | "TRANSFER_TOKENS" -> + ok I_TRANSFER_TOKENS + | "SET_DELEGATE" -> + ok I_SET_DELEGATE + | "UNIT" -> + ok I_UNIT + | "UPDATE" -> + ok I_UPDATE + | "XOR" -> + ok I_XOR + | "ITER" -> + ok I_ITER + | "LOOP_LEFT" -> + ok I_LOOP_LEFT + | "ADDRESS" -> + ok I_ADDRESS + | "CONTRACT" -> + ok I_CONTRACT + | "ISNAT" -> + ok I_ISNAT + | "CAST" -> + ok I_CAST + | "RENAME" -> + ok I_RENAME + | "DIG" -> + ok I_DIG + | "DUG" -> + ok I_DUG + | "bool" -> + ok T_bool + | "contract" -> + ok T_contract + | "int" -> + ok T_int + | "key" -> + ok T_key + | "key_hash" -> + ok T_key_hash + | "lambda" -> + ok T_lambda + | "list" -> + ok T_list + | "map" -> + ok T_map + | "big_map" -> + ok T_big_map + | "nat" -> + ok T_nat + | "option" -> + ok T_option + | "or" -> + ok T_or + | "pair" -> + ok T_pair + | "set" -> + ok T_set + | "signature" -> + ok T_signature + | "string" -> + ok T_string + | "bytes" -> + ok T_bytes + | "mutez" -> + ok T_mutez + | "timestamp" -> + ok T_timestamp + | "unit" -> + ok T_unit + | "operation" -> + ok T_operation + | "address" -> + ok T_address + | "chain_id" -> + ok T_chain_id | n -> - if valid_case n then - error (Unknown_primitive_name n) - else - error (Invalid_case n) + if valid_case n then error (Unknown_primitive_name n) + else error (Invalid_case n) let prims_of_strings expr = let rec convert = function - | Int _ | String _ | Bytes _ as expr -> ok expr + | (Int _ | String _ | Bytes _) as expr -> + ok expr | Prim (loc, prim, args, annot) -> Error_monad.record_trace (Invalid_primitive_name (expr, loc)) - (prim_of_string prim) >>? fun prim -> + (prim_of_string prim) + >>? fun prim -> List.fold_left (fun acc arg -> - acc >>? fun args -> - convert arg >>? fun arg -> - ok (arg :: args)) - (ok []) args >>? fun args -> - ok (Prim (0, prim, List.rev args, annot)) + acc >>? fun args -> convert arg >>? fun arg -> ok (arg :: args)) + (ok []) + args + >>? fun args -> ok (Prim (0, prim, List.rev args, annot)) | Seq (_, args) -> List.fold_left (fun acc arg -> - acc >>? fun args -> - convert arg >>? fun arg -> - ok (arg :: args)) - (ok []) args >>? fun args -> - ok (Seq (0, List.rev args)) in - convert (root expr) >>? fun expr -> - ok (strip_locations expr) + acc >>? fun args -> convert arg >>? fun arg -> ok (arg :: args)) + (ok []) + args + >>? fun args -> ok (Seq (0, List.rev args)) + in + convert (root expr) >>? fun expr -> ok (strip_locations expr) let strings_of_prims expr = let rec convert = function - | Int _ | String _ | Bytes _ as expr -> expr + | (Int _ | String _ | Bytes _) as expr -> + expr | Prim (_, prim, args, annot) -> let prim = string_of_prim prim in let args = List.map convert args in Prim (0, prim, args, annot) | Seq (_, args) -> let args = List.map convert args in - Seq (0, args) in + Seq (0, args) + in strip_locations (convert (root expr)) let prim_encoding = let open Data_encoding in - def "michelson.v1.primitives" @@ - string_enum [ - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("parameter", K_parameter) ; - ("storage", K_storage) ; - ("code", K_code) ; - ("False", D_False) ; - ("Elt", D_Elt) ; - ("Left", D_Left) ; - ("None", D_None) ; - ("Pair", D_Pair) ; - ("Right", D_Right) ; - ("Some", D_Some) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("True", D_True) ; - ("Unit", D_Unit) ; - ("PACK", I_PACK) ; - ("UNPACK", I_UNPACK) ; - ("BLAKE2B", I_BLAKE2B) ; - ("SHA256", I_SHA256) ; - ("SHA512", I_SHA512) ; - ("ABS", I_ABS) ; - ("ADD", I_ADD) ; - ("AMOUNT", I_AMOUNT) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("AND", I_AND) ; - ("BALANCE", I_BALANCE) ; - ("CAR", I_CAR) ; - ("CDR", I_CDR) ; - ("CHECK_SIGNATURE", I_CHECK_SIGNATURE) ; - ("COMPARE", I_COMPARE) ; - ("CONCAT", I_CONCAT) ; - ("CONS", I_CONS) ; - ("CREATE_ACCOUNT", I_CREATE_ACCOUNT) ; - ("CREATE_CONTRACT", I_CREATE_CONTRACT) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("IMPLICIT_ACCOUNT", I_IMPLICIT_ACCOUNT) ; - ("DIP", I_DIP) ; - ("DROP", I_DROP) ; - ("DUP", I_DUP) ; - ("EDIV", I_EDIV) ; - ("EMPTY_MAP", I_EMPTY_MAP) ; - ("EMPTY_SET", I_EMPTY_SET) ; - ("EQ", I_EQ) ; - ("EXEC", I_EXEC) ; - ("FAILWITH", I_FAILWITH) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("GE", I_GE) ; - ("GET", I_GET) ; - ("GT", I_GT) ; - ("HASH_KEY", I_HASH_KEY) ; - ("IF", I_IF) ; - ("IF_CONS", I_IF_CONS) ; - ("IF_LEFT", I_IF_LEFT) ; - ("IF_NONE", I_IF_NONE) ; - ("INT", I_INT) ; - ("LAMBDA", I_LAMBDA) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("LE", I_LE) ; - ("LEFT", I_LEFT) ; - ("LOOP", I_LOOP) ; - ("LSL", I_LSL) ; - ("LSR", I_LSR) ; - ("LT", I_LT) ; - ("MAP", I_MAP) ; - ("MEM", I_MEM) ; - ("MUL", I_MUL) ; - ("NEG", I_NEG) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("NEQ", I_NEQ) ; - ("NIL", I_NIL) ; - ("NONE", I_NONE) ; - ("NOT", I_NOT) ; - ("NOW", I_NOW) ; - ("OR", I_OR) ; - ("PAIR", I_PAIR) ; - ("PUSH", I_PUSH) ; - ("RIGHT", I_RIGHT) ; - ("SIZE", I_SIZE) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("SOME", I_SOME) ; - ("SOURCE", I_SOURCE) ; - ("SENDER", I_SENDER) ; - ("SELF", I_SELF) ; - ("STEPS_TO_QUOTA", I_STEPS_TO_QUOTA) ; - ("SUB", I_SUB) ; - ("SWAP", I_SWAP) ; - ("TRANSFER_TOKENS", I_TRANSFER_TOKENS) ; - ("SET_DELEGATE", I_SET_DELEGATE) ; - ("UNIT", I_UNIT) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("UPDATE", I_UPDATE) ; - ("XOR", I_XOR) ; - ("ITER", I_ITER) ; - ("LOOP_LEFT", I_LOOP_LEFT) ; - ("ADDRESS", I_ADDRESS) ; - ("CONTRACT", I_CONTRACT) ; - ("ISNAT", I_ISNAT) ; - ("CAST", I_CAST) ; - ("RENAME", I_RENAME) ; - ("bool", T_bool) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("contract", T_contract) ; - ("int", T_int) ; - ("key", T_key) ; - ("key_hash", T_key_hash) ; - ("lambda", T_lambda) ; - ("list", T_list) ; - ("map", T_map) ; - ("big_map", T_big_map) ; - ("nat", T_nat) ; - ("option", T_option) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("or", T_or) ; - ("pair", T_pair) ; - ("set", T_set) ; - ("signature", T_signature) ; - ("string", T_string) ; - ("bytes", T_bytes) ; - ("mutez", T_mutez) ; - ("timestamp", T_timestamp) ; - ("unit", T_unit) ; - ("operation", T_operation) ; - (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) - ("address", T_address) ; - (* Alpha_002 addition *) - ("SLICE", I_SLICE) ; - (* Alpha_005 addition *) - ("DIG", I_DIG) ; - ("DUG", I_DUG) ; - ("EMPTY_BIG_MAP", I_EMPTY_BIG_MAP) ; - ("APPLY", I_APPLY) ; - ("chain_id", T_chain_id) ; - ("CHAIN_ID", I_CHAIN_ID) - (* New instructions must be added here, for backward compatibility of the encoding. *) - ] + def "michelson.v1.primitives" + @@ string_enum + [ (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("parameter", K_parameter); + ("storage", K_storage); + ("code", K_code); + ("False", D_False); + ("Elt", D_Elt); + ("Left", D_Left); + ("None", D_None); + ("Pair", D_Pair); + ("Right", D_Right); + ("Some", D_Some); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("True", D_True); + ("Unit", D_Unit); + ("PACK", I_PACK); + ("UNPACK", I_UNPACK); + ("BLAKE2B", I_BLAKE2B); + ("SHA256", I_SHA256); + ("SHA512", I_SHA512); + ("ABS", I_ABS); + ("ADD", I_ADD); + ("AMOUNT", I_AMOUNT); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("AND", I_AND); + ("BALANCE", I_BALANCE); + ("CAR", I_CAR); + ("CDR", I_CDR); + ("CHECK_SIGNATURE", I_CHECK_SIGNATURE); + ("COMPARE", I_COMPARE); + ("CONCAT", I_CONCAT); + ("CONS", I_CONS); + ("CREATE_ACCOUNT", I_CREATE_ACCOUNT); + ("CREATE_CONTRACT", I_CREATE_CONTRACT); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("IMPLICIT_ACCOUNT", I_IMPLICIT_ACCOUNT); + ("DIP", I_DIP); + ("DROP", I_DROP); + ("DUP", I_DUP); + ("EDIV", I_EDIV); + ("EMPTY_MAP", I_EMPTY_MAP); + ("EMPTY_SET", I_EMPTY_SET); + ("EQ", I_EQ); + ("EXEC", I_EXEC); + ("FAILWITH", I_FAILWITH); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("GE", I_GE); + ("GET", I_GET); + ("GT", I_GT); + ("HASH_KEY", I_HASH_KEY); + ("IF", I_IF); + ("IF_CONS", I_IF_CONS); + ("IF_LEFT", I_IF_LEFT); + ("IF_NONE", I_IF_NONE); + ("INT", I_INT); + ("LAMBDA", I_LAMBDA); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("LE", I_LE); + ("LEFT", I_LEFT); + ("LOOP", I_LOOP); + ("LSL", I_LSL); + ("LSR", I_LSR); + ("LT", I_LT); + ("MAP", I_MAP); + ("MEM", I_MEM); + ("MUL", I_MUL); + ("NEG", I_NEG); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("NEQ", I_NEQ); + ("NIL", I_NIL); + ("NONE", I_NONE); + ("NOT", I_NOT); + ("NOW", I_NOW); + ("OR", I_OR); + ("PAIR", I_PAIR); + ("PUSH", I_PUSH); + ("RIGHT", I_RIGHT); + ("SIZE", I_SIZE); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("SOME", I_SOME); + ("SOURCE", I_SOURCE); + ("SENDER", I_SENDER); + ("SELF", I_SELF); + ("STEPS_TO_QUOTA", I_STEPS_TO_QUOTA); + ("SUB", I_SUB); + ("SWAP", I_SWAP); + ("TRANSFER_TOKENS", I_TRANSFER_TOKENS); + ("SET_DELEGATE", I_SET_DELEGATE); + ("UNIT", I_UNIT); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("UPDATE", I_UPDATE); + ("XOR", I_XOR); + ("ITER", I_ITER); + ("LOOP_LEFT", I_LOOP_LEFT); + ("ADDRESS", I_ADDRESS); + ("CONTRACT", I_CONTRACT); + ("ISNAT", I_ISNAT); + ("CAST", I_CAST); + ("RENAME", I_RENAME); + ("bool", T_bool); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("contract", T_contract); + ("int", T_int); + ("key", T_key); + ("key_hash", T_key_hash); + ("lambda", T_lambda); + ("list", T_list); + ("map", T_map); + ("big_map", T_big_map); + ("nat", T_nat); + ("option", T_option); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("or", T_or); + ("pair", T_pair); + ("set", T_set); + ("signature", T_signature); + ("string", T_string); + ("bytes", T_bytes); + ("mutez", T_mutez); + ("timestamp", T_timestamp); + ("unit", T_unit); + ("operation", T_operation); + (* /!\ NEW INSTRUCTIONS MUST BE ADDED AT THE END OF THE STRING_ENUM, FOR BACKWARD COMPATIBILITY OF THE ENCODING. *) + ("address", T_address); + (* Alpha_002 addition *) + ("SLICE", I_SLICE); + (* Alpha_005 addition *) + ("DIG", I_DIG); + ("DUG", I_DUG); + ("EMPTY_BIG_MAP", I_EMPTY_BIG_MAP); + ("APPLY", I_APPLY); + ("chain_id", T_chain_id); + ("CHAIN_ID", I_CHAIN_ID) + (* New instructions must be added here, for backward compatibility of the encoding. *) + ] let () = register_error_kind `Permanent ~id:"michelson_v1.unknown_primitive_name" - ~title: "Unknown primitive name" - ~description: - "In a script or data expression, a primitive was unknown." + ~title:"Unknown primitive name" + ~description:"In a script or data expression, a primitive was unknown." ~pp:(fun ppf n -> Format.fprintf ppf "Unknown primitive %s." n) Data_encoding.(obj1 (req "wrong_primitive_name" string)) - (function - | Unknown_primitive_name got -> Some got - | _ -> None) - (fun got -> - Unknown_primitive_name got) ; + (function Unknown_primitive_name got -> Some got | _ -> None) + (fun got -> Unknown_primitive_name got) ; register_error_kind `Permanent ~id:"michelson_v1.invalid_primitive_name_case" - ~title: "Invalid primitive name case" + ~title:"Invalid primitive name case" ~description: - "In a script or data expression, a primitive name is \ - neither uppercase, lowercase or capitalized." + "In a script or data expression, a primitive name is neither uppercase, \ + lowercase or capitalized." ~pp:(fun ppf n -> Format.fprintf ppf "Primitive %s has invalid case." n) Data_encoding.(obj1 (req "wrong_primitive_name" string)) - (function - | Invalid_case name -> Some name - | _ -> None) - (fun name -> - Invalid_case name) ; + (function Invalid_case name -> Some name | _ -> None) + (fun name -> Invalid_case name) ; register_error_kind `Permanent ~id:"michelson_v1.invalid_primitive_name" - ~title: "Invalid primitive name" + ~title:"Invalid primitive name" ~description: - "In a script or data expression, a primitive name is \ - unknown or has a wrong case." + "In a script or data expression, a primitive name is unknown or has a \ + wrong case." ~pp:(fun ppf _ -> Format.fprintf ppf "Invalid primitive.") - Data_encoding.(obj2 - (req "expression" (Micheline.canonical_encoding ~variant:"generic" string)) - (req "location" Micheline.canonical_location_encoding)) + Data_encoding.( + obj2 + (req + "expression" + (Micheline.canonical_encoding ~variant:"generic" string)) + (req "location" Micheline.canonical_location_encoding)) (function - | Invalid_primitive_name (expr, loc) -> Some (expr, loc) - | _ -> None) - (fun (expr, loc) -> - Invalid_primitive_name (expr, loc)) + | Invalid_primitive_name (expr, loc) -> Some (expr, loc) | _ -> None) + (fun (expr, loc) -> Invalid_primitive_name (expr, loc)) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.mli b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.mli index 6a0852bf4..4fd908bf5 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/michelson_v1_primitives.mli @@ -24,8 +24,14 @@ (*****************************************************************************) type error += Unknown_primitive_name of string (* `Permanent *) + type error += Invalid_case of string (* `Permanent *) -type error += Invalid_primitive_name of string Micheline.canonical * Micheline.canonical_location (* `Permanent *) + +type error += + | Invalid_primitive_name of + string Micheline.canonical * Micheline.canonical_location + +(* `Permanent *) type prim = | K_parameter @@ -153,6 +159,7 @@ val string_of_prim : prim -> string val prim_of_string : string -> prim tzresult -val prims_of_strings : string Micheline.canonical -> prim Micheline.canonical tzresult +val prims_of_strings : + string Micheline.canonical -> prim Micheline.canonical tzresult val strings_of_prims : prim Micheline.canonical -> string Micheline.canonical diff --git a/vendors/ligo-utils/tezos-protocol-alpha/misc.ml b/vendors/ligo-utils/tezos-protocol-alpha/misc.ml index 26be1e0eb..1d8aad77a 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/misc.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/misc.ml @@ -24,61 +24,56 @@ (*****************************************************************************) type 'a lazyt = unit -> 'a -type 'a lazy_list_t = LCons of 'a * ('a lazy_list_t tzresult Lwt.t lazyt) + +type 'a lazy_list_t = LCons of 'a * 'a lazy_list_t tzresult Lwt.t lazyt + type 'a lazy_list = 'a lazy_list_t tzresult Lwt.t -let rec (-->) i j = (* [i; i+1; ...; j] *) - if Compare.Int.(i > j) - then [] - else i :: (succ i --> j) +let rec ( --> ) i j = + (* [i; i+1; ...; j] *) + if Compare.Int.(i > j) then [] else i :: (succ i --> j) -let rec (--->) i j = (* [i; i+1; ...; j] *) - if Compare.Int32.(i > j) - then [] - else i :: (Int32.succ i ---> j) +let rec ( ---> ) i j = + (* [i; i+1; ...; j] *) + if Compare.Int32.(i > j) then [] else i :: (Int32.succ i ---> j) let split delim ?(limit = max_int) path = let l = String.length path in let rec do_slashes acc limit i = - if Compare.Int.(i >= l) then - List.rev acc - else if Compare.Char.(String.get path i = delim) then - do_slashes acc limit (i + 1) - else - do_split acc limit i + if Compare.Int.(i >= l) then List.rev acc + else if Compare.Char.(path.[i] = delim) then do_slashes acc limit (i + 1) + else do_split acc limit i and do_split acc limit i = if Compare.Int.(limit <= 0) then - if Compare.Int.(i = l) then - List.rev acc - else - List.rev (String.sub path i (l - i) :: acc) - else - do_component acc (pred limit) i i + if Compare.Int.(i = l) then List.rev acc + else List.rev (String.sub path i (l - i) :: acc) + else do_component acc (pred limit) i i and do_component acc limit i j = if Compare.Int.(j >= l) then - if Compare.Int.(i = j) then - List.rev acc - else - List.rev (String.sub path i (j - i) :: acc) - else if Compare.Char.(String.get path j = delim) then + if Compare.Int.(i = j) then List.rev acc + else List.rev (String.sub path i (j - i) :: acc) + else if Compare.Char.(path.[j] = delim) then do_slashes (String.sub path i (j - i) :: acc) limit j - else - do_component acc limit i (j + 1) in - if Compare.Int.(limit > 0) then - do_slashes [] limit 0 - else - [ path ] + else do_component acc limit i (j + 1) + in + if Compare.Int.(limit > 0) then do_slashes [] limit 0 else [path] let pp_print_paragraph ppf description = - Format.fprintf ppf "@[%a@]" + Format.fprintf + ppf + "@[%a@]" Format.(pp_print_list ~pp_sep:pp_print_space pp_print_string) (split ' ' description) let take n l = let rec loop acc n = function - | xs when Compare.Int.(n <= 0) -> Some (List.rev acc, xs) - | [] -> None - | x :: xs -> loop (x :: acc) (n-1) xs in + | xs when Compare.Int.(n <= 0) -> + Some (List.rev acc, xs) + | [] -> + None + | x :: xs -> + loop (x :: acc) (n - 1) xs + in loop [] n l let remove_prefix ~prefix s = @@ -86,10 +81,12 @@ let remove_prefix ~prefix s = let n = String.length s in if Compare.Int.(n >= x) && Compare.String.(String.sub s 0 x = prefix) then Some (String.sub s x (n - x)) - else - None + else None let rec remove_elem_from_list nb = function - | [] -> [] - | l when Compare.Int.(nb <= 0) -> l - | _ :: tl -> remove_elem_from_list (nb - 1) tl + | [] -> + [] + | l when Compare.Int.(nb <= 0) -> + l + | _ :: tl -> + remove_elem_from_list (nb - 1) tl diff --git a/vendors/ligo-utils/tezos-protocol-alpha/misc.mli b/vendors/ligo-utils/tezos-protocol-alpha/misc.mli index 407d7480b..fb4e07dae 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/misc.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/misc.mli @@ -26,19 +26,22 @@ (** {2 Helper functions} *) type 'a lazyt = unit -> 'a -type 'a lazy_list_t = LCons of 'a * ('a lazy_list_t tzresult Lwt.t lazyt) + +type 'a lazy_list_t = LCons of 'a * 'a lazy_list_t tzresult Lwt.t lazyt + type 'a lazy_list = 'a lazy_list_t tzresult Lwt.t (** Include bounds *) -val (-->) : int -> int -> int list -val (--->) : Int32.t -> Int32.t -> Int32.t list +val ( --> ) : int -> int -> int list + +val ( ---> ) : Int32.t -> Int32.t -> Int32.t list val pp_print_paragraph : Format.formatter -> string -> unit -val take: int -> 'a list -> ('a list * 'a list) option +val take : int -> 'a list -> ('a list * 'a list) option -(** Some (input with [prefix] removed), if string has [prefix], else [None] **) -val remove_prefix: prefix:string -> string -> string option +(** Some (input with [prefix] removed), if string has [prefix], else [None] *) +val remove_prefix : prefix:string -> string -> string option (** [remove nb list] remove the first [nb] elements from the list [list]. *) -val remove_elem_from_list: int -> 'a list -> 'a list +val remove_elem_from_list : int -> 'a list -> 'a list diff --git a/vendors/ligo-utils/tezos-protocol-alpha/nonce_hash.ml b/vendors/ligo-utils/tezos-protocol-alpha/nonce_hash.ml index 931011a92..a79656ea8 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/nonce_hash.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/nonce_hash.ml @@ -26,12 +26,16 @@ (* 32 *) let nonce_hash = "\069\220\169" (* nce(53) *) -include Blake2B.Make(Base58)(struct - let name = "cycle_nonce" - let title = "A nonce hash" - let b58check_prefix = nonce_hash - let size = None - end) +include Blake2B.Make + (Base58) + (struct + let name = "cycle_nonce" -let () = - Base58.check_encoded_prefix b58check_encoding "nce" 53 + let title = "A nonce hash" + + let b58check_prefix = nonce_hash + + let size = None + end) + +let () = Base58.check_encoded_prefix b58check_encoding "nce" 53 diff --git a/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.ml index 2a43e2d9c..14ce2e737 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.ml @@ -24,7 +24,9 @@ (*****************************************************************************) type t = Seed_repr.nonce + type nonce = t + let encoding = Seed_repr.nonce_encoding type error += @@ -39,8 +41,8 @@ let () = ~id:"nonce.too_late_revelation" ~title:"Too late nonce revelation" ~description:"Nonce revelation happens too late" - ~pp: (fun ppf () -> - Format.fprintf ppf "This nonce cannot be revealed anymore.") + ~pp:(fun ppf () -> + Format.fprintf ppf "This nonce cannot be revealed anymore.") Data_encoding.unit (function Too_late_revelation -> Some () | _ -> None) (fun () -> Too_late_revelation) ; @@ -49,8 +51,8 @@ let () = ~id:"nonce.too_early_revelation" ~title:"Too early nonce revelation" ~description:"Nonce revelation happens before cycle end" - ~pp: (fun ppf () -> - Format.fprintf ppf "This nonce should not yet be revealed") + ~pp:(fun ppf () -> + Format.fprintf ppf "This nonce should not yet be revealed") Data_encoding.unit (function Too_early_revelation -> Some () | _ -> None) (fun () -> Too_early_revelation) ; @@ -59,8 +61,7 @@ let () = ~id:"nonce.previously_revealed" ~title:"Previously revealed nonce" ~description:"Duplicated revelation for a nonce." - ~pp: (fun ppf () -> - Format.fprintf ppf "This nonce was previously revealed") + ~pp:(fun ppf () -> Format.fprintf ppf "This nonce was previously revealed") Data_encoding.unit (function Previously_revealed_nonce -> Some () | _ -> None) (fun () -> Previously_revealed_nonce) ; @@ -68,9 +69,13 @@ let () = `Branch ~id:"nonce.unexpected" ~title:"Unexpected nonce" - ~description:"The provided nonce is inconsistent with the committed nonce hash." - ~pp: (fun ppf () -> - Format.fprintf ppf "This nonce revelation is invalid (inconsistent with the committed hash)") + ~description: + "The provided nonce is inconsistent with the committed nonce hash." + ~pp:(fun ppf () -> + Format.fprintf + ppf + "This nonce revelation is invalid (inconsistent with the committed \ + hash)") Data_encoding.unit (function Unexpected_nonce -> Some () | _ -> None) (fun () -> Unexpected_nonce) @@ -80,34 +85,40 @@ let () = let get_unrevealed ctxt level = let cur_level = Level_storage.current ctxt in match Cycle_repr.pred cur_level.cycle with - | None -> fail Too_early_revelation (* no revelations during cycle 0 *) - | Some revealed_cycle -> + | None -> + fail Too_early_revelation (* no revelations during cycle 0 *) + | Some revealed_cycle -> ( if Cycle_repr.(revealed_cycle < level.Level_repr.cycle) then fail Too_early_revelation else if Cycle_repr.(level.Level_repr.cycle < revealed_cycle) then fail Too_late_revelation else - Storage.Seed.Nonce.get ctxt level >>=? function - | Revealed _ -> fail Previously_revealed_nonce - | Unrevealed status -> return status + Storage.Seed.Nonce.get ctxt level + >>=? function + | Revealed _ -> + fail Previously_revealed_nonce + | Unrevealed status -> + return status ) let record_hash ctxt unrevealed = let level = Level_storage.current ctxt in Storage.Seed.Nonce.init ctxt level (Unrevealed unrevealed) let reveal ctxt level nonce = - get_unrevealed ctxt level >>=? fun unrevealed -> + get_unrevealed ctxt level + >>=? fun unrevealed -> fail_unless (Seed_repr.check_hash nonce unrevealed.nonce_hash) - Unexpected_nonce >>=? fun () -> - Storage.Seed.Nonce.set ctxt level (Revealed nonce) >>=? fun ctxt -> - return ctxt + Unexpected_nonce + >>=? fun () -> + Storage.Seed.Nonce.set ctxt level (Revealed nonce) + >>=? fun ctxt -> return ctxt type unrevealed = Storage.Seed.unrevealed_nonce = { - nonce_hash: Nonce_hash.t ; - delegate: Signature.Public_key_hash.t ; - rewards: Tez_repr.t ; - fees: Tez_repr.t ; + nonce_hash : Nonce_hash.t; + delegate : Signature.Public_key_hash.t; + rewards : Tez_repr.t; + fees : Tez_repr.t; } type status = Storage.Seed.nonce_status = @@ -117,5 +128,7 @@ type status = Storage.Seed.nonce_status = let get = Storage.Seed.Nonce.get let of_bytes = Seed_repr.make_nonce + let hash = Seed_repr.hash + let check_hash = Seed_repr.check_hash diff --git a/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.mli index 026f9a4e2..da64fd676 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/nonce_storage.mli @@ -30,28 +30,29 @@ type error += | Unexpected_nonce type t = Seed_repr.nonce + type nonce = t -val encoding: nonce Data_encoding.t + +val encoding : nonce Data_encoding.t type unrevealed = Storage.Seed.unrevealed_nonce = { - nonce_hash: Nonce_hash.t ; - delegate: Signature.Public_key_hash.t ; - rewards: Tez_repr.t ; - fees: Tez_repr.t ; + nonce_hash : Nonce_hash.t; + delegate : Signature.Public_key_hash.t; + rewards : Tez_repr.t; + fees : Tez_repr.t; } -type status = - | Unrevealed of unrevealed - | Revealed of Seed_repr.nonce +type status = Unrevealed of unrevealed | Revealed of Seed_repr.nonce -val get: Raw_context.t -> Level_repr.t -> status tzresult Lwt.t +val get : Raw_context.t -> Level_repr.t -> status tzresult Lwt.t -val record_hash: - Raw_context.t -> unrevealed -> Raw_context.t tzresult Lwt.t +val record_hash : Raw_context.t -> unrevealed -> Raw_context.t tzresult Lwt.t -val reveal: +val reveal : Raw_context.t -> Level_repr.t -> nonce -> Raw_context.t tzresult Lwt.t -val of_bytes: MBytes.t -> nonce tzresult -val hash: nonce -> Nonce_hash.t -val check_hash: nonce -> Nonce_hash.t -> bool +val of_bytes : MBytes.t -> nonce tzresult + +val hash : nonce -> Nonce_hash.t + +val check_hash : nonce -> Nonce_hash.t -> bool diff --git a/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.ml index f07ef5c55..b9ed9e4b1 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.ml @@ -27,16 +27,27 @@ module Kind = struct type seed_nonce_revelation = Seed_nonce_revelation_kind + type double_endorsement_evidence = Double_endorsement_evidence_kind + type double_baking_evidence = Double_baking_evidence_kind + type activate_account = Activate_account_kind + type endorsement = Endorsement_kind + type proposals = Proposals_kind + type ballot = Ballot_kind + type reveal = Reveal_kind + type transaction = Transaction_kind + type origination = Origination_kind + type delegation = Delegation_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -44,105 +55,114 @@ module Kind = struct | Delegation_manager_kind : delegation manager end -type raw = Operation.t = { - shell: Operation.shell_header ; - proto: MBytes.t ; -} +type raw = Operation.t = {shell : Operation.shell_header; proto : MBytes.t} let raw_encoding = Operation.encoding type 'kind operation = { - shell: Operation.shell_header ; - protocol_data: 'kind protocol_data ; + shell : Operation.shell_header; + protocol_data : 'kind protocol_data; } and 'kind protocol_data = { - contents: 'kind contents_list ; - signature: Signature.t option ; + contents : 'kind contents_list; + signature : Signature.t option; } and _ contents_list = | Single : 'kind contents -> 'kind contents_list - | Cons : 'kind Kind.manager contents * 'rest Kind.manager contents_list -> - (('kind * 'rest) Kind.manager ) contents_list + | Cons : + 'kind Kind.manager contents * 'rest Kind.manager contents_list + -> ('kind * 'rest) Kind.manager contents_list and _ contents = - | Endorsement : { - level: Raw_level_repr.t ; - } -> Kind.endorsement contents + | Endorsement : {level : Raw_level_repr.t} -> Kind.endorsement contents | Seed_nonce_revelation : { - level: Raw_level_repr.t ; - nonce: Seed_repr.nonce ; - } -> Kind.seed_nonce_revelation contents + level : Raw_level_repr.t; + nonce : Seed_repr.nonce; + } + -> Kind.seed_nonce_revelation contents | Double_endorsement_evidence : { - op1: Kind.endorsement operation ; - op2: Kind.endorsement operation ; - } -> Kind.double_endorsement_evidence contents + op1 : Kind.endorsement operation; + op2 : Kind.endorsement operation; + } + -> Kind.double_endorsement_evidence contents | Double_baking_evidence : { - bh1: Block_header_repr.t ; - bh2: Block_header_repr.t ; - } -> Kind.double_baking_evidence contents + bh1 : Block_header_repr.t; + bh2 : Block_header_repr.t; + } + -> Kind.double_baking_evidence contents | Activate_account : { - id: Ed25519.Public_key_hash.t ; - activation_code: Blinded_public_key_hash.activation_code ; - } -> Kind.activate_account contents + id : Ed25519.Public_key_hash.t; + activation_code : Blinded_public_key_hash.activation_code; + } + -> Kind.activate_account contents | Proposals : { - source: Signature.Public_key_hash.t ; - period: Voting_period_repr.t ; - proposals: Protocol_hash.t list ; - } -> Kind.proposals contents + source : Signature.Public_key_hash.t; + period : Voting_period_repr.t; + proposals : Protocol_hash.t list; + } + -> Kind.proposals contents | Ballot : { - source: Signature.Public_key_hash.t ; - period: Voting_period_repr.t ; - proposal: Protocol_hash.t ; - ballot: Vote_repr.ballot ; - } -> Kind.ballot contents + source : Signature.Public_key_hash.t; + period : Voting_period_repr.t; + proposal : Protocol_hash.t; + ballot : Vote_repr.ballot; + } + -> Kind.ballot contents | Manager_operation : { - source: Signature.public_key_hash ; - fee: Tez_repr.tez ; - counter: counter ; - operation: 'kind manager_operation ; - gas_limit: Z.t; - storage_limit: Z.t; - } -> 'kind Kind.manager contents + source : Signature.public_key_hash; + fee : Tez_repr.tez; + counter : counter; + operation : 'kind manager_operation; + gas_limit : Z.t; + storage_limit : Z.t; + } + -> 'kind Kind.manager contents and _ manager_operation = | Reveal : Signature.Public_key.t -> Kind.reveal manager_operation | Transaction : { - amount: Tez_repr.tez ; - parameters: Script_repr.lazy_expr ; - entrypoint: string ; - destination: Contract_repr.contract ; - } -> Kind.transaction manager_operation + amount : Tez_repr.tez; + parameters : Script_repr.lazy_expr; + entrypoint : string; + destination : Contract_repr.contract; + } + -> Kind.transaction manager_operation | Origination : { - delegate: Signature.Public_key_hash.t option ; - script: Script_repr.t ; - credit: Tez_repr.tez ; - preorigination: Contract_repr.t option ; - } -> Kind.origination manager_operation + delegate : Signature.Public_key_hash.t option; + script : Script_repr.t; + credit : Tez_repr.tez; + preorigination : Contract_repr.t option; + } + -> Kind.origination manager_operation | Delegation : - Signature.Public_key_hash.t option -> Kind.delegation manager_operation + Signature.Public_key_hash.t option + -> Kind.delegation manager_operation and counter = Z.t let manager_kind : type kind. kind manager_operation -> kind Kind.manager = function - | Reveal _ -> Kind.Reveal_manager_kind - | Transaction _ -> Kind.Transaction_manager_kind - | Origination _ -> Kind.Origination_manager_kind - | Delegation _ -> Kind.Delegation_manager_kind + | Reveal _ -> + Kind.Reveal_manager_kind + | Transaction _ -> + Kind.Transaction_manager_kind + | Origination _ -> + Kind.Origination_manager_kind + | Delegation _ -> + Kind.Delegation_manager_kind type 'kind internal_operation = { - source: Contract_repr.contract ; - operation: 'kind manager_operation ; - nonce: int ; + source : Contract_repr.contract; + operation : 'kind manager_operation; + nonce : int; } type packed_manager_operation = | Manager : 'kind manager_operation -> packed_manager_operation -type packed_contents = - | Contents : 'kind contents -> packed_contents +type packed_contents = Contents : 'kind contents -> packed_contents type packed_contents_list = | Contents_list : 'kind contents_list -> packed_contents_list @@ -151,424 +171,437 @@ type packed_protocol_data = | Operation_data : 'kind protocol_data -> packed_protocol_data type packed_operation = { - shell: Operation.shell_header ; - protocol_data: packed_protocol_data ; + shell : Operation.shell_header; + protocol_data : packed_protocol_data; } -let pack ({ shell ; protocol_data} : _ operation) : packed_operation = { - shell ; - protocol_data = Operation_data protocol_data ; -} +let pack ({shell; protocol_data} : _ operation) : packed_operation = + {shell; protocol_data = Operation_data protocol_data} type packed_internal_operation = | Internal_operation : 'kind internal_operation -> packed_internal_operation let rec to_list = function - | Contents_list (Single o) -> [Contents o] + | Contents_list (Single o) -> + [Contents o] | Contents_list (Cons (o, os)) -> Contents o :: to_list (Contents_list os) let rec of_list = function - | [] -> assert false - | [Contents o] -> Contents_list (Single o) - | (Contents o) :: os -> - let Contents_list os = of_list os in - match o, os with - | Manager_operation _, Single (Manager_operation _) -> + | [] -> + assert false + | [Contents o] -> + Contents_list (Single o) + | Contents o :: os -> ( + let (Contents_list os) = of_list os in + match (o, os) with + | (Manager_operation _, Single (Manager_operation _)) -> Contents_list (Cons (o, os)) - | Manager_operation _, Cons _ -> + | (Manager_operation _, Cons _) -> Contents_list (Cons (o, os)) | _ -> - Pervasives.failwith "Operation list of length > 1 \ - should only contains manager operations." + Pervasives.failwith + "Operation list of length > 1 should only contains manager \ + operations." ) module Encoding = struct - open Data_encoding let case tag name args proj inj = let open Data_encoding in - case tag + case + tag ~title:(String.capitalize_ascii name) - (merge_objs - (obj1 (req "kind" (constant name))) - args) + (merge_objs (obj1 (req "kind" (constant name))) args) (fun x -> match proj x with None -> None | Some x -> Some ((), x)) (fun ((), x) -> inj x) module Manager_operations = struct - type 'kind case = - MCase : { tag: int ; - name: string ; - encoding: 'a Data_encoding.t ; - select: packed_manager_operation -> 'kind manager_operation option ; - proj: 'kind manager_operation -> 'a ; - inj: 'a -> 'kind manager_operation } -> 'kind case + | MCase : { + tag : int; + name : string; + encoding : 'a Data_encoding.t; + select : packed_manager_operation -> 'kind manager_operation option; + proj : 'kind manager_operation -> 'a; + inj : 'a -> 'kind manager_operation; + } + -> 'kind case let reveal_case = - MCase { - tag = 0 ; - name = "reveal" ; - encoding = - (obj1 - (req "public_key" Signature.Public_key.encoding)) ; - select = - (function - | Manager (Reveal _ as op) -> Some op - | _ -> None) ; - proj = - (function Reveal pkh -> pkh) ; - inj = - (fun pkh -> Reveal pkh) - } + MCase + { + tag = 0; + name = "reveal"; + encoding = obj1 (req "public_key" Signature.Public_key.encoding); + select = (function Manager (Reveal _ as op) -> Some op | _ -> None); + proj = (function Reveal pkh -> pkh); + inj = (fun pkh -> Reveal pkh); + } let entrypoint_encoding = def ~title:"entrypoint" ~description:"Named entrypoint to a Michelson smart contract" - "entrypoint" @@ + "entrypoint" + @@ let builtin_case tag name = - Data_encoding.case (Tag tag) ~title:name + Data_encoding.case + (Tag tag) + ~title:name (constant name) - (fun n -> if Compare.String.(n = name) then Some () else None) (fun () -> name) in - union [ builtin_case 0 "default" ; - builtin_case 1 "root" ; - builtin_case 2 "do" ; - builtin_case 3 "set_delegate" ; - builtin_case 4 "remove_delegate" ; - Data_encoding.case (Tag 255) ~title:"named" (Bounded.string 31) (fun s -> Some s) (fun s -> s) ] + (fun n -> if Compare.String.(n = name) then Some () else None) + (fun () -> name) + in + union + [ builtin_case 0 "default"; + builtin_case 1 "root"; + builtin_case 2 "do"; + builtin_case 3 "set_delegate"; + builtin_case 4 "remove_delegate"; + Data_encoding.case + (Tag 255) + ~title:"named" + (Bounded.string 31) + (fun s -> Some s) + (fun s -> s) ] let transaction_case = - MCase { - tag = 1 ; - name = "transaction" ; - encoding = - (obj3 - (req "amount" Tez_repr.encoding) - (req "destination" Contract_repr.encoding) - (opt "parameters" - (obj2 - (req "entrypoint" entrypoint_encoding) - (req "value" Script_repr.lazy_expr_encoding)))) ; - select = - (function - | Manager (Transaction _ as op) -> Some op - | _ -> None) ; - proj = - (function - | Transaction { amount ; destination ; parameters ; entrypoint } -> + MCase + { + tag = 1; + name = "transaction"; + encoding = + obj3 + (req "amount" Tez_repr.encoding) + (req "destination" Contract_repr.encoding) + (opt + "parameters" + (obj2 + (req "entrypoint" entrypoint_encoding) + (req "value" Script_repr.lazy_expr_encoding))); + select = + (function Manager (Transaction _ as op) -> Some op | _ -> None); + proj = + (function + | Transaction {amount; destination; parameters; entrypoint} -> let parameters = - if Script_repr.is_unit_parameter parameters && Compare.String.(entrypoint = "default") then - None - else - Some (entrypoint, parameters) in - (amount, destination, parameters)) ; - inj = - (fun (amount, destination, parameters) -> - let entrypoint, parameters = match parameters with - | None -> "default", Script_repr.unit_parameter - | Some (entrypoint, value) -> entrypoint, value in - Transaction { amount ; destination ; parameters ; entrypoint }) - } + if + Script_repr.is_unit_parameter parameters + && Compare.String.(entrypoint = "default") + then None + else Some (entrypoint, parameters) + in + (amount, destination, parameters)); + inj = + (fun (amount, destination, parameters) -> + let (entrypoint, parameters) = + match parameters with + | None -> + ("default", Script_repr.unit_parameter) + | Some (entrypoint, value) -> + (entrypoint, value) + in + Transaction {amount; destination; parameters; entrypoint}); + } let origination_case = - MCase { - tag = 2 ; - name = "origination" ; - encoding = - (obj3 - (req "balance" Tez_repr.encoding) - (opt "delegate" Signature.Public_key_hash.encoding) - (req "script" Script_repr.encoding)) ; - select = - (function - | Manager (Origination _ as op) -> Some op - | _ -> None) ; - proj = - (function - | Origination { credit ; delegate ; script ; - preorigination = _ - (* the hash is only used internally + MCase + { + tag = 2; + name = "origination"; + encoding = + obj3 + (req "balance" Tez_repr.encoding) + (opt "delegate" Signature.Public_key_hash.encoding) + (req "script" Script_repr.encoding); + select = + (function Manager (Origination _ as op) -> Some op | _ -> None); + proj = + (function + | Origination + { credit; + delegate; + script; + preorigination = + _ + (* the hash is only used internally when originating from smart - contracts, don't serialize it *) } -> - (credit, delegate, script)) ; - inj = - (fun (credit, delegate, script) -> - Origination - {credit ; delegate ; script ; preorigination = None }) - } + contracts, don't serialize it *) + } -> + (credit, delegate, script)); + inj = + (fun (credit, delegate, script) -> + Origination {credit; delegate; script; preorigination = None}); + } let delegation_case = - MCase { - tag = 3 ; - name = "delegation" ; - encoding = - (obj1 - (opt "delegate" Signature.Public_key_hash.encoding)) ; - select = - (function - | Manager (Delegation _ as op) -> Some op - | _ -> None) ; - proj = - (function Delegation key -> key) ; - inj = - (fun key -> Delegation key) - } + MCase + { + tag = 3; + name = "delegation"; + encoding = obj1 (opt "delegate" Signature.Public_key_hash.encoding); + select = + (function Manager (Delegation _ as op) -> Some op | _ -> None); + proj = (function Delegation key -> key); + inj = (fun key -> Delegation key); + } let encoding = - let make (MCase { tag ; name ; encoding ; select ; proj ; inj }) = - case (Tag tag) name encoding - (fun o -> match select o with None -> None | Some o -> Some (proj o)) - (fun x -> Manager (inj x)) in - union ~tag_size:`Uint8 [ - make reveal_case ; - make transaction_case ; - make origination_case ; - make delegation_case ; - ] - + let make (MCase {tag; name; encoding; select; proj; inj}) = + case + (Tag tag) + name + encoding + (fun o -> + match select o with None -> None | Some o -> Some (proj o)) + (fun x -> Manager (inj x)) + in + union + ~tag_size:`Uint8 + [ make reveal_case; + make transaction_case; + make origination_case; + make delegation_case ] end type 'b case = - Case : { tag: int ; - name: string ; - encoding: 'a Data_encoding.t ; - select: packed_contents -> 'b contents option ; - proj: 'b contents -> 'a ; - inj: 'a -> 'b contents } -> 'b case + | Case : { + tag : int; + name : string; + encoding : 'a Data_encoding.t; + select : packed_contents -> 'b contents option; + proj : 'b contents -> 'a; + inj : 'a -> 'b contents; + } + -> 'b case - let endorsement_encoding = - obj1 - (req "level" Raw_level_repr.encoding) + let endorsement_encoding = obj1 (req "level" Raw_level_repr.encoding) let endorsement_case = - Case { - tag = 0 ; - name = "endorsement" ; - encoding = endorsement_encoding ; - select = - (function - | Contents (Endorsement _ as op) -> Some op - | _ -> None) ; - proj = - (fun (Endorsement { level }) -> level) ; - inj = - (fun level -> Endorsement { level }) - } + Case + { + tag = 0; + name = "endorsement"; + encoding = endorsement_encoding; + select = + (function Contents (Endorsement _ as op) -> Some op | _ -> None); + proj = (fun (Endorsement {level}) -> level); + inj = (fun level -> Endorsement {level}); + } let endorsement_encoding = - let make (Case { tag ; name ; encoding ; select = _ ; proj ; inj }) = - case (Tag tag) name encoding - (fun o -> Some (proj o)) - (fun x -> inj x) in + let make (Case {tag; name; encoding; select = _; proj; inj}) = + case (Tag tag) name encoding (fun o -> Some (proj o)) (fun x -> inj x) + in let to_list : Kind.endorsement contents_list -> _ = function - | Single o -> o in - let of_list : Kind.endorsement contents -> _ = function - | o -> Single o in - def "inlined.endorsement" @@ - conv - (fun ({ shell ; protocol_data = { contents ; signature } } : _ operation)-> - (shell, (contents, signature))) - (fun (shell, (contents, signature)) -> - ({ shell ; protocol_data = { contents ; signature }} : _ operation)) - (merge_objs - Operation.shell_header_encoding - (obj2 - (req "operations" - (conv to_list of_list @@ - def "inlined.endorsement.contents" @@ - union [ - make endorsement_case ; - ])) - (varopt "signature" Signature.encoding))) + | Single o -> + o + in + let of_list : Kind.endorsement contents -> _ = function o -> Single o in + def "inlined.endorsement" + @@ conv + (fun ({shell; protocol_data = {contents; signature}} : _ operation) -> + (shell, (contents, signature))) + (fun (shell, (contents, signature)) -> + ({shell; protocol_data = {contents; signature}} : _ operation)) + (merge_objs + Operation.shell_header_encoding + (obj2 + (req + "operations" + ( conv to_list of_list + @@ def "inlined.endorsement.contents" + @@ union [make endorsement_case] )) + (varopt "signature" Signature.encoding))) let seed_nonce_revelation_case = - Case { - tag = 1; - name = "seed_nonce_revelation" ; - encoding = - (obj2 - (req "level" Raw_level_repr.encoding) - (req "nonce" Seed_repr.nonce_encoding)) ; - select = - (function - | Contents (Seed_nonce_revelation _ as op) -> Some op - | _ -> None) ; - proj = - (fun (Seed_nonce_revelation { level ; nonce }) -> (level, nonce)) ; - inj = - (fun (level, nonce) -> Seed_nonce_revelation { level ; nonce }) - } + Case + { + tag = 1; + name = "seed_nonce_revelation"; + encoding = + obj2 + (req "level" Raw_level_repr.encoding) + (req "nonce" Seed_repr.nonce_encoding); + select = + (function + | Contents (Seed_nonce_revelation _ as op) -> Some op | _ -> None); + proj = (fun (Seed_nonce_revelation {level; nonce}) -> (level, nonce)); + inj = (fun (level, nonce) -> Seed_nonce_revelation {level; nonce}); + } - let double_endorsement_evidence_case : Kind.double_endorsement_evidence case = - Case { - tag = 2 ; - name = "double_endorsement_evidence" ; - encoding = - (obj2 - (req "op1" (dynamic_size endorsement_encoding)) - (req "op2" (dynamic_size endorsement_encoding))) ; - select = - (function - | Contents (Double_endorsement_evidence _ as op) -> Some op - | _ -> None) ; - proj = - (fun (Double_endorsement_evidence { op1 ; op2 }) -> (op1, op2)) ; - inj = - (fun (op1, op2) -> (Double_endorsement_evidence { op1 ; op2 })) - } + let double_endorsement_evidence_case : Kind.double_endorsement_evidence case + = + Case + { + tag = 2; + name = "double_endorsement_evidence"; + encoding = + obj2 + (req "op1" (dynamic_size endorsement_encoding)) + (req "op2" (dynamic_size endorsement_encoding)); + select = + (function + | Contents (Double_endorsement_evidence _ as op) -> + Some op + | _ -> + None); + proj = (fun (Double_endorsement_evidence {op1; op2}) -> (op1, op2)); + inj = (fun (op1, op2) -> Double_endorsement_evidence {op1; op2}); + } let double_baking_evidence_case = - Case { - tag = 3 ; - name = "double_baking_evidence" ; - encoding = - (obj2 - (req "bh1" (dynamic_size Block_header_repr.encoding)) - (req "bh2" (dynamic_size Block_header_repr.encoding))) ; - select = - (function - | Contents (Double_baking_evidence _ as op) -> Some op - | _ -> None) ; - proj = - (fun (Double_baking_evidence { bh1 ; bh2 }) -> (bh1, bh2)) ; - inj = - (fun (bh1, bh2) -> Double_baking_evidence { bh1 ; bh2 }) ; - } + Case + { + tag = 3; + name = "double_baking_evidence"; + encoding = + obj2 + (req "bh1" (dynamic_size Block_header_repr.encoding)) + (req "bh2" (dynamic_size Block_header_repr.encoding)); + select = + (function + | Contents (Double_baking_evidence _ as op) -> Some op | _ -> None); + proj = (fun (Double_baking_evidence {bh1; bh2}) -> (bh1, bh2)); + inj = (fun (bh1, bh2) -> Double_baking_evidence {bh1; bh2}); + } let activate_account_case = - Case { - tag = 4 ; - name = "activate_account" ; - encoding = - (obj2 - (req "pkh" Ed25519.Public_key_hash.encoding) - (req "secret" Blinded_public_key_hash.activation_code_encoding)) ; - select = - (function - | Contents (Activate_account _ as op) -> Some op - | _ -> None) ; - proj = - (fun (Activate_account { id ; activation_code }) -> (id, activation_code)) ; - inj = - (fun (id, activation_code) -> Activate_account { id ; activation_code }) - } + Case + { + tag = 4; + name = "activate_account"; + encoding = + obj2 + (req "pkh" Ed25519.Public_key_hash.encoding) + (req "secret" Blinded_public_key_hash.activation_code_encoding); + select = + (function + | Contents (Activate_account _ as op) -> Some op | _ -> None); + proj = + (fun (Activate_account {id; activation_code}) -> + (id, activation_code)); + inj = + (fun (id, activation_code) -> Activate_account {id; activation_code}); + } let proposals_case = - Case { - tag = 5 ; - name = "proposals" ; - encoding = - (obj3 - (req "source" Signature.Public_key_hash.encoding) - (req "period" Voting_period_repr.encoding) - (req "proposals" (list Protocol_hash.encoding))) ; - select = - (function - | Contents (Proposals _ as op) -> Some op - | _ -> None) ; - proj = - (fun (Proposals { source ; period ; proposals }) -> - (source, period, proposals)) ; - inj = - (fun (source, period, proposals) -> - Proposals { source ; period ; proposals }) ; - } + Case + { + tag = 5; + name = "proposals"; + encoding = + obj3 + (req "source" Signature.Public_key_hash.encoding) + (req "period" Voting_period_repr.encoding) + (req "proposals" (list Protocol_hash.encoding)); + select = + (function Contents (Proposals _ as op) -> Some op | _ -> None); + proj = + (fun (Proposals {source; period; proposals}) -> + (source, period, proposals)); + inj = + (fun (source, period, proposals) -> + Proposals {source; period; proposals}); + } let ballot_case = - Case { - tag = 6 ; - name = "ballot" ; - encoding = - (obj4 - (req "source" Signature.Public_key_hash.encoding) - (req "period" Voting_period_repr.encoding) - (req "proposal" Protocol_hash.encoding) - (req "ballot" Vote_repr.ballot_encoding)) ; - select = - (function - | Contents (Ballot _ as op) -> Some op - | _ -> None) ; - proj = - (function - (Ballot { source ; period ; proposal ; ballot }) -> - (source, period, proposal, ballot)) ; - inj = - (fun (source, period, proposal, ballot) -> - Ballot { source ; period ; proposal ; ballot }) ; - } + Case + { + tag = 6; + name = "ballot"; + encoding = + obj4 + (req "source" Signature.Public_key_hash.encoding) + (req "period" Voting_period_repr.encoding) + (req "proposal" Protocol_hash.encoding) + (req "ballot" Vote_repr.ballot_encoding); + select = (function Contents (Ballot _ as op) -> Some op | _ -> None); + proj = + (function + | Ballot {source; period; proposal; ballot} -> + (source, period, proposal, ballot)); + inj = + (fun (source, period, proposal, ballot) -> + Ballot {source; period; proposal; ballot}); + } let manager_encoding = - (obj5 - (req "source" Signature.Public_key_hash.encoding) - (req "fee" Tez_repr.encoding) - (req "counter" (check_size 10 n)) - (req "gas_limit" (check_size 10 n)) - (req "storage_limit" (check_size 10 n))) + obj5 + (req "source" Signature.Public_key_hash.encoding) + (req "fee" Tez_repr.encoding) + (req "counter" (check_size 10 n)) + (req "gas_limit" (check_size 10 n)) + (req "storage_limit" (check_size 10 n)) - let extract - (type kind) - (Manager_operation { source ; fee ; counter ; - gas_limit ; storage_limit ; operation = _ } : kind Kind.manager contents) = + let extract (type kind) + (Manager_operation + {source; fee; counter; gas_limit; storage_limit; operation = _} : + kind Kind.manager contents) = (source, fee, counter, gas_limit, storage_limit) let rebuild (source, fee, counter, gas_limit, storage_limit) operation = - Manager_operation { source ; fee ; counter ; - gas_limit ; storage_limit ; operation } + Manager_operation + {source; fee; counter; gas_limit; storage_limit; operation} - let make_manager_case tag - (type kind) + let make_manager_case tag (type kind) (Manager_operations.MCase mcase : kind Manager_operations.case) = - Case { - tag ; - name = mcase.name ; - encoding = - merge_objs - manager_encoding - mcase.encoding ; - select = - (function - | Contents (Manager_operation ({ operation ; _ } as op)) -> begin - match mcase.select (Manager operation) with - | None -> None - | Some operation -> - Some (Manager_operation { op with operation }) - end - | _ -> None) ; - proj = - (function - | Manager_operation { operation ; _ } as op -> - (extract op, mcase.proj operation )) ; - inj = - (fun (op, contents) -> - (rebuild op (mcase.inj contents))) - } + Case + { + tag; + name = mcase.name; + encoding = merge_objs manager_encoding mcase.encoding; + select = + (function + | Contents (Manager_operation ({operation; _} as op)) -> ( + match mcase.select (Manager operation) with + | None -> + None + | Some operation -> + Some (Manager_operation {op with operation}) ) + | _ -> + None); + proj = + (function + | Manager_operation {operation; _} as op -> + (extract op, mcase.proj operation)); + inj = (fun (op, contents) -> rebuild op (mcase.inj contents)); + } let reveal_case = make_manager_case 107 Manager_operations.reveal_case - let transaction_case = make_manager_case 108 Manager_operations.transaction_case - let origination_case = make_manager_case 109 Manager_operations.origination_case - let delegation_case = make_manager_case 110 Manager_operations.delegation_case + + let transaction_case = + make_manager_case 108 Manager_operations.transaction_case + + let origination_case = + make_manager_case 109 Manager_operations.origination_case + + let delegation_case = + make_manager_case 110 Manager_operations.delegation_case let contents_encoding = - let make (Case { tag ; name ; encoding ; select ; proj ; inj }) = - case (Tag tag) name encoding + let make (Case {tag; name; encoding; select; proj; inj}) = + case + (Tag tag) + name + encoding (fun o -> match select o with None -> None | Some o -> Some (proj o)) - (fun x -> Contents (inj x)) in - def "operation.alpha.contents" @@ - union [ - make endorsement_case ; - make seed_nonce_revelation_case ; - make double_endorsement_evidence_case ; - make double_baking_evidence_case ; - make activate_account_case ; - make proposals_case ; - make ballot_case ; - make reveal_case ; - make transaction_case ; - make origination_case ; - make delegation_case ; - ] + (fun x -> Contents (inj x)) + in + def "operation.alpha.contents" + @@ union + [ make endorsement_case; + make seed_nonce_revelation_case; + make double_endorsement_evidence_case; + make double_baking_evidence_case; + make activate_account_case; + make proposals_case; + make ballot_case; + make reveal_case; + make transaction_case; + make origination_case; + make delegation_case ] let contents_list_encoding = conv to_list of_list (Variable.list contents_encoding) @@ -580,79 +613,84 @@ module Encoding = struct Signature.encoding let protocol_data_encoding = - def "operation.alpha.contents_and_signature" @@ - conv - (fun (Operation_data { contents ; signature }) -> - (Contents_list contents, signature)) - (fun (Contents_list contents, signature) -> - Operation_data { contents ; signature }) - (obj2 - (req "contents" contents_list_encoding) - (req "signature" optional_signature_encoding)) + def "operation.alpha.contents_and_signature" + @@ conv + (fun (Operation_data {contents; signature}) -> + (Contents_list contents, signature)) + (fun (Contents_list contents, signature) -> + Operation_data {contents; signature}) + (obj2 + (req "contents" contents_list_encoding) + (req "signature" optional_signature_encoding)) let operation_encoding = conv - (fun ({ shell ; protocol_data }) -> - (shell, protocol_data)) - (fun (shell, protocol_data) -> - { shell ; protocol_data }) - (merge_objs - Operation.shell_header_encoding - protocol_data_encoding) + (fun {shell; protocol_data} -> (shell, protocol_data)) + (fun (shell, protocol_data) -> {shell; protocol_data}) + (merge_objs Operation.shell_header_encoding protocol_data_encoding) let unsigned_operation_encoding = - def "operation.alpha.unsigned_operation" @@ - merge_objs - Operation.shell_header_encoding - (obj1 (req "contents" contents_list_encoding)) + def "operation.alpha.unsigned_operation" + @@ merge_objs + Operation.shell_header_encoding + (obj1 (req "contents" contents_list_encoding)) let internal_operation_encoding = - def "operation.alpha.internal_operation" @@ - conv - (fun (Internal_operation { source ; operation ; nonce }) -> - ((source, nonce), Manager operation)) - (fun ((source, nonce), Manager operation) -> - Internal_operation { source ; operation ; nonce }) - (merge_objs - (obj2 - (req "source" Contract_repr.encoding) - (req "nonce" uint16)) - Manager_operations.encoding) - + def "operation.alpha.internal_operation" + @@ conv + (fun (Internal_operation {source; operation; nonce}) -> + ((source, nonce), Manager operation)) + (fun ((source, nonce), Manager operation) -> + Internal_operation {source; operation; nonce}) + (merge_objs + (obj2 (req "source" Contract_repr.encoding) (req "nonce" uint16)) + Manager_operations.encoding) end let encoding = Encoding.operation_encoding + let contents_encoding = Encoding.contents_encoding + let contents_list_encoding = Encoding.contents_list_encoding + let protocol_data_encoding = Encoding.protocol_data_encoding + let unsigned_operation_encoding = Encoding.unsigned_operation_encoding + let internal_operation_encoding = Encoding.internal_operation_encoding -let raw ({ shell ; protocol_data } : _ operation) = +let raw ({shell; protocol_data} : _ operation) = let proto = Data_encoding.Binary.to_bytes_exn protocol_data_encoding - (Operation_data protocol_data) in - { Operation.shell ; proto } + (Operation_data protocol_data) + in + {Operation.shell; proto} let acceptable_passes (op : packed_operation) = - let Operation_data protocol_data = op.protocol_data in + let (Operation_data protocol_data) = op.protocol_data in match protocol_data.contents with - - | Single (Endorsement _) -> [0] - - | Single (Proposals _ ) -> [1] - | Single (Ballot _ ) -> [1] - - | Single (Seed_nonce_revelation _) -> [2] - | Single (Double_endorsement_evidence _) -> [2] - | Single (Double_baking_evidence _) -> [2] - | Single (Activate_account _) -> [2] - - | Single (Manager_operation _) -> [3] - | Cons _ -> [3] + | Single (Endorsement _) -> + [0] + | Single (Proposals _) -> + [1] + | Single (Ballot _) -> + [1] + | Single (Seed_nonce_revelation _) -> + [2] + | Single (Double_endorsement_evidence _) -> + [2] + | Single (Double_baking_evidence _) -> + [2] + | Single (Activate_account _) -> + [2] + | Single (Manager_operation _) -> + [3] + | Cons _ -> + [3] type error += Invalid_signature (* `Permanent *) + type error += Missing_signature (* `Permanent *) let () = @@ -660,10 +698,10 @@ let () = `Permanent ~id:"operation.invalid_signature" ~title:"Invalid operation signature" - ~description:"The operation signature is ill-formed \ - or has been made with the wrong public key" - ~pp:(fun ppf () -> - Format.fprintf ppf "The operation signature is invalid") + ~description: + "The operation signature is ill-formed or has been made with the wrong \ + public key" + ~pp:(fun ppf () -> Format.fprintf ppf "The operation signature is invalid") Data_encoding.unit (function Invalid_signature -> Some () | _ -> None) (fun () -> Invalid_signature) ; @@ -671,114 +709,148 @@ let () = `Permanent ~id:"operation.missing_signature" ~title:"Missing operation signature" - ~description:"The operation is of a kind that must be signed, \ - but the signature is missing" - ~pp:(fun ppf () -> - Format.fprintf ppf "The operation requires a signature") + ~description: + "The operation is of a kind that must be signed, but the signature is \ + missing" + ~pp:(fun ppf () -> Format.fprintf ppf "The operation requires a signature") Data_encoding.unit (function Missing_signature -> Some () | _ -> None) (fun () -> Missing_signature) -let check_signature_sync (type kind) key chain_id ({ shell ; protocol_data } : kind operation) = +let check_signature_sync (type kind) key chain_id + ({shell; protocol_data} : kind operation) = let check ~watermark contents signature = let unsigned_operation = Data_encoding.Binary.to_bytes_exn - unsigned_operation_encoding (shell, contents) in - if Signature.check ~watermark key signature unsigned_operation then - Ok () - else - error Invalid_signature in - match protocol_data.contents, protocol_data.signature with - | Single _, None -> + unsigned_operation_encoding + (shell, contents) + in + if Signature.check ~watermark key signature unsigned_operation then Ok () + else error Invalid_signature + in + match (protocol_data.contents, protocol_data.signature) with + | (Single _, None) -> error Missing_signature - | Cons _, None -> + | (Cons _, None) -> error Missing_signature - | Single (Endorsement _) as contents, Some signature -> - check ~watermark:(Endorsement chain_id) (Contents_list contents) signature - | Single _ as contents, Some signature -> + | ((Single (Endorsement _) as contents), Some signature) -> + check + ~watermark:(Endorsement chain_id) + (Contents_list contents) + signature + | ((Single _ as contents), Some signature) -> check ~watermark:Generic_operation (Contents_list contents) signature - | Cons _ as contents, Some signature -> + | ((Cons _ as contents), Some signature) -> check ~watermark:Generic_operation (Contents_list contents) signature let check_signature pk chain_id op = Lwt.return (check_signature_sync pk chain_id op) let hash_raw = Operation.hash + let hash (o : _ operation) = let proto = Data_encoding.Binary.to_bytes_exn protocol_data_encoding - (Operation_data o.protocol_data) in - Operation.hash { shell = o.shell ; proto } + (Operation_data o.protocol_data) + in + Operation.hash {shell = o.shell; proto} + let hash_packed (o : packed_operation) = let proto = - Data_encoding.Binary.to_bytes_exn - protocol_data_encoding - o.protocol_data in - Operation.hash { shell = o.shell ; proto } + Data_encoding.Binary.to_bytes_exn protocol_data_encoding o.protocol_data + in + Operation.hash {shell = o.shell; proto} type ('a, 'b) eq = Eq : ('a, 'a) eq -let equal_manager_operation_kind - : type a b. a manager_operation -> b manager_operation -> (a, b) eq option - = fun op1 op2 -> - match op1, op2 with - | Reveal _, Reveal _ -> Some Eq - | Reveal _, _ -> None - | Transaction _, Transaction _ -> Some Eq - | Transaction _, _ -> None - | Origination _, Origination _ -> Some Eq - | Origination _, _ -> None - | Delegation _, Delegation _ -> Some Eq - | Delegation _, _ -> None - -let equal_contents_kind - : type a b. a contents -> b contents -> (a, b) eq option - = fun op1 op2 -> - match op1, op2 with - | Endorsement _, Endorsement _ -> Some Eq - | Endorsement _, _ -> None - | Seed_nonce_revelation _, Seed_nonce_revelation _ -> Some Eq - | Seed_nonce_revelation _, _ -> None - | Double_endorsement_evidence _, Double_endorsement_evidence _ -> Some Eq - | Double_endorsement_evidence _, _ -> None - | Double_baking_evidence _, Double_baking_evidence _ -> Some Eq - | Double_baking_evidence _, _ -> None - | Activate_account _, Activate_account _ -> Some Eq - | Activate_account _, _ -> None - | Proposals _, Proposals _ -> Some Eq - | Proposals _, _ -> None - | Ballot _, Ballot _ -> Some Eq - | Ballot _, _ -> None - | Manager_operation op1, Manager_operation op2 -> begin - match equal_manager_operation_kind op1.operation op2.operation with - | None -> None - | Some Eq -> Some Eq - end - | Manager_operation _, _ -> None - -let rec equal_contents_kind_list - : type a b. a contents_list -> b contents_list -> (a, b) eq option - = fun op1 op2 -> - match op1, op2 with - | Single op1, Single op2 -> - equal_contents_kind op1 op2 - | Single _, Cons _ -> None - | Cons _, Single _ -> None - | Cons (op1, ops1), Cons (op2, ops2) -> begin - match equal_contents_kind op1 op2 with - | None -> None - | Some Eq -> - match equal_contents_kind_list ops1 ops2 with - | None -> None - | Some Eq -> Some Eq - end - -let equal - : type a b. a operation -> b operation -> (a, b) eq option - = fun op1 op2 -> - if not (Operation_hash.equal (hash op1) (hash op2)) then +let equal_manager_operation_kind : + type a b. a manager_operation -> b manager_operation -> (a, b) eq option = + fun op1 op2 -> + match (op1, op2) with + | (Reveal _, Reveal _) -> + Some Eq + | (Reveal _, _) -> None - else - equal_contents_kind_list - op1.protocol_data.contents op2.protocol_data.contents + | (Transaction _, Transaction _) -> + Some Eq + | (Transaction _, _) -> + None + | (Origination _, Origination _) -> + Some Eq + | (Origination _, _) -> + None + | (Delegation _, Delegation _) -> + Some Eq + | (Delegation _, _) -> + None + +let equal_contents_kind : + type a b. a contents -> b contents -> (a, b) eq option = + fun op1 op2 -> + match (op1, op2) with + | (Endorsement _, Endorsement _) -> + Some Eq + | (Endorsement _, _) -> + None + | (Seed_nonce_revelation _, Seed_nonce_revelation _) -> + Some Eq + | (Seed_nonce_revelation _, _) -> + None + | (Double_endorsement_evidence _, Double_endorsement_evidence _) -> + Some Eq + | (Double_endorsement_evidence _, _) -> + None + | (Double_baking_evidence _, Double_baking_evidence _) -> + Some Eq + | (Double_baking_evidence _, _) -> + None + | (Activate_account _, Activate_account _) -> + Some Eq + | (Activate_account _, _) -> + None + | (Proposals _, Proposals _) -> + Some Eq + | (Proposals _, _) -> + None + | (Ballot _, Ballot _) -> + Some Eq + | (Ballot _, _) -> + None + | (Manager_operation op1, Manager_operation op2) -> ( + match equal_manager_operation_kind op1.operation op2.operation with + | None -> + None + | Some Eq -> + Some Eq ) + | (Manager_operation _, _) -> + None + +let rec equal_contents_kind_list : + type a b. a contents_list -> b contents_list -> (a, b) eq option = + fun op1 op2 -> + match (op1, op2) with + | (Single op1, Single op2) -> + equal_contents_kind op1 op2 + | (Single _, Cons _) -> + None + | (Cons _, Single _) -> + None + | (Cons (op1, ops1), Cons (op2, ops2)) -> ( + match equal_contents_kind op1 op2 with + | None -> + None + | Some Eq -> ( + match equal_contents_kind_list ops1 ops2 with + | None -> + None + | Some Eq -> + Some Eq ) ) + +let equal : type a b. a operation -> b operation -> (a, b) eq option = + fun op1 op2 -> + if not (Operation_hash.equal (hash op1) (hash op2)) then None + else + equal_contents_kind_list + op1.protocol_data.contents + op2.protocol_data.contents diff --git a/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.mli index dd46b15c9..03509fa2d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/operation_repr.mli @@ -27,204 +27,243 @@ module Kind : sig type seed_nonce_revelation = Seed_nonce_revelation_kind + type double_endorsement_evidence = Double_endorsement_evidence_kind + type double_baking_evidence = Double_baking_evidence_kind + type activate_account = Activate_account_kind + type endorsement = Endorsement_kind + type proposals = Proposals_kind + type ballot = Ballot_kind + type reveal = Reveal_kind + type transaction = Transaction_kind + type origination = Origination_kind + type delegation = Delegation_kind + type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager | Origination_manager_kind : origination manager | Delegation_manager_kind : delegation manager - end -type raw = Operation.t = { - shell: Operation.shell_header ; - proto: MBytes.t ; -} +type raw = Operation.t = {shell : Operation.shell_header; proto : MBytes.t} -val raw_encoding: raw Data_encoding.t +val raw_encoding : raw Data_encoding.t type 'kind operation = { - shell: Operation.shell_header ; - protocol_data: 'kind protocol_data ; + shell : Operation.shell_header; + protocol_data : 'kind protocol_data; } and 'kind protocol_data = { - contents: 'kind contents_list ; - signature: Signature.t option ; + contents : 'kind contents_list; + signature : Signature.t option; } and _ contents_list = | Single : 'kind contents -> 'kind contents_list - | Cons : 'kind Kind.manager contents * 'rest Kind.manager contents_list -> - (('kind * 'rest) Kind.manager ) contents_list + | Cons : + 'kind Kind.manager contents * 'rest Kind.manager contents_list + -> ('kind * 'rest) Kind.manager contents_list and _ contents = - | Endorsement : { - level: Raw_level_repr.t ; - } -> Kind.endorsement contents + | Endorsement : {level : Raw_level_repr.t} -> Kind.endorsement contents | Seed_nonce_revelation : { - level: Raw_level_repr.t ; - nonce: Seed_repr.nonce ; - } -> Kind.seed_nonce_revelation contents + level : Raw_level_repr.t; + nonce : Seed_repr.nonce; + } + -> Kind.seed_nonce_revelation contents | Double_endorsement_evidence : { - op1: Kind.endorsement operation ; - op2: Kind.endorsement operation ; - } -> Kind.double_endorsement_evidence contents + op1 : Kind.endorsement operation; + op2 : Kind.endorsement operation; + } + -> Kind.double_endorsement_evidence contents | Double_baking_evidence : { - bh1: Block_header_repr.t ; - bh2: Block_header_repr.t ; - } -> Kind.double_baking_evidence contents + bh1 : Block_header_repr.t; + bh2 : Block_header_repr.t; + } + -> Kind.double_baking_evidence contents | Activate_account : { - id: Ed25519.Public_key_hash.t ; - activation_code: Blinded_public_key_hash.activation_code ; - } -> Kind.activate_account contents + id : Ed25519.Public_key_hash.t; + activation_code : Blinded_public_key_hash.activation_code; + } + -> Kind.activate_account contents | Proposals : { - source: Signature.Public_key_hash.t ; - period: Voting_period_repr.t ; - proposals: Protocol_hash.t list ; - } -> Kind.proposals contents + source : Signature.Public_key_hash.t; + period : Voting_period_repr.t; + proposals : Protocol_hash.t list; + } + -> Kind.proposals contents | Ballot : { - source: Signature.Public_key_hash.t ; - period: Voting_period_repr.t ; - proposal: Protocol_hash.t ; - ballot: Vote_repr.ballot ; - } -> Kind.ballot contents + source : Signature.Public_key_hash.t; + period : Voting_period_repr.t; + proposal : Protocol_hash.t; + ballot : Vote_repr.ballot; + } + -> Kind.ballot contents | Manager_operation : { - source: Signature.Public_key_hash.t ; - fee: Tez_repr.tez ; - counter: counter ; - operation: 'kind manager_operation ; - gas_limit: Z.t; - storage_limit: Z.t; - } -> 'kind Kind.manager contents + source : Signature.Public_key_hash.t; + fee : Tez_repr.tez; + counter : counter; + operation : 'kind manager_operation; + gas_limit : Z.t; + storage_limit : Z.t; + } + -> 'kind Kind.manager contents and _ manager_operation = | Reveal : Signature.Public_key.t -> Kind.reveal manager_operation | Transaction : { - amount: Tez_repr.tez ; - parameters: Script_repr.lazy_expr ; - entrypoint: string ; - destination: Contract_repr.contract ; - } -> Kind.transaction manager_operation + amount : Tez_repr.tez; + parameters : Script_repr.lazy_expr; + entrypoint : string; + destination : Contract_repr.contract; + } + -> Kind.transaction manager_operation | Origination : { - delegate: Signature.Public_key_hash.t option ; - script: Script_repr.t ; - credit: Tez_repr.tez ; - preorigination: Contract_repr.t option ; - } -> Kind.origination manager_operation + delegate : Signature.Public_key_hash.t option; + script : Script_repr.t; + credit : Tez_repr.tez; + preorigination : Contract_repr.t option; + } + -> Kind.origination manager_operation | Delegation : - Signature.Public_key_hash.t option -> Kind.delegation manager_operation + Signature.Public_key_hash.t option + -> Kind.delegation manager_operation and counter = Z.t type 'kind internal_operation = { - source: Contract_repr.contract ; - operation: 'kind manager_operation ; - nonce: int ; + source : Contract_repr.contract; + operation : 'kind manager_operation; + nonce : int; } type packed_manager_operation = | Manager : 'kind manager_operation -> packed_manager_operation -type packed_contents = - | Contents : 'kind contents -> packed_contents +type packed_contents = Contents : 'kind contents -> packed_contents type packed_contents_list = | Contents_list : 'kind contents_list -> packed_contents_list -val of_list: packed_contents list -> packed_contents_list -val to_list: packed_contents_list -> packed_contents list +val of_list : packed_contents list -> packed_contents_list + +val to_list : packed_contents_list -> packed_contents list type packed_protocol_data = | Operation_data : 'kind protocol_data -> packed_protocol_data type packed_operation = { - shell: Operation.shell_header ; - protocol_data: packed_protocol_data ; + shell : Operation.shell_header; + protocol_data : packed_protocol_data; } -val pack: 'kind operation -> packed_operation +val pack : 'kind operation -> packed_operation type packed_internal_operation = | Internal_operation : 'kind internal_operation -> packed_internal_operation -val manager_kind: 'kind manager_operation -> 'kind Kind.manager +val manager_kind : 'kind manager_operation -> 'kind Kind.manager -val encoding: packed_operation Data_encoding.t -val contents_encoding: packed_contents Data_encoding.t -val contents_list_encoding: packed_contents_list Data_encoding.t -val protocol_data_encoding: packed_protocol_data Data_encoding.t -val unsigned_operation_encoding: (Operation.shell_header * packed_contents_list) Data_encoding.t +val encoding : packed_operation Data_encoding.t -val raw: _ operation -> raw +val contents_encoding : packed_contents Data_encoding.t -val hash_raw: raw -> Operation_hash.t -val hash: _ operation -> Operation_hash.t -val hash_packed: packed_operation -> Operation_hash.t +val contents_list_encoding : packed_contents_list Data_encoding.t -val acceptable_passes: packed_operation -> int list +val protocol_data_encoding : packed_protocol_data Data_encoding.t + +val unsigned_operation_encoding : + (Operation.shell_header * packed_contents_list) Data_encoding.t + +val raw : _ operation -> raw + +val hash_raw : raw -> Operation_hash.t + +val hash : _ operation -> Operation_hash.t + +val hash_packed : packed_operation -> Operation_hash.t + +val acceptable_passes : packed_operation -> int list type error += Missing_signature (* `Permanent *) + type error += Invalid_signature (* `Permanent *) -val check_signature: +val check_signature : Signature.Public_key.t -> Chain_id.t -> _ operation -> unit tzresult Lwt.t -val check_signature_sync: + +val check_signature_sync : Signature.Public_key.t -> Chain_id.t -> _ operation -> unit tzresult - -val internal_operation_encoding: - packed_internal_operation Data_encoding.t +val internal_operation_encoding : packed_internal_operation Data_encoding.t type ('a, 'b) eq = Eq : ('a, 'a) eq -val equal: 'a operation -> 'b operation -> ('a, 'b) eq option + +val equal : 'a operation -> 'b operation -> ('a, 'b) eq option module Encoding : sig - type 'b case = - Case : { tag: int ; - name: string ; - encoding: 'a Data_encoding.t ; - select: packed_contents -> 'b contents option ; - proj: 'b contents -> 'a ; - inj: 'a -> 'b contents } -> 'b case + | Case : { + tag : int; + name : string; + encoding : 'a Data_encoding.t; + select : packed_contents -> 'b contents option; + proj : 'b contents -> 'a; + inj : 'a -> 'b contents; + } + -> 'b case - val endorsement_case: Kind.endorsement case - val seed_nonce_revelation_case: Kind.seed_nonce_revelation case - val double_endorsement_evidence_case: Kind.double_endorsement_evidence case - val double_baking_evidence_case: Kind.double_baking_evidence case - val activate_account_case: Kind.activate_account case - val proposals_case: Kind.proposals case - val ballot_case: Kind.ballot case - val reveal_case: Kind.reveal Kind.manager case - val transaction_case: Kind.transaction Kind.manager case - val origination_case: Kind.origination Kind.manager case - val delegation_case: Kind.delegation Kind.manager case + val endorsement_case : Kind.endorsement case + + val seed_nonce_revelation_case : Kind.seed_nonce_revelation case + + val double_endorsement_evidence_case : Kind.double_endorsement_evidence case + + val double_baking_evidence_case : Kind.double_baking_evidence case + + val activate_account_case : Kind.activate_account case + + val proposals_case : Kind.proposals case + + val ballot_case : Kind.ballot case + + val reveal_case : Kind.reveal Kind.manager case + + val transaction_case : Kind.transaction Kind.manager case + + val origination_case : Kind.origination Kind.manager case + + val delegation_case : Kind.delegation Kind.manager case module Manager_operations : sig - type 'b case = - MCase : { tag: int ; - name: string ; - encoding: 'a Data_encoding.t ; - select: packed_manager_operation -> 'kind manager_operation option ; - proj: 'kind manager_operation -> 'a ; - inj: 'a -> 'kind manager_operation } -> 'kind case + | MCase : { + tag : int; + name : string; + encoding : 'a Data_encoding.t; + select : packed_manager_operation -> 'kind manager_operation option; + proj : 'kind manager_operation -> 'a; + inj : 'a -> 'kind manager_operation; + } + -> 'kind case - val reveal_case: Kind.reveal case - val transaction_case: Kind.transaction case - val origination_case: Kind.origination case - val delegation_case: Kind.delegation case + val reveal_case : Kind.reveal case + val transaction_case : Kind.transaction case + + val origination_case : Kind.origination case + + val delegation_case : Kind.delegation case end - end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.ml index bbf9c18fb..d5869c641 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.ml @@ -24,62 +24,65 @@ (*****************************************************************************) type bootstrap_account = { - public_key_hash : Signature.Public_key_hash.t ; - public_key : Signature.Public_key.t option ; - amount : Tez_repr.t ; + public_key_hash : Signature.Public_key_hash.t; + public_key : Signature.Public_key.t option; + amount : Tez_repr.t; } type bootstrap_contract = { - delegate : Signature.Public_key_hash.t ; - amount : Tez_repr.t ; - script : Script_repr.t ; + delegate : Signature.Public_key_hash.t; + amount : Tez_repr.t; + script : Script_repr.t; } type t = { - bootstrap_accounts : bootstrap_account list ; - bootstrap_contracts : bootstrap_contract list ; - commitments : Commitment_repr.t list ; - constants : Constants_repr.parametric ; - security_deposit_ramp_up_cycles : int option ; - no_reward_cycles : int option ; + bootstrap_accounts : bootstrap_account list; + bootstrap_contracts : bootstrap_contract list; + commitments : Commitment_repr.t list; + constants : Constants_repr.parametric; + security_deposit_ramp_up_cycles : int option; + no_reward_cycles : int option; } let bootstrap_account_encoding = let open Data_encoding in union - [ case (Tag 0) ~title:"Public_key_known" - (tup2 - Signature.Public_key.encoding - Tez_repr.encoding) + [ case + (Tag 0) + ~title:"Public_key_known" + (tup2 Signature.Public_key.encoding Tez_repr.encoding) (function - | { public_key_hash ; public_key = Some public_key ; amount } -> - assert (Signature.Public_key_hash.equal - (Signature.Public_key.hash public_key) - public_key_hash) ; + | {public_key_hash; public_key = Some public_key; amount} -> + assert ( + Signature.Public_key_hash.equal + (Signature.Public_key.hash public_key) + public_key_hash ) ; Some (public_key, amount) - | { public_key = None } -> None) + | {public_key = None} -> + None) (fun (public_key, amount) -> - { public_key = Some public_key ; - public_key_hash = Signature.Public_key.hash public_key ; - amount }) ; - case (Tag 1) ~title:"Public_key_unknown" - (tup2 - Signature.Public_key_hash.encoding - Tez_repr.encoding) + { + public_key = Some public_key; + public_key_hash = Signature.Public_key.hash public_key; + amount; + }); + case + (Tag 1) + ~title:"Public_key_unknown" + (tup2 Signature.Public_key_hash.encoding Tez_repr.encoding) (function - | { public_key_hash ; public_key = None ; amount } -> + | {public_key_hash; public_key = None; amount} -> Some (public_key_hash, amount) - | { public_key = Some _ } -> None) + | {public_key = Some _} -> + None) (fun (public_key_hash, amount) -> - { public_key = None ; - public_key_hash ; - amount }) ] + {public_key = None; public_key_hash; amount}) ] let bootstrap_contract_encoding = let open Data_encoding in conv - (fun { delegate ; amount ; script } -> (delegate, amount, script)) - (fun (delegate, amount, script) -> { delegate ; amount ; script }) + (fun {delegate; amount; script} -> (delegate, amount, script)) + (fun (delegate, amount, script) -> {delegate; amount; script}) (obj3 (req "delegate" Signature.Public_key_hash.encoding) (req "amount" Tez_repr.encoding) @@ -88,16 +91,32 @@ let bootstrap_contract_encoding = let encoding = let open Data_encoding in conv - (fun { bootstrap_accounts ; bootstrap_contracts ; commitments ; constants ; - security_deposit_ramp_up_cycles ; no_reward_cycles } -> - ((bootstrap_accounts, bootstrap_contracts, commitments, - security_deposit_ramp_up_cycles, no_reward_cycles), - constants)) - (fun ( (bootstrap_accounts, bootstrap_contracts, commitments, - security_deposit_ramp_up_cycles, no_reward_cycles), - constants) -> - { bootstrap_accounts ; bootstrap_contracts ; commitments ; constants ; - security_deposit_ramp_up_cycles ; no_reward_cycles }) + (fun { bootstrap_accounts; + bootstrap_contracts; + commitments; + constants; + security_deposit_ramp_up_cycles; + no_reward_cycles } -> + ( ( bootstrap_accounts, + bootstrap_contracts, + commitments, + security_deposit_ramp_up_cycles, + no_reward_cycles ), + constants )) + (fun ( ( bootstrap_accounts, + bootstrap_contracts, + commitments, + security_deposit_ramp_up_cycles, + no_reward_cycles ), + constants ) -> + { + bootstrap_accounts; + bootstrap_contracts; + commitments; + constants; + security_deposit_ramp_up_cycles; + no_reward_cycles; + }) (merge_objs (obj5 (req "bootstrap_accounts" (list bootstrap_account_encoding)) @@ -106,253 +125,3 @@ let encoding = (opt "security_deposit_ramp_up_cycles" int31) (opt "no_reward_cycles" int31)) Constants_repr.parametric_encoding) - - -(* Only for migration from 004 to 005 *) - -module Proto_004 = struct - - type parametric = { - preserved_cycles: int ; - blocks_per_cycle: int32 ; - blocks_per_commitment: int32 ; - blocks_per_roll_snapshot: int32 ; - blocks_per_voting_period: int32 ; - time_between_blocks: Period_repr.t list ; - endorsers_per_block: int ; - hard_gas_limit_per_operation: Z.t ; - hard_gas_limit_per_block: Z.t ; - proof_of_work_threshold: int64 ; - tokens_per_roll: Tez_repr.t ; - michelson_maximum_type_size: int; - seed_nonce_revelation_tip: Tez_repr.t ; - origination_size: int ; - block_security_deposit: Tez_repr.t ; - endorsement_security_deposit: Tez_repr.t ; - block_reward: Tez_repr.t ; - endorsement_reward: Tez_repr.t ; - cost_per_byte: Tez_repr.t ; - hard_storage_limit_per_operation: Z.t ; - test_chain_duration: int64 ; (* in seconds *) - } - - let default = { - preserved_cycles = 5 ; - blocks_per_cycle = 4096l ; - blocks_per_commitment = 32l ; - blocks_per_roll_snapshot = 256l ; - blocks_per_voting_period = 32768l ; - time_between_blocks = - List.map Period_repr.of_seconds_exn [ 60L ; 75L ] ; - endorsers_per_block = 32 ; - hard_gas_limit_per_operation = Z.of_int 800_000 ; - hard_gas_limit_per_block = Z.of_int 8_000_000 ; - proof_of_work_threshold = - Int64.(sub (shift_left 1L 46) 1L) ; - tokens_per_roll = - Tez_repr.(mul_exn one 8_000) ; - michelson_maximum_type_size = 1000 ; - seed_nonce_revelation_tip = begin - match Tez_repr.(one /? 8L) with - | Ok c -> c - | Error _ -> assert false - end ; - origination_size = 257 ; - block_security_deposit = Tez_repr.(mul_exn one 512) ; - endorsement_security_deposit = Tez_repr.(mul_exn one 64) ; - block_reward = Tez_repr.(mul_exn one 16) ; - endorsement_reward = Tez_repr.(mul_exn one 2) ; - hard_storage_limit_per_operation = Z.of_int 60_000 ; - cost_per_byte = Tez_repr.of_mutez_exn 1_000L ; - test_chain_duration = Int64.mul 32768L 60L; - } - - (* This encoding is used to read configuration files (e.g. sandbox.json) - where some fields can be missing, in that case they are replaced by - the default. *) - let constants_encoding = - let open Data_encoding in - conv - (fun (c : parametric) -> - let module Compare_time_between_blocks = Compare.List (Period_repr) in - let module Compare_keys = Compare.List (Ed25519.Public_key) in - let opt (=) def v = if def = v then None else Some v in - let preserved_cycles = - opt Compare.Int.(=) - default.preserved_cycles c.preserved_cycles - and blocks_per_cycle = - opt Compare.Int32.(=) - default.blocks_per_cycle c.blocks_per_cycle - and blocks_per_commitment = - opt Compare.Int32.(=) - default.blocks_per_commitment c.blocks_per_commitment - and blocks_per_roll_snapshot = - opt Compare.Int32.(=) - default.blocks_per_roll_snapshot c.blocks_per_roll_snapshot - and blocks_per_voting_period = - opt Compare.Int32.(=) - default.blocks_per_voting_period c.blocks_per_voting_period - and time_between_blocks = - opt Compare_time_between_blocks.(=) - default.time_between_blocks c.time_between_blocks - and endorsers_per_block = - opt Compare.Int.(=) - default.endorsers_per_block c.endorsers_per_block - and hard_gas_limit_per_operation = - opt Compare.Z.(=) - default.hard_gas_limit_per_operation c.hard_gas_limit_per_operation - and hard_gas_limit_per_block = - opt Compare.Z.(=) - default.hard_gas_limit_per_block c.hard_gas_limit_per_block - and proof_of_work_threshold = - opt Compare.Int64.(=) - default.proof_of_work_threshold c.proof_of_work_threshold - and tokens_per_roll = - opt Tez_repr.(=) - default.tokens_per_roll c.tokens_per_roll - and michelson_maximum_type_size = - opt Compare.Int.(=) - default.michelson_maximum_type_size c.michelson_maximum_type_size - and seed_nonce_revelation_tip = - opt Tez_repr.(=) - default.seed_nonce_revelation_tip c.seed_nonce_revelation_tip - and origination_size = - opt Compare.Int.(=) - default.origination_size c.origination_size - and block_security_deposit = - opt Tez_repr.(=) - default.block_security_deposit c.block_security_deposit - and endorsement_security_deposit = - opt Tez_repr.(=) - default.endorsement_security_deposit c.endorsement_security_deposit - and block_reward = - opt Tez_repr.(=) - default.block_reward c.block_reward - and endorsement_reward = - opt Tez_repr.(=) - default.endorsement_reward c.endorsement_reward - and cost_per_byte = - opt Tez_repr.(=) - default.cost_per_byte c.cost_per_byte - and hard_storage_limit_per_operation = - opt Compare.Z.(=) - default.hard_storage_limit_per_operation c.hard_storage_limit_per_operation - and test_chain_duration = - opt Compare.Int64.(=) - default.test_chain_duration c.test_chain_duration - in - (( preserved_cycles, - blocks_per_cycle, - blocks_per_commitment, - blocks_per_roll_snapshot, - blocks_per_voting_period, - time_between_blocks, - endorsers_per_block, - hard_gas_limit_per_operation, - hard_gas_limit_per_block), - ((proof_of_work_threshold, - tokens_per_roll, - michelson_maximum_type_size, - seed_nonce_revelation_tip, - origination_size, - block_security_deposit, - endorsement_security_deposit, - block_reward), - (endorsement_reward, - cost_per_byte, - hard_storage_limit_per_operation, - test_chain_duration)))) - (fun (( preserved_cycles, - blocks_per_cycle, - blocks_per_commitment, - blocks_per_roll_snapshot, - blocks_per_voting_period, - time_between_blocks, - endorsers_per_block, - hard_gas_limit_per_operation, - hard_gas_limit_per_block), - ((proof_of_work_threshold, - tokens_per_roll, - michelson_maximum_type_size, - seed_nonce_revelation_tip, - origination_size, - block_security_deposit, - endorsement_security_deposit, - block_reward), - (endorsement_reward, - cost_per_byte, - hard_storage_limit_per_operation, - test_chain_duration))) -> - let unopt def = function None -> def | Some v -> v in - { preserved_cycles = - unopt default.preserved_cycles preserved_cycles ; - blocks_per_cycle = - unopt default.blocks_per_cycle blocks_per_cycle ; - blocks_per_commitment = - unopt default.blocks_per_commitment blocks_per_commitment ; - blocks_per_roll_snapshot = - unopt default.blocks_per_roll_snapshot blocks_per_roll_snapshot ; - blocks_per_voting_period = - unopt default.blocks_per_voting_period blocks_per_voting_period ; - time_between_blocks = - unopt default.time_between_blocks @@ - time_between_blocks ; - endorsers_per_block = - unopt default.endorsers_per_block endorsers_per_block ; - hard_gas_limit_per_operation = - unopt default.hard_gas_limit_per_operation hard_gas_limit_per_operation ; - hard_gas_limit_per_block = - unopt default.hard_gas_limit_per_block hard_gas_limit_per_block ; - proof_of_work_threshold = - unopt default.proof_of_work_threshold proof_of_work_threshold ; - tokens_per_roll = - unopt default.tokens_per_roll tokens_per_roll ; - michelson_maximum_type_size = - unopt default.michelson_maximum_type_size michelson_maximum_type_size ; - seed_nonce_revelation_tip = - unopt default.seed_nonce_revelation_tip seed_nonce_revelation_tip ; - origination_size = - unopt default.origination_size origination_size ; - block_security_deposit = - unopt default.block_security_deposit block_security_deposit ; - endorsement_security_deposit = - unopt default.endorsement_security_deposit endorsement_security_deposit ; - block_reward = - unopt default.block_reward block_reward ; - endorsement_reward = - unopt default.endorsement_reward endorsement_reward ; - cost_per_byte = - unopt default.cost_per_byte cost_per_byte ; - hard_storage_limit_per_operation = - unopt default.hard_storage_limit_per_operation hard_storage_limit_per_operation ; - test_chain_duration = - unopt default.test_chain_duration test_chain_duration ; - } ) - (merge_objs - (obj9 - (opt "preserved_cycles" uint8) - (opt "blocks_per_cycle" int32) - (opt "blocks_per_commitment" int32) - (opt "blocks_per_roll_snapshot" int32) - (opt "blocks_per_voting_period" int32) - (opt "time_between_blocks" (list Period_repr.encoding)) - (opt "endorsers_per_block" uint16) - (opt "hard_gas_limit_per_operation" z) - (opt "hard_gas_limit_per_block" z)) - (merge_objs - (obj8 - (opt "proof_of_work_threshold" int64) - (opt "tokens_per_roll" Tez_repr.encoding) - (opt "michelson_maximum_type_size" uint16) - (opt "seed_nonce_revelation_tip" Tez_repr.encoding) - (opt "origination_size" int31) - (opt "block_security_deposit" Tez_repr.encoding) - (opt "endorsement_security_deposit" Tez_repr.encoding) - (opt "block_reward" Tez_repr.encoding)) - (obj4 - (opt "endorsement_reward" Tez_repr.encoding) - (opt "cost_per_byte" Tez_repr.encoding) - (opt "hard_storage_limit_per_operation" z) - (opt "test_chain_duration" int64)))) - -end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.mli index c679c58f1..6f8436e71 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/parameters_repr.mli @@ -24,55 +24,24 @@ (*****************************************************************************) type bootstrap_account = { - public_key_hash : Signature.Public_key_hash.t ; - public_key : Signature.Public_key.t option ; - amount : Tez_repr.t ; + public_key_hash : Signature.Public_key_hash.t; + public_key : Signature.Public_key.t option; + amount : Tez_repr.t; } type bootstrap_contract = { - delegate : Signature.Public_key_hash.t ; - amount : Tez_repr.t ; - script : Script_repr.t ; + delegate : Signature.Public_key_hash.t; + amount : Tez_repr.t; + script : Script_repr.t; } type t = { - bootstrap_accounts : bootstrap_account list ; - bootstrap_contracts : bootstrap_contract list ; - commitments : Commitment_repr.t list ; - constants : Constants_repr.parametric ; - security_deposit_ramp_up_cycles : int option ; - no_reward_cycles : int option ; + bootstrap_accounts : bootstrap_account list; + bootstrap_contracts : bootstrap_contract list; + commitments : Commitment_repr.t list; + constants : Constants_repr.parametric; + security_deposit_ramp_up_cycles : int option; + no_reward_cycles : int option; } -val encoding: t Data_encoding.t - - -(* Only for migration from 004 to 005 *) - -module Proto_004 : sig - type parametric = { - preserved_cycles: int ; - blocks_per_cycle: int32 ; - blocks_per_commitment: int32 ; - blocks_per_roll_snapshot: int32 ; - blocks_per_voting_period: int32 ; - time_between_blocks: Period_repr.t list ; - endorsers_per_block: int ; - hard_gas_limit_per_operation: Z.t ; - hard_gas_limit_per_block: Z.t ; - proof_of_work_threshold: int64 ; - tokens_per_roll: Tez_repr.t ; - michelson_maximum_type_size: int; - seed_nonce_revelation_tip: Tez_repr.t ; - origination_size: int ; - block_security_deposit: Tez_repr.t ; - endorsement_security_deposit: Tez_repr.t ; - block_reward: Tez_repr.t ; - endorsement_reward: Tez_repr.t ; - cost_per_byte: Tez_repr.t ; - hard_storage_limit_per_operation: Z.t ; - test_chain_duration: int64 ; - } - - val constants_encoding: parametric Data_encoding.t -end +val encoding : t Data_encoding.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/period_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/period_repr.ml index 3719221f4..2bd3e643b 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/period_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/period_repr.ml @@ -24,8 +24,11 @@ (*****************************************************************************) type t = Int64.t + type period = t + include (Compare.Int64 : Compare.S with type t := t) + let encoding = Data_encoding.int64 let rpc_arg = RPC_arg.int64 @@ -33,8 +36,7 @@ let rpc_arg = RPC_arg.int64 let pp ppf v = Format.fprintf ppf "%Ld" v type error += (* `Permanent *) - | Malformed_period - | Invalid_arg + Malformed_period | Invalid_arg let () = let open Data_encoding in @@ -60,22 +62,26 @@ let () = (fun () -> Invalid_arg) let of_seconds t = - if Compare.Int64.(t >= 0L) - then ok t - else error Malformed_period + if Compare.Int64.(t >= 0L) then ok t else error Malformed_period + let to_seconds t = t + let of_seconds_exn t = match of_seconds t with - | Ok t -> t - | _ -> invalid_arg "Period.of_seconds_exn" + | Ok t -> + t + | _ -> + invalid_arg "Period.of_seconds_exn" let mult i p = (* TODO check overflow *) - if Compare.Int32.(i < 0l) - then error Invalid_arg + if Compare.Int32.(i < 0l) then error Invalid_arg else ok (Int64.mul (Int64.of_int32 i) p) let zero = of_seconds_exn 0L + let one_second = of_seconds_exn 1L + let one_minute = of_seconds_exn 60L + let one_hour = of_seconds_exn 3600L diff --git a/vendors/ligo-utils/tezos-protocol-alpha/period_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/period_repr.mli index a84fba7d2..4fbd52db4 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/period_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/period_repr.mli @@ -24,12 +24,16 @@ (*****************************************************************************) type t -type period = t -include Compare.S with type t := t -val encoding : period Data_encoding.t -val rpc_arg : period RPC_arg.t -val pp: Format.formatter -> period -> unit +type period = t + +include Compare.S with type t := t + +val encoding : period Data_encoding.t + +val rpc_arg : period RPC_arg.t + +val pp : Format.formatter -> period -> unit val to_seconds : period -> int64 @@ -43,6 +47,9 @@ val of_seconds_exn : int64 -> period val mult : int32 -> period -> period tzresult val zero : period + val one_second : period + val one_minute : period + val one_hour : period diff --git a/vendors/ligo-utils/tezos-protocol-alpha/qty_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/qty_repr.ml index 02fc79723..a397a8f74 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/qty_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/qty_repr.ml @@ -35,18 +35,28 @@ module type S = sig | Subtraction_underflow of qty * qty (* `Temporary *) | Multiplication_overflow of qty * int64 (* `Temporary *) | Negative_multiplicator of qty * int64 (* `Temporary *) - | Invalid_divisor of qty * int64 (* `Temporary *) + | Invalid_divisor of qty * int64 + + (* `Temporary *) val id : string + val zero : qty + val one_mutez : qty + val one_cent : qty + val fifty_cents : qty + val one : qty val ( -? ) : qty -> qty -> qty tzresult + val ( +? ) : qty -> qty -> qty tzresult + val ( *? ) : qty -> int64 -> qty tzresult + val ( /? ) : qty -> int64 -> qty tzresult val to_mutez : qty -> int64 @@ -70,15 +80,14 @@ module type S = sig include Compare.S with type t := qty - val pp: Format.formatter -> qty -> unit + val pp : Format.formatter -> qty -> unit - val of_string: string -> qty option - val to_string: qty -> string + val of_string : string -> qty option + val to_string : qty -> string end -module Make (T: QTY) : S = struct - +module Make (T : QTY) : S = struct type qty = int64 (* invariant: positive *) type error += @@ -86,16 +95,24 @@ module Make (T: QTY) : S = struct | Subtraction_underflow of qty * qty (* `Temporary *) | Multiplication_overflow of qty * int64 (* `Temporary *) | Negative_multiplicator of qty * int64 (* `Temporary *) - | Invalid_divisor of qty * int64 (* `Temporary *) + | Invalid_divisor of qty * int64 + + (* `Temporary *) include Compare.Int64 + let zero = 0L + (* all other constant are defined from the value of one micro tez *) let one_mutez = 1L + let one_cent = Int64.mul one_mutez 10_000L + let fifty_cents = Int64.mul one_cent 50L + (* 1 tez = 100 cents = 1_000_000 mutez *) let one = Int64.mul one_cent 100L + let id = T.id let of_string s = @@ -103,143 +120,130 @@ module Make (T: QTY) : S = struct | hd :: tl -> let len = String.length hd in Compare.Int.( - len <= 3 && len > 0 && - List.for_all (fun s -> String.length s = 3) tl - ) - | [] -> false in + len <= 3 && len > 0 + && List.for_all (fun s -> String.length s = 3) tl) + | [] -> + false + in let integers s = triplets (String.split_on_char ',' s) in let decimals s = let l = String.split_on_char ',' s in - if Compare.Int.(List.length l > 2) then - false - else - triplets (List.rev l) in + if Compare.Int.(List.length l > 2) then false else triplets (List.rev l) + in let parse left right = let remove_commas s = String.concat "" (String.split_on_char ',' s) in let pad_to_six s = let len = String.length s in - String.init 6 (fun i -> if Compare.Int.(i < len) then String.get s i else '0') in + String.init 6 (fun i -> if Compare.Int.(i < len) then s.[i] else '0') + in try - Some (Int64.of_string (remove_commas left ^ pad_to_six (remove_commas right))) - with _ -> None in + Some + (Int64.of_string + (remove_commas left ^ pad_to_six (remove_commas right))) + with _ -> None + in match String.split_on_char '.' s with - | [ left ; right ] -> + | [left; right] -> if String.contains s ',' then - if integers left && decimals right then - parse left right - else - None - else if Compare.Int.(String.length right > 0) - && Compare.Int.(String.length right <= 6) then - parse left right + if integers left && decimals right then parse left right else None + else if + Compare.Int.(String.length right > 0) + && Compare.Int.(String.length right <= 6) + then parse left right else None - | [ left ] -> - if not (String.contains s ',') || integers left then - parse left "" + | [left] -> + if (not (String.contains s ',')) || integers left then parse left "" else None - | _ -> None + | _ -> + None let pp ppf amount = let mult_int = 1_000_000L in let rec left ppf amount = - let d, r = Int64.(div amount 1000L), Int64.(rem amount 1000L) in - if d > 0L then - Format.fprintf ppf "%a%03Ld" left d r - else - Format.fprintf ppf "%Ld" r in + let (d, r) = (Int64.(div amount 1000L), Int64.(rem amount 1000L)) in + if d > 0L then Format.fprintf ppf "%a%03Ld" left d r + else Format.fprintf ppf "%Ld" r + in let right ppf amount = let triplet ppf v = - if Compare.Int.(v mod 10 > 0) then - Format.fprintf ppf "%03d" v + if Compare.Int.(v mod 10 > 0) then Format.fprintf ppf "%03d" v else if Compare.Int.(v mod 100 > 0) then Format.fprintf ppf "%02d" (v / 10) - else - Format.fprintf ppf "%d" (v / 100) in - let hi, lo = amount / 1000, amount mod 1000 in - if Compare.Int.(lo = 0) then - Format.fprintf ppf "%a" triplet hi - else - Format.fprintf ppf "%03d%a" hi triplet lo in - let ints, decs = - Int64.(div amount mult_int), - Int64.(to_int (rem amount mult_int)) in + else Format.fprintf ppf "%d" (v / 100) + in + let (hi, lo) = (amount / 1000, amount mod 1000) in + if Compare.Int.(lo = 0) then Format.fprintf ppf "%a" triplet hi + else Format.fprintf ppf "%03d%a" hi triplet lo + in + let (ints, decs) = + (Int64.(div amount mult_int), Int64.(to_int (rem amount mult_int))) + in Format.fprintf ppf "%a" left ints ; - if Compare.Int.(decs > 0) then - Format.fprintf ppf ".%a" right decs + if Compare.Int.(decs > 0) then Format.fprintf ppf ".%a" right decs - let to_string t = - Format.asprintf "%a" pp t + let to_string t = Format.asprintf "%a" pp t - let (-) t1 t2 = - if t2 <= t1 - then Some (Int64.sub t1 t2) - else None + let ( - ) t1 t2 = if t2 <= t1 then Some (Int64.sub t1 t2) else None let ( -? ) t1 t2 = match t1 - t2 with - | None -> error (Subtraction_underflow (t1, t2)) - | Some v -> ok v + | None -> + error (Subtraction_underflow (t1, t2)) + | Some v -> + ok v let ( +? ) t1 t2 = let t = Int64.add t1 t2 in - if t < t1 - then error (Addition_overflow (t1, t2)) - else ok t + if t < t1 then error (Addition_overflow (t1, t2)) else ok t let ( *? ) t m = let open Compare.Int64 in let open Int64 in let rec step cur pow acc = - if cur = 0L then - ok acc + if cur = 0L then ok acc else - pow +? pow >>? fun npow -> + pow +? pow + >>? fun npow -> if logand cur 1L = 1L then - acc +? pow >>? fun nacc -> - step (shift_right_logical cur 1) npow nacc - else - step (shift_right_logical cur 1) npow acc in - if m < 0L then - error (Negative_multiplicator (t, m)) + acc +? pow >>? fun nacc -> step (shift_right_logical cur 1) npow nacc + else step (shift_right_logical cur 1) npow acc + in + if m < 0L then error (Negative_multiplicator (t, m)) else match step m t 0L with - | Ok res -> Ok res - | Error ([ Addition_overflow _ ] as errs) -> + | Ok res -> + Ok res + | Error ([Addition_overflow _] as errs) -> Error (Multiplication_overflow (t, m) :: errs) - | Error errs -> Error errs + | Error errs -> + Error errs let ( /? ) t d = - if d <= 0L then - error (Invalid_divisor (t, d)) - else - ok (Int64.div t d) + if d <= 0L then error (Invalid_divisor (t, d)) else ok (Int64.div t d) let add_exn t1 t2 = let t = Int64.add t1 t2 in - if t <= 0L - then invalid_arg "add_exn" - else t + if t <= 0L then invalid_arg "add_exn" else t let mul_exn t m = match t *? Int64.(of_int m) with - | Ok v -> v - | Error _ -> invalid_arg "mul_exn" + | Ok v -> + v + | Error _ -> + invalid_arg "mul_exn" - let of_mutez t = - if t < 0L then None - else Some t + let of_mutez t = if t < 0L then None else Some t let of_mutez_exn x = - match of_mutez x with - | None -> invalid_arg "Qty.of_mutez" - | Some v -> v + match of_mutez x with None -> invalid_arg "Qty.of_mutez" | Some v -> v let to_int64 t = t + let to_mutez t = t let encoding = let open Data_encoding in - (check_size 10 (conv Z.of_int64 (Json.wrap_error Z.to_int64) n)) + check_size 10 (conv Z.of_int64 (Json.wrap_error Z.to_int64) n) let () = let open Data_encoding in @@ -247,11 +251,17 @@ module Make (T: QTY) : S = struct `Temporary ~id:(T.id ^ ".addition_overflow") ~title:("Overflowing " ^ T.id ^ " addition") - ~pp: (fun ppf (opa, opb) -> - Format.fprintf ppf "Overflowing addition of %a %s and %a %s" - pp opa T.id pp opb T.id) - ~description: - ("An addition of two " ^ T.id ^ " amounts overflowed") + ~pp:(fun ppf (opa, opb) -> + Format.fprintf + ppf + "Overflowing addition of %a %s and %a %s" + pp + opa + T.id + pp + opb + T.id) + ~description:("An addition of two " ^ T.id ^ " amounts overflowed") (obj1 (req "amounts" (tup2 encoding encoding))) (function Addition_overflow (a, b) -> Some (a, b) | _ -> None) (fun (a, b) -> Addition_overflow (a, b)) ; @@ -259,11 +269,17 @@ module Make (T: QTY) : S = struct `Temporary ~id:(T.id ^ ".subtraction_underflow") ~title:("Underflowing " ^ T.id ^ " subtraction") - ~pp: (fun ppf (opa, opb) -> - Format.fprintf ppf "Underflowing subtraction of %a %s and %a %s" - pp opa T.id pp opb T.id) - ~description: - ("An subtraction of two " ^ T.id ^ " amounts underflowed") + ~pp:(fun ppf (opa, opb) -> + Format.fprintf + ppf + "Underflowing subtraction of %a %s and %a %s" + pp + opa + T.id + pp + opb + T.id) + ~description:("An subtraction of two " ^ T.id ^ " amounts underflowed") (obj1 (req "amounts" (tup2 encoding encoding))) (function Subtraction_underflow (a, b) -> Some (a, b) | _ -> None) (fun (a, b) -> Subtraction_underflow (a, b)) ; @@ -271,43 +287,51 @@ module Make (T: QTY) : S = struct `Temporary ~id:(T.id ^ ".multiplication_overflow") ~title:("Overflowing " ^ T.id ^ " multiplication") - ~pp: (fun ppf (opa, opb) -> - Format.fprintf ppf "Overflowing multiplication of %a %s and %Ld" - pp opa T.id opb) + ~pp:(fun ppf (opa, opb) -> + Format.fprintf + ppf + "Overflowing multiplication of %a %s and %Ld" + pp + opa + T.id + opb) ~description: ("A multiplication of a " ^ T.id ^ " amount by an integer overflowed") - (obj2 - (req "amount" encoding) - (req "multiplicator" int64)) + (obj2 (req "amount" encoding) (req "multiplicator" int64)) (function Multiplication_overflow (a, b) -> Some (a, b) | _ -> None) (fun (a, b) -> Multiplication_overflow (a, b)) ; register_error_kind `Temporary ~id:(T.id ^ ".negative_multiplicator") ~title:("Negative " ^ T.id ^ " multiplicator") - ~pp: (fun ppf (opa, opb) -> - Format.fprintf ppf "Multiplication of %a %s by negative integer %Ld" - pp opa T.id opb) + ~pp:(fun ppf (opa, opb) -> + Format.fprintf + ppf + "Multiplication of %a %s by negative integer %Ld" + pp + opa + T.id + opb) ~description: ("Multiplication of a " ^ T.id ^ " amount by a negative integer") - (obj2 - (req "amount" encoding) - (req "multiplicator" int64)) + (obj2 (req "amount" encoding) (req "multiplicator" int64)) (function Negative_multiplicator (a, b) -> Some (a, b) | _ -> None) (fun (a, b) -> Negative_multiplicator (a, b)) ; register_error_kind `Temporary ~id:(T.id ^ ".invalid_divisor") ~title:("Invalid " ^ T.id ^ " divisor") - ~pp: (fun ppf (opa, opb) -> - Format.fprintf ppf "Division of %a %s by non positive integer %Ld" - pp opa T.id opb) + ~pp:(fun ppf (opa, opb) -> + Format.fprintf + ppf + "Division of %a %s by non positive integer %Ld" + pp + opa + T.id + opb) ~description: ("Multiplication of a " ^ T.id ^ " amount by a non positive integer") - (obj2 - (req "amount" encoding) - (req "divisor" int64)) + (obj2 (req "amount" encoding) (req "divisor" int64)) (function Invalid_divisor (a, b) -> Some (a, b) | _ -> None) (fun (a, b) -> Invalid_divisor (a, b)) - end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml b/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml index 87b3615d0..799f7ca98 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/raw_context.ml @@ -26,62 +26,75 @@ module Int_set = Set.Make (Compare.Int) type t = { - context: Context.t ; - constants: Constants_repr.parametric ; - first_level: Raw_level_repr.t ; - level: Level_repr.t ; - predecessor_timestamp: Time.t ; - timestamp: Time.t ; - fitness: Int64.t ; - deposits: Tez_repr.t Signature.Public_key_hash.Map.t ; - included_endorsements: int ; - allowed_endorsements: - (Signature.Public_key.t * int list * bool) Signature.Public_key_hash.Map.t ; - fees: Tez_repr.t ; - rewards: Tez_repr.t ; - block_gas: Z.t ; - operation_gas: Gas_limit_repr.t ; - internal_gas: Gas_limit_repr.internal_gas ; - storage_space_to_pay: Z.t option ; - allocated_contracts: int option ; - origination_nonce: Contract_repr.origination_nonce option ; - temporary_big_map: Z.t ; - internal_nonce: int ; - internal_nonces_used: Int_set.t ; + context : Context.t; + constants : Constants_repr.parametric; + first_level : Raw_level_repr.t; + level : Level_repr.t; + predecessor_timestamp : Time.t; + timestamp : Time.t; + fitness : Int64.t; + deposits : Tez_repr.t Signature.Public_key_hash.Map.t; + included_endorsements : int; + allowed_endorsements : + (Signature.Public_key.t * int list * bool) Signature.Public_key_hash.Map.t; + fees : Tez_repr.t; + rewards : Tez_repr.t; + block_gas : Z.t; + operation_gas : Gas_limit_repr.t; + internal_gas : Gas_limit_repr.internal_gas; + storage_space_to_pay : Z.t option; + allocated_contracts : int option; + origination_nonce : Contract_repr.origination_nonce option; + temporary_big_map : Z.t; + internal_nonce : int; + internal_nonces_used : Int_set.t; } type context = t + type root_context = t let current_level ctxt = ctxt.level + let predecessor_timestamp ctxt = ctxt.predecessor_timestamp + let current_timestamp ctxt = ctxt.timestamp + let current_fitness ctxt = ctxt.fitness + let first_level ctxt = ctxt.first_level + let constants ctxt = ctxt.constants + let recover ctxt = ctxt.context let record_endorsement ctxt k = match Signature.Public_key_hash.Map.find_opt k ctxt.allowed_endorsements with - | None -> assert false - | Some (_, _, true) -> assert false (* right already used *) + | None -> + assert false + | Some (_, _, true) -> + assert false (* right already used *) | Some (d, s, false) -> - { ctxt with - included_endorsements = ctxt.included_endorsements + (List.length s); + { + ctxt with + included_endorsements = ctxt.included_endorsements + List.length s; allowed_endorsements = - Signature.Public_key_hash.Map.add k (d,s,true) ctxt.allowed_endorsements } + Signature.Public_key_hash.Map.add + k + (d, s, true) + ctxt.allowed_endorsements; + } let init_endorsements ctxt allowed_endorsements = - if Signature.Public_key_hash.Map.is_empty allowed_endorsements - then assert false (* can't initialize to empty *) - else begin - if Signature.Public_key_hash.Map.is_empty ctxt.allowed_endorsements - then { ctxt with allowed_endorsements } - else assert false (* can't initialize twice *) - end + if Signature.Public_key_hash.Map.is_empty allowed_endorsements then + assert false (* can't initialize to empty *) + else if Signature.Public_key_hash.Map.is_empty ctxt.allowed_endorsements then + {ctxt with allowed_endorsements} + else assert false -let allowed_endorsements ctxt = - ctxt.allowed_endorsements +(* can't initialize twice *) + +let allowed_endorsements ctxt = ctxt.allowed_endorsements let included_endorsements ctxt = ctxt.included_endorsements @@ -92,10 +105,9 @@ let () = register_error_kind `Permanent ~id:"too_many_internal_operations" - ~title: "Too many internal operations" + ~title:"Too many internal operations" ~description: - "A transaction exceeded the hard limit \ - of internal operations it can emit" + "A transaction exceeded the hard limit of internal operations it can emit" empty (function Too_many_internal_operations -> Some () | _ -> None) (fun () -> Too_many_internal_operations) @@ -104,36 +116,48 @@ let fresh_internal_nonce ctxt = if Compare.Int.(ctxt.internal_nonce >= 65_535) then error Too_many_internal_operations else - ok ({ ctxt with internal_nonce = ctxt.internal_nonce + 1 }, ctxt.internal_nonce) + ok + ( {ctxt with internal_nonce = ctxt.internal_nonce + 1}, + ctxt.internal_nonce ) + let reset_internal_nonce ctxt = - { ctxt with internal_nonces_used = Int_set.empty ; internal_nonce = 0 } + {ctxt with internal_nonces_used = Int_set.empty; internal_nonce = 0} + let record_internal_nonce ctxt k = - { ctxt with internal_nonces_used = Int_set.add k ctxt.internal_nonces_used } + {ctxt with internal_nonces_used = Int_set.add k ctxt.internal_nonces_used} + let internal_nonce_already_recorded ctxt k = Int_set.mem k ctxt.internal_nonces_used -let set_current_fitness ctxt fitness = { ctxt with fitness } +let set_current_fitness ctxt fitness = {ctxt with fitness} let add_fees ctxt fees = - Lwt.return Tez_repr.(ctxt.fees +? fees) >>=? fun fees -> - return { ctxt with fees} + Lwt.return Tez_repr.(ctxt.fees +? fees) + >>=? fun fees -> return {ctxt with fees} let add_rewards ctxt rewards = - Lwt.return Tez_repr.(ctxt.rewards +? rewards) >>=? fun rewards -> - return { ctxt with rewards} + Lwt.return Tez_repr.(ctxt.rewards +? rewards) + >>=? fun rewards -> return {ctxt with rewards} let add_deposit ctxt delegate deposit = let previous = match Signature.Public_key_hash.Map.find_opt delegate ctxt.deposits with - | Some tz -> tz - | None -> Tez_repr.zero in - Lwt.return Tez_repr.(previous +? deposit) >>=? fun deposit -> + | Some tz -> + tz + | None -> + Tez_repr.zero + in + Lwt.return Tez_repr.(previous +? deposit) + >>=? fun deposit -> let deposits = - Signature.Public_key_hash.Map.add delegate deposit ctxt.deposits in - return { ctxt with deposits } + Signature.Public_key_hash.Map.add delegate deposit ctxt.deposits + in + return {ctxt with deposits} let get_deposits ctxt = ctxt.deposits + let get_rewards ctxt = ctxt.rewards + let get_fees ctxt = ctxt.fees type error += Undefined_operation_nonce (* `Permanent *) @@ -143,7 +167,7 @@ let () = register_error_kind `Permanent ~id:"undefined_operation_nonce" - ~title: "Ill timed access to the origination nonce" + ~title:"Ill timed access to the origination nonce" ~description: "An origination was attemped out of the scope of a manager operation" empty @@ -152,24 +176,28 @@ let () = let init_origination_nonce ctxt operation_hash = let origination_nonce = - Some (Contract_repr.initial_origination_nonce operation_hash) in - { ctxt with origination_nonce } + Some (Contract_repr.initial_origination_nonce operation_hash) + in + {ctxt with origination_nonce} let origination_nonce ctxt = match ctxt.origination_nonce with - | None -> error Undefined_operation_nonce - | Some origination_nonce -> ok origination_nonce + | None -> + error Undefined_operation_nonce + | Some origination_nonce -> + ok origination_nonce let increment_origination_nonce ctxt = match ctxt.origination_nonce with - | None -> error Undefined_operation_nonce + | None -> + error Undefined_operation_nonce | Some cur_origination_nonce -> let origination_nonce = - Some (Contract_repr.incr_origination_nonce cur_origination_nonce) in - ok ({ ctxt with origination_nonce }, cur_origination_nonce) + Some (Contract_repr.incr_origination_nonce cur_origination_nonce) + in + ok ({ctxt with origination_nonce}, cur_origination_nonce) -let unset_origination_nonce ctxt = - { ctxt with origination_nonce = None } +let unset_origination_nonce ctxt = {ctxt with origination_nonce = None} type error += Gas_limit_too_high (* `Permanent *) @@ -178,71 +206,88 @@ let () = register_error_kind `Permanent ~id:"gas_limit_too_high" - ~title: "Gas limit out of protocol hard bounds" - ~description: - "A transaction tried to exceed the hard limit on gas" + ~title:"Gas limit out of protocol hard bounds" + ~description:"A transaction tried to exceed the hard limit on gas" empty (function Gas_limit_too_high -> Some () | _ -> None) (fun () -> Gas_limit_too_high) let check_gas_limit ctxt remaining = - if Compare.Z.(remaining > ctxt.constants.hard_gas_limit_per_operation) - || Compare.Z.(remaining < Z.zero) then - error Gas_limit_too_high - else - ok () + if + Compare.Z.(remaining > ctxt.constants.hard_gas_limit_per_operation) + || Compare.Z.(remaining < Z.zero) + then error Gas_limit_too_high + else ok () + let set_gas_limit ctxt remaining = - { ctxt with operation_gas = Limited { remaining } ; - internal_gas = Gas_limit_repr.internal_gas_zero } -let set_gas_unlimited ctxt = - { ctxt with operation_gas = Unaccounted } + { + ctxt with + operation_gas = Limited {remaining}; + internal_gas = Gas_limit_repr.internal_gas_zero; + } + +let set_gas_unlimited ctxt = {ctxt with operation_gas = Unaccounted} + let consume_gas ctxt cost = Gas_limit_repr.consume ctxt.block_gas ctxt.operation_gas ctxt.internal_gas - cost >>? fun (block_gas, operation_gas, internal_gas) -> - ok { ctxt with block_gas ; operation_gas ; internal_gas } + cost + >>? fun (block_gas, operation_gas, internal_gas) -> + ok {ctxt with block_gas; operation_gas; internal_gas} + let check_enough_gas ctxt cost = - Gas_limit_repr.check_enough ctxt.block_gas ctxt.operation_gas ctxt.internal_gas cost + Gas_limit_repr.check_enough + ctxt.block_gas + ctxt.operation_gas + ctxt.internal_gas + cost + let gas_level ctxt = ctxt.operation_gas + let block_gas_level ctxt = ctxt.block_gas let gas_consumed ~since ~until = - match gas_level since, gas_level until with - | Limited { remaining = before }, Limited { remaining = after } -> Z.sub before after - | _, _ -> Z.zero + match (gas_level since, gas_level until) with + | (Limited {remaining = before}, Limited {remaining = after}) -> + Z.sub before after + | (_, _) -> + Z.zero let init_storage_space_to_pay ctxt = match ctxt.storage_space_to_pay with | Some _ -> assert false | None -> - { ctxt with storage_space_to_pay = Some Z.zero ; allocated_contracts = Some 0 } + { + ctxt with + storage_space_to_pay = Some Z.zero; + allocated_contracts = Some 0; + } let update_storage_space_to_pay ctxt n = match ctxt.storage_space_to_pay with | None -> assert false | Some storage_space_to_pay -> - { ctxt with storage_space_to_pay = Some (Z.add n storage_space_to_pay) } + {ctxt with storage_space_to_pay = Some (Z.add n storage_space_to_pay)} let update_allocated_contracts_count ctxt = match ctxt.allocated_contracts with | None -> assert false | Some allocated_contracts -> - { ctxt with allocated_contracts = Some (succ allocated_contracts) } + {ctxt with allocated_contracts = Some (succ allocated_contracts)} let clear_storage_space_to_pay ctxt = - match ctxt.storage_space_to_pay, ctxt.allocated_contracts with - | None, _ | _, None -> + match (ctxt.storage_space_to_pay, ctxt.allocated_contracts) with + | (None, _) | (_, None) -> assert false - | Some storage_space_to_pay, Some allocated_contracts -> - { ctxt with storage_space_to_pay = None ; - allocated_contracts = None}, - storage_space_to_pay, - allocated_contracts + | (Some storage_space_to_pay, Some allocated_contracts) -> + ( {ctxt with storage_space_to_pay = None; allocated_contracts = None}, + storage_space_to_pay, + allocated_contracts ) type storage_error = | Incompatible_protocol_version of string @@ -252,58 +297,68 @@ type storage_error = let storage_error_encoding = let open Data_encoding in - union [ - case (Tag 0) - ~title:"Incompatible_protocol_version" - (obj1 (req "incompatible_protocol_version" string)) - (function Incompatible_protocol_version arg -> Some arg | _ -> None) - (fun arg -> Incompatible_protocol_version arg) ; - case (Tag 1) - ~title:"Missing_key" - (obj2 - (req "missing_key" (list string)) - (req "function" (string_enum ["get", `Get ; "set", `Set ; "del", `Del ; "copy", `Copy ]))) - (function Missing_key (key, f) -> Some (key, f) | _ -> None) - (fun (key, f) -> Missing_key (key, f)) ; - case (Tag 2) - ~title:"Existing_key" - (obj1 (req "existing_key" (list string))) - (function Existing_key key -> Some key | _ -> None) - (fun key -> Existing_key key) ; - case (Tag 3) - ~title:"Corrupted_data" - (obj1 (req "corrupted_data" (list string))) - (function Corrupted_data key -> Some key | _ -> None) - (fun key -> Corrupted_data key) ; - ] + union + [ case + (Tag 0) + ~title:"Incompatible_protocol_version" + (obj1 (req "incompatible_protocol_version" string)) + (function Incompatible_protocol_version arg -> Some arg | _ -> None) + (fun arg -> Incompatible_protocol_version arg); + case + (Tag 1) + ~title:"Missing_key" + (obj2 + (req "missing_key" (list string)) + (req + "function" + (string_enum + [("get", `Get); ("set", `Set); ("del", `Del); ("copy", `Copy)]))) + (function Missing_key (key, f) -> Some (key, f) | _ -> None) + (fun (key, f) -> Missing_key (key, f)); + case + (Tag 2) + ~title:"Existing_key" + (obj1 (req "existing_key" (list string))) + (function Existing_key key -> Some key | _ -> None) + (fun key -> Existing_key key); + case + (Tag 3) + ~title:"Corrupted_data" + (obj1 (req "corrupted_data" (list string))) + (function Corrupted_data key -> Some key | _ -> None) + (fun key -> Corrupted_data key) ] let pp_storage_error ppf = function | Incompatible_protocol_version version -> - Format.fprintf ppf + Format.fprintf + ppf "Found a context with an unexpected version '%s'." version | Missing_key (key, `Get) -> - Format.fprintf ppf - "Missing key '%s'." - (String.concat "/" key) + Format.fprintf ppf "Missing key '%s'." (String.concat "/" key) | Missing_key (key, `Set) -> - Format.fprintf ppf + Format.fprintf + ppf "Cannot set undefined key '%s'." (String.concat "/" key) | Missing_key (key, `Del) -> - Format.fprintf ppf + Format.fprintf + ppf "Cannot delete undefined key '%s'." (String.concat "/" key) | Missing_key (key, `Copy) -> - Format.fprintf ppf + Format.fprintf + ppf "Cannot copy undefined key '%s'." (String.concat "/" key) | Existing_key key -> - Format.fprintf ppf + Format.fprintf + ppf "Cannot initialize defined key '%s'." (String.concat "/" key) | Corrupted_data key -> - Format.fprintf ppf + Format.fprintf + ppf "Failed to parse the data at '%s'." (String.concat "/" key) @@ -313,14 +368,12 @@ let () = register_error_kind `Permanent ~id:"context.storage_error" - ~title: "Storage error (fatal internal error)" + ~title:"Storage error (fatal internal error)" ~description: - "An error that should never happen unless something \ - has been deleted or corrupted in the database." + "An error that should never happen unless something has been deleted or \ + corrupted in the database." ~pp:(fun ppf err -> - Format.fprintf ppf - "@[Storage error:@ %a@]" - pp_storage_error err) + Format.fprintf ppf "@[Storage error:@ %a@]" pp_storage_error err) storage_error_encoding (function Storage_error err -> Some err | _ -> None) (fun err -> Storage_error err) @@ -330,244 +383,275 @@ let storage_error err = fail (Storage_error err) (* Initialization *********************************************************) (* This key should always be populated for every version of the - protocol. Its absence meaning that the context is empty. *) + protocol. It's absence meaning that the context is empty. *) let version_key = ["version"] -let version_value = "babylon_005" + +let version_value = "carthage_006" let version = "v1" -let first_level_key = [ version ; "first_level" ] -let constants_key = [ version ; "constants" ] -let protocol_param_key = [ "protocol_parameters" ] + +let first_level_key = [version; "first_level"] + +let constants_key = [version; "constants"] + +let protocol_param_key = ["protocol_parameters"] let get_first_level ctxt = - Context.get ctxt first_level_key >>= function - | None -> storage_error (Missing_key (first_level_key, `Get)) - | Some bytes -> - match - Data_encoding.Binary.of_bytes Raw_level_repr.encoding bytes - with - | None -> storage_error (Corrupted_data first_level_key) - | Some level -> return level + Context.get ctxt first_level_key + >>= function + | None -> + storage_error (Missing_key (first_level_key, `Get)) + | Some bytes -> ( + match Data_encoding.Binary.of_bytes Raw_level_repr.encoding bytes with + | None -> + storage_error (Corrupted_data first_level_key) + | Some level -> + return level ) let set_first_level ctxt level = let bytes = - Data_encoding.Binary.to_bytes_exn Raw_level_repr.encoding level in - Context.set ctxt first_level_key bytes >>= fun ctxt -> - return ctxt + Data_encoding.Binary.to_bytes_exn Raw_level_repr.encoding level + in + Context.set ctxt first_level_key bytes >>= fun ctxt -> return ctxt type error += Failed_to_parse_parameter of MBytes.t + type error += Failed_to_decode_parameter of Data_encoding.json * string let () = register_error_kind `Temporary ~id:"context.failed_to_parse_parameter" - ~title: "Failed to parse parameter" - ~description: - "The protocol parameters are not valid JSON." - ~pp:begin fun ppf bytes -> - Format.fprintf ppf + ~title:"Failed to parse parameter" + ~description:"The protocol parameters are not valid JSON." + ~pp:(fun ppf bytes -> + Format.fprintf + ppf "@[Cannot parse the protocol parameter:@ %s@]" - (MBytes.to_string bytes) - end + (MBytes.to_string bytes)) Data_encoding.(obj1 (req "contents" bytes)) (function Failed_to_parse_parameter data -> Some data | _ -> None) (fun data -> Failed_to_parse_parameter data) ; register_error_kind `Temporary ~id:"context.failed_to_decode_parameter" - ~title: "Failed to decode parameter" - ~description: - "Unexpected JSON object." - ~pp:begin fun ppf (json, msg) -> - Format.fprintf ppf + ~title:"Failed to decode parameter" + ~description:"Unexpected JSON object." + ~pp:(fun ppf (json, msg) -> + Format.fprintf + ppf "@[Cannot decode the protocol parameter:@ %s@ %a@]" msg - Data_encoding.Json.pp json - end - Data_encoding.(obj2 - (req "contents" json) - (req "error" string)) + Data_encoding.Json.pp + json) + Data_encoding.(obj2 (req "contents" json) (req "error" string)) (function - | Failed_to_decode_parameter (json, msg) -> Some (json, msg) - | _ -> None) + | Failed_to_decode_parameter (json, msg) -> Some (json, msg) | _ -> None) (fun (json, msg) -> Failed_to_decode_parameter (json, msg)) let get_proto_param ctxt = - Context.get ctxt protocol_param_key >>= function + Context.get ctxt protocol_param_key + >>= function | None -> failwith "Missing protocol parameters." - | Some bytes -> - match Data_encoding.Binary.of_bytes Data_encoding.json bytes with - | None -> fail (Failed_to_parse_parameter bytes) - | Some json -> begin - Context.del ctxt protocol_param_key >>= fun ctxt -> - match Data_encoding.Json.destruct Parameters_repr.encoding json with - | exception (Data_encoding.Json.Cannot_destruct _ as exn) -> - Format.kasprintf - failwith "Invalid protocol_parameters: %a %a" - (fun ppf -> Data_encoding.Json.print_error ppf) exn - Data_encoding.Json.pp json - | param -> return (param, ctxt) - end + | Some bytes -> ( + match Data_encoding.Binary.of_bytes Data_encoding.json bytes with + | None -> + fail (Failed_to_parse_parameter bytes) + | Some json -> ( + Context.del ctxt protocol_param_key + >>= fun ctxt -> + match Data_encoding.Json.destruct Parameters_repr.encoding json with + | exception (Data_encoding.Json.Cannot_destruct _ as exn) -> + Format.kasprintf + failwith + "Invalid protocol_parameters: %a %a" + (fun ppf -> Data_encoding.Json.print_error ppf) + exn + Data_encoding.Json.pp + json + | param -> + return (param, ctxt) ) ) let set_constants ctxt constants = let bytes = Data_encoding.Binary.to_bytes_exn - Constants_repr.parametric_encoding constants in + Constants_repr.parametric_encoding + constants + in Context.set ctxt constants_key bytes let get_constants ctxt = - Context.get ctxt constants_key >>= function + Context.get ctxt constants_key + >>= function | None -> failwith "Internal error: cannot read constants in context." - | Some bytes -> - match - Data_encoding.Binary.of_bytes Constants_repr.parametric_encoding bytes - with - | None -> - failwith "Internal error: cannot parse constants in context." - | Some constants -> return constants + | Some bytes -> ( + match + Data_encoding.Binary.of_bytes Constants_repr.parametric_encoding bytes + with + | None -> + failwith "Internal error: cannot parse constants in context." + | Some constants -> + return constants ) -(* only for migration from 004 to 005 *) -let get_004_constants ctxt = - Context.get ctxt constants_key >>= function +(* only for migration from 005 to 006 *) +let get_005_constants ctxt = + Context.get ctxt constants_key + >>= function | None -> - failwith "Internal error: cannot read constants in context." - | Some bytes -> - match - Data_encoding.Binary.of_bytes Parameters_repr.Proto_004.constants_encoding bytes - with - | None -> - failwith "Internal error: cannot parse constants in context." - | Some constants -> return constants + failwith "Internal error: cannot read 005 constants in context." + | Some bytes -> ( + match + Data_encoding.Binary.of_bytes + Constants_repr.Proto_005.parametric_encoding + bytes + with + | None -> + failwith "Internal error: cannot parse 005 constants in context." + | Some constants -> + return constants ) let patch_constants ctxt f = let constants = f ctxt.constants in - set_constants ctxt.context constants >>= fun context -> - Lwt.return { ctxt with context ; constants } + set_constants ctxt.context constants + >>= fun context -> Lwt.return {ctxt with context; constants} let check_inited ctxt = - Context.get ctxt version_key >>= function + Context.get ctxt version_key + >>= function | None -> failwith "Internal error: un-initialized context." | Some bytes -> let s = MBytes.to_string bytes in - if Compare.String.(s = version_value) then - return_unit - else - storage_error (Incompatible_protocol_version s) + if Compare.String.(s = version_value) then return_unit + else storage_error (Incompatible_protocol_version s) let prepare ~level ~predecessor_timestamp ~timestamp ~fitness ctxt = - Lwt.return (Raw_level_repr.of_int32 level) >>=? fun level -> - Lwt.return (Fitness_repr.to_int64 fitness) >>=? fun fitness -> - check_inited ctxt >>=? fun () -> - get_constants ctxt >>=? fun constants -> - get_first_level ctxt >>=? fun first_level -> + Lwt.return (Raw_level_repr.of_int32 level) + >>=? fun level -> + Lwt.return (Fitness_repr.to_int64 fitness) + >>=? fun fitness -> + check_inited ctxt + >>=? fun () -> + get_constants ctxt + >>=? fun constants -> + get_first_level ctxt + >>=? fun first_level -> let level = Level_repr.from_raw ~first_level ~blocks_per_cycle:constants.Constants_repr.blocks_per_cycle - ~blocks_per_voting_period:constants.Constants_repr.blocks_per_voting_period + ~blocks_per_voting_period: + constants.Constants_repr.blocks_per_voting_period ~blocks_per_commitment:constants.Constants_repr.blocks_per_commitment - level in - return { - context = ctxt ; constants ; level ; - predecessor_timestamp ; - timestamp ; fitness ; first_level ; - allowed_endorsements = Signature.Public_key_hash.Map.empty ; - included_endorsements = 0 ; - fees = Tez_repr.zero ; - rewards = Tez_repr.zero ; - deposits = Signature.Public_key_hash.Map.empty ; - operation_gas = Unaccounted ; - internal_gas = Gas_limit_repr.internal_gas_zero ; - storage_space_to_pay = None ; - allocated_contracts = None ; - block_gas = constants.Constants_repr.hard_gas_limit_per_block ; - origination_nonce = None ; - temporary_big_map = Z.sub Z.zero Z.one ; - internal_nonce = 0 ; - internal_nonces_used = Int_set.empty ; - } + level + in + return + { + context = ctxt; + constants; + level; + predecessor_timestamp; + timestamp; + fitness; + first_level; + allowed_endorsements = Signature.Public_key_hash.Map.empty; + included_endorsements = 0; + fees = Tez_repr.zero; + rewards = Tez_repr.zero; + deposits = Signature.Public_key_hash.Map.empty; + operation_gas = Unaccounted; + internal_gas = Gas_limit_repr.internal_gas_zero; + storage_space_to_pay = None; + allocated_contracts = None; + block_gas = constants.Constants_repr.hard_gas_limit_per_block; + origination_nonce = None; + temporary_big_map = Z.sub Z.zero Z.one; + internal_nonce = 0; + internal_nonces_used = Int_set.empty; + } -type previous_protocol = - | Genesis of Parameters_repr.t - | Athens_004 +type previous_protocol = Genesis of Parameters_repr.t | Babylon_005 let check_and_update_protocol_version ctxt = - begin - Context.get ctxt version_key >>= function - | None -> - failwith "Internal error: un-initialized context in check_first_block." - | Some bytes -> - let s = MBytes.to_string bytes in - if Compare.String.(s = version_value) then - failwith "Internal error: previously initialized context." - else if Compare.String.(s = "genesis") then - get_proto_param ctxt >>=? fun (param, ctxt) -> - return (Genesis param, ctxt) - else if Compare.String.(s = "athens_004") then - return (Athens_004, ctxt) - else - storage_error (Incompatible_protocol_version s) - end >>=? fun (previous_proto, ctxt) -> - Context.set ctxt version_key - (MBytes.of_string version_value) >>= fun ctxt -> - return (previous_proto, ctxt) + Context.get ctxt version_key + >>= (function + | None -> + failwith + "Internal error: un-initialized context in check_first_block." + | Some bytes -> + let s = MBytes.to_string bytes in + if Compare.String.(s = version_value) then + failwith "Internal error: previously initialized context." + else if Compare.String.(s = "genesis") then + get_proto_param ctxt + >>=? fun (param, ctxt) -> return (Genesis param, ctxt) + else if Compare.String.(s = "babylon_005") then + return (Babylon_005, ctxt) + else storage_error (Incompatible_protocol_version s)) + >>=? fun (previous_proto, ctxt) -> + Context.set ctxt version_key (MBytes.of_string version_value) + >>= fun ctxt -> return (previous_proto, ctxt) let prepare_first_block ~level ~timestamp ~fitness ctxt = - check_and_update_protocol_version ctxt >>=? fun (previous_proto, ctxt) -> - begin - match previous_proto with - | Genesis param -> - Lwt.return (Raw_level_repr.of_int32 level) >>=? fun first_level -> - set_first_level ctxt first_level >>=? fun ctxt -> - set_constants ctxt param.constants >>= fun ctxt -> - return ctxt - | Athens_004 -> - get_004_constants ctxt >>=? fun c -> - let constants = Constants_repr.{ - preserved_cycles = c.preserved_cycles ; - blocks_per_cycle = c.blocks_per_cycle ; - blocks_per_commitment = c.blocks_per_commitment ; - blocks_per_roll_snapshot = c.blocks_per_roll_snapshot ; - blocks_per_voting_period = c.blocks_per_voting_period ; - time_between_blocks = - List.map Period_repr.of_seconds_exn [ 60L ; 40L ] ; - endorsers_per_block = c.endorsers_per_block ; - hard_gas_limit_per_operation = c.hard_gas_limit_per_operation ; - hard_gas_limit_per_block = c.hard_gas_limit_per_block ; - proof_of_work_threshold = c.proof_of_work_threshold ; - tokens_per_roll = c.tokens_per_roll ; + check_and_update_protocol_version ctxt + >>=? fun (previous_proto, ctxt) -> + ( match previous_proto with + | Genesis param -> + Lwt.return (Raw_level_repr.of_int32 level) + >>=? fun first_level -> + set_first_level ctxt first_level + >>=? fun ctxt -> + set_constants ctxt param.constants >>= fun ctxt -> return ctxt + | Babylon_005 -> + get_005_constants ctxt + >>=? fun c -> + let constants = + Constants_repr. + { + preserved_cycles = c.preserved_cycles; + blocks_per_cycle = c.blocks_per_cycle; + blocks_per_commitment = c.blocks_per_commitment; + blocks_per_roll_snapshot = c.blocks_per_roll_snapshot; + blocks_per_voting_period = c.blocks_per_voting_period; + time_between_blocks = c.time_between_blocks; + endorsers_per_block = c.endorsers_per_block; + hard_gas_limit_per_operation = Z.of_int 1_040_000; + hard_gas_limit_per_block = Z.of_int 10_400_000; + proof_of_work_threshold = c.proof_of_work_threshold; + tokens_per_roll = c.tokens_per_roll; michelson_maximum_type_size = c.michelson_maximum_type_size; - seed_nonce_revelation_tip = c.seed_nonce_revelation_tip ; - origination_size = c.origination_size ; - block_security_deposit = c.block_security_deposit ; - endorsement_security_deposit = c.endorsement_security_deposit ; - block_reward = c.block_reward ; - endorsement_reward = c.endorsement_reward ; - cost_per_byte = c.cost_per_byte ; - hard_storage_limit_per_operation = c.hard_storage_limit_per_operation ; - test_chain_duration = c.test_chain_duration ; - quorum_min = 20_00l ; (* quorum is in centile of a percentage *) - quorum_max = 70_00l ; - min_proposal_quorum = 5_00l ; - initial_endorsers = 24 ; - delay_per_missing_endorsement = Period_repr.of_seconds_exn 8L ; - } in - set_constants ctxt constants >>= fun ctxt -> - return ctxt - end >>=? fun ctxt -> - prepare ctxt ~level ~predecessor_timestamp:timestamp ~timestamp ~fitness >>=? fun ctxt -> - return (previous_proto, ctxt) + seed_nonce_revelation_tip = c.seed_nonce_revelation_tip; + origination_size = c.origination_size; + block_security_deposit = c.block_security_deposit; + endorsement_security_deposit = c.endorsement_security_deposit; + baking_reward_per_endorsement = + Tez_repr.[of_mutez_exn 1_250_000L; of_mutez_exn 187_500L]; + endorsement_reward = + Tez_repr.[of_mutez_exn 1_250_000L; of_mutez_exn 833_333L]; + cost_per_byte = c.cost_per_byte; + hard_storage_limit_per_operation = + c.hard_storage_limit_per_operation; + test_chain_duration = c.test_chain_duration; + quorum_min = c.quorum_min; + quorum_max = c.quorum_max; + min_proposal_quorum = c.min_proposal_quorum; + initial_endorsers = c.initial_endorsers; + delay_per_missing_endorsement = c.delay_per_missing_endorsement; + } + in + set_constants ctxt constants >>= fun ctxt -> return ctxt ) + >>=? fun ctxt -> + prepare ctxt ~level ~predecessor_timestamp:timestamp ~timestamp ~fitness + >>=? fun ctxt -> return (previous_proto, ctxt) -let activate ({ context = c ; _ } as s) h = - Updater.activate c h >>= fun c -> Lwt.return { s with context = c } +let activate ({context = c; _} as s) h = + Updater.activate c h >>= fun c -> Lwt.return {s with context = c} -let fork_test_chain ({ context = c ; _ } as s) protocol expiration = - Updater.fork_test_chain c ~protocol ~expiration >>= fun c -> - Lwt.return { s with context = c } +let fork_test_chain ({context = c; _} as s) protocol expiration = + Updater.fork_test_chain c ~protocol ~expiration + >>= fun c -> Lwt.return {s with context = c} (* Generic context ********************************************************) @@ -576,112 +660,129 @@ type key = string list type value = MBytes.t module type T = sig - type t + type context = t - val mem: context -> key -> bool Lwt.t - val dir_mem: context -> key -> bool Lwt.t - val get: context -> key -> value tzresult Lwt.t - val get_option: context -> key -> value option Lwt.t - val init: context -> key -> value -> context tzresult Lwt.t - val set: context -> key -> value -> context tzresult Lwt.t - val init_set: context -> key -> value -> context Lwt.t - val set_option: context -> key -> value option -> context Lwt.t - val delete: context -> key -> context tzresult Lwt.t - val remove: context -> key -> context Lwt.t - val remove_rec: context -> key -> context Lwt.t - val copy: context -> from:key -> to_:key -> context tzresult Lwt.t + val mem : context -> key -> bool Lwt.t - val fold: - context -> key -> init:'a -> - f:([ `Key of key | `Dir of key ] -> 'a -> 'a Lwt.t) -> + val dir_mem : context -> key -> bool Lwt.t + + val get : context -> key -> value tzresult Lwt.t + + val get_option : context -> key -> value option Lwt.t + + val init : context -> key -> value -> context tzresult Lwt.t + + val set : context -> key -> value -> context tzresult Lwt.t + + val init_set : context -> key -> value -> context Lwt.t + + val set_option : context -> key -> value option -> context Lwt.t + + val delete : context -> key -> context tzresult Lwt.t + + val remove : context -> key -> context Lwt.t + + val remove_rec : context -> key -> context Lwt.t + + val copy : context -> from:key -> to_:key -> context tzresult Lwt.t + + val fold : + context -> + key -> + init:'a -> + f:([`Key of key | `Dir of key] -> 'a -> 'a Lwt.t) -> 'a Lwt.t - val keys: context -> key -> key list Lwt.t + val keys : context -> key -> key list Lwt.t - val fold_keys: + val fold_keys : context -> key -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t - val project: context -> root_context + val project : context -> root_context - val absolute_key: context -> key -> key + val absolute_key : context -> key -> key - val consume_gas: context -> Gas_limit_repr.cost -> context tzresult + val consume_gas : context -> Gas_limit_repr.cost -> context tzresult - val check_enough_gas: context -> Gas_limit_repr.cost -> unit tzresult - - val description: context Storage_description.t + val check_enough_gas : context -> Gas_limit_repr.cost -> unit tzresult + val description : context Storage_description.t end let mem ctxt k = Context.mem ctxt.context k + let dir_mem ctxt k = Context.dir_mem ctxt.context k let get ctxt k = - Context.get ctxt.context k >>= function - | None -> storage_error (Missing_key (k, `Get)) - | Some v -> return v - -let get_option ctxt k = Context.get ctxt.context k + >>= function + | None -> storage_error (Missing_key (k, `Get)) | Some v -> return v + +let get_option ctxt k = Context.get ctxt.context k (* Verify that the k is present before modifying *) let set ctxt k v = - Context.mem ctxt.context k >>= function - | false -> storage_error (Missing_key (k, `Set)) + Context.mem ctxt.context k + >>= function + | false -> + storage_error (Missing_key (k, `Set)) | true -> - Context.set ctxt.context k v >>= fun context -> - return { ctxt with context } + Context.set ctxt.context k v + >>= fun context -> return {ctxt with context} (* Verify that the k is not present before inserting *) let init ctxt k v = - Context.mem ctxt.context k >>= function - | true -> storage_error (Existing_key k) + Context.mem ctxt.context k + >>= function + | true -> + storage_error (Existing_key k) | false -> - Context.set ctxt.context k v >>= fun context -> - return { ctxt with context } + Context.set ctxt.context k v + >>= fun context -> return {ctxt with context} (* Does not verify that the key is present or not *) let init_set ctxt k v = - Context.set ctxt.context k v >>= fun context -> - Lwt.return { ctxt with context } + Context.set ctxt.context k v + >>= fun context -> Lwt.return {ctxt with context} (* Verify that the key is present before deleting *) let delete ctxt k = - Context.mem ctxt.context k >>= function - | false -> storage_error (Missing_key (k, `Del)) + Context.mem ctxt.context k + >>= function + | false -> + storage_error (Missing_key (k, `Del)) | true -> - Context.del ctxt.context k >>= fun context -> - return { ctxt with context } + Context.del ctxt.context k >>= fun context -> return {ctxt with context} (* Do not verify before deleting *) let remove ctxt k = - Context.del ctxt.context k >>= fun context -> - Lwt.return { ctxt with context } + Context.del ctxt.context k >>= fun context -> Lwt.return {ctxt with context} let set_option ctxt k = function - | None -> remove ctxt k - | Some v -> init_set ctxt k v + | None -> + remove ctxt k + | Some v -> + init_set ctxt k v let remove_rec ctxt k = - Context.remove_rec ctxt.context k >>= fun context -> - Lwt.return { ctxt with context } + Context.remove_rec ctxt.context k + >>= fun context -> Lwt.return {ctxt with context} let copy ctxt ~from ~to_ = - Context.copy ctxt.context ~from ~to_ >>= function - | None -> storage_error (Missing_key (from, `Copy)) + Context.copy ctxt.context ~from ~to_ + >>= function + | None -> + storage_error (Missing_key (from, `Copy)) | Some context -> - return { ctxt with context } + return {ctxt with context} -let fold ctxt k ~init ~f = - Context.fold ctxt.context k ~init ~f +let fold ctxt k ~init ~f = Context.fold ctxt.context k ~init ~f -let keys ctxt k = - Context.keys ctxt.context k +let keys ctxt k = Context.keys ctxt.context k -let fold_keys ctxt k ~init ~f = - Context.fold_keys ctxt.context k ~init ~f +let fold_keys ctxt k ~init ~f = Context.fold_keys ctxt.context k ~init ~f let project x = x @@ -690,17 +791,15 @@ let absolute_key _ k = k let description = Storage_description.create () let fresh_temporary_big_map ctxt = - { ctxt with temporary_big_map = Z.sub ctxt.temporary_big_map Z.one }, - ctxt.temporary_big_map + ( {ctxt with temporary_big_map = Z.sub ctxt.temporary_big_map Z.one}, + ctxt.temporary_big_map ) let reset_temporary_big_map ctxt = - { ctxt with temporary_big_map = Z.sub Z.zero Z.one } + {ctxt with temporary_big_map = Z.sub Z.zero Z.one} let temporary_big_maps ctxt f acc = let rec iter acc id = - if Z.equal id ctxt.temporary_big_map then - Lwt.return acc - else - f acc id >>= fun acc -> - iter acc (Z.sub id Z.one) in + if Z.equal id ctxt.temporary_big_map then Lwt.return acc + else f acc id >>= fun acc -> iter acc (Z.sub id Z.one) + in iter acc (Z.sub Z.zero Z.one) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/raw_context.mli b/vendors/ligo-utils/tezos-protocol-alpha/raw_context.mli index 749878b6c..b004d6a06 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/raw_context.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/raw_context.mli @@ -35,125 +35,152 @@ type storage_error = | Corrupted_data of string list type error += Storage_error of storage_error + type error += Failed_to_parse_parameter of MBytes.t + type error += Failed_to_decode_parameter of Data_encoding.json * string -val storage_error: storage_error -> 'a tzresult Lwt.t +val storage_error : storage_error -> 'a tzresult Lwt.t (** {1 Abstract Context} *) (** Abstract view of the context. Includes a handle to the functional key-value database ({!Context.t}) along with some in-memory values (gas, etc.). *) + module Int_set : sig type t end type t = { - context: Context.t ; - constants: Constants_repr.parametric ; - first_level: Raw_level_repr.t ; - level: Level_repr.t ; - predecessor_timestamp: Time.t ; - timestamp: Time.t ; - fitness: Int64.t ; - deposits: Tez_repr.t Signature.Public_key_hash.Map.t ; - included_endorsements: int ; - allowed_endorsements: - (Signature.Public_key.t * int list * bool) Signature.Public_key_hash.Map.t ; - fees: Tez_repr.t ; - rewards: Tez_repr.t ; - block_gas: Z.t ; - operation_gas: Gas_limit_repr.t ; - internal_gas: Gas_limit_repr.internal_gas ; - storage_space_to_pay: Z.t option ; - allocated_contracts: int option ; - origination_nonce: Contract_repr.origination_nonce option ; - temporary_big_map: Z.t ; - internal_nonce: int ; - internal_nonces_used: Int_set.t ; + context : Context.t; + constants : Constants_repr.parametric; + first_level : Raw_level_repr.t; + level : Level_repr.t; + predecessor_timestamp : Time.t; + timestamp : Time.t; + fitness : Int64.t; + deposits : Tez_repr.t Signature.Public_key_hash.Map.t; + included_endorsements : int; + allowed_endorsements : + (Signature.Public_key.t * int list * bool) Signature.Public_key_hash.Map.t; + fees : Tez_repr.t; + rewards : Tez_repr.t; + block_gas : Z.t; + operation_gas : Gas_limit_repr.t; + internal_gas : Gas_limit_repr.internal_gas; + storage_space_to_pay : Z.t option; + allocated_contracts : int option; + origination_nonce : Contract_repr.origination_nonce option; + temporary_big_map : Z.t; + internal_nonce : int; + internal_nonces_used : Int_set.t; } type context = t + type root_context = t (** Retrieves the state of the database and gives its abstract view. It also returns wether this is the first block validated with this version of the protocol. *) -val prepare: - level: Int32.t -> - predecessor_timestamp: Time.t -> - timestamp: Time.t -> - fitness: Fitness.t -> - Context.t -> context tzresult Lwt.t +val prepare : + level:Int32.t -> + predecessor_timestamp:Time.t -> + timestamp:Time.t -> + fitness:Fitness.t -> + Context.t -> + context tzresult Lwt.t -type previous_protocol = - | Genesis of Parameters_repr.t - | Athens_004 +type previous_protocol = Genesis of Parameters_repr.t | Babylon_005 -val prepare_first_block: +val prepare_first_block : level:int32 -> timestamp:Time.t -> fitness:Fitness.t -> - Context.t -> (previous_protocol * context) tzresult Lwt.t + Context.t -> + (previous_protocol * context) tzresult Lwt.t -val activate: context -> Protocol_hash.t -> t Lwt.t -val fork_test_chain: context -> Protocol_hash.t -> Time.t -> t Lwt.t +val activate : context -> Protocol_hash.t -> t Lwt.t + +val fork_test_chain : context -> Protocol_hash.t -> Time.t -> t Lwt.t (** Returns the state of the database resulting of operations on its abstract view *) -val recover: context -> Context.t +val recover : context -> Context.t -val current_level: context -> Level_repr.t -val predecessor_timestamp: context -> Time.t -val current_timestamp: context -> Time.t +val current_level : context -> Level_repr.t -val current_fitness: context -> Int64.t -val set_current_fitness: context -> Int64.t -> t +val predecessor_timestamp : context -> Time.t -val constants: context -> Constants_repr.parametric -val patch_constants: +val current_timestamp : context -> Time.t + +val current_fitness : context -> Int64.t + +val set_current_fitness : context -> Int64.t -> t + +val constants : context -> Constants_repr.parametric + +val patch_constants : context -> (Constants_repr.parametric -> Constants_repr.parametric) -> context Lwt.t -val first_level: context -> Raw_level_repr.t + +val first_level : context -> Raw_level_repr.t (** Increment the current block fee stash that will be credited to baker's frozen_fees account at finalize_application *) -val add_fees: context -> Tez_repr.t -> context tzresult Lwt.t +val add_fees : context -> Tez_repr.t -> context tzresult Lwt.t (** Increment the current block reward stash that will be credited to baker's frozen_fees account at finalize_application *) -val add_rewards: context -> Tez_repr.t -> context tzresult Lwt.t +val add_rewards : context -> Tez_repr.t -> context tzresult Lwt.t (** Increment the current block deposit stash for a specific delegate. All the delegates' frozen_deposit accounts are credited at finalize_application *) -val add_deposit: - context -> Signature.Public_key_hash.t -> Tez_repr.t -> context tzresult Lwt.t +val add_deposit : + context -> + Signature.Public_key_hash.t -> + Tez_repr.t -> + context tzresult Lwt.t -val get_fees: context -> Tez_repr.t -val get_rewards: context -> Tez_repr.t -val get_deposits: context -> Tez_repr.t Signature.Public_key_hash.Map.t +val get_fees : context -> Tez_repr.t + +val get_rewards : context -> Tez_repr.t + +val get_deposits : context -> Tez_repr.t Signature.Public_key_hash.Map.t type error += Gas_limit_too_high (* `Permanent *) -val check_gas_limit: t -> Z.t -> unit tzresult -val set_gas_limit: t -> Z.t -> t -val set_gas_unlimited: t -> t -val gas_level: t -> Gas_limit_repr.t -val gas_consumed: since: t -> until: t -> Z.t -val block_gas_level: t -> Z.t +val check_gas_limit : t -> Z.t -> unit tzresult -val init_storage_space_to_pay: t -> t -val update_storage_space_to_pay: t -> Z.t -> t -val update_allocated_contracts_count: t -> t -val clear_storage_space_to_pay: t -> t * Z.t * int +val set_gas_limit : t -> Z.t -> t + +val set_gas_unlimited : t -> t + +val gas_level : t -> Gas_limit_repr.t + +val gas_consumed : since:t -> until:t -> Z.t + +val block_gas_level : t -> Z.t + +val init_storage_space_to_pay : t -> t + +val update_storage_space_to_pay : t -> Z.t -> t + +val update_allocated_contracts_count : t -> t + +val clear_storage_space_to_pay : t -> t * Z.t * int type error += Undefined_operation_nonce (* `Permanent *) -val init_origination_nonce: t -> Operation_hash.t -> t -val origination_nonce: t -> Contract_repr.origination_nonce tzresult -val increment_origination_nonce: t -> (t * Contract_repr.origination_nonce) tzresult -val unset_origination_nonce: t -> t +val init_origination_nonce : t -> Operation_hash.t -> t + +val origination_nonce : t -> Contract_repr.origination_nonce tzresult + +val increment_origination_nonce : + t -> (t * Contract_repr.origination_nonce) tzresult + +val unset_origination_nonce : t -> t (** {1 Generic accessors} *) @@ -165,127 +192,127 @@ type value = MBytes.t as-is for direct context accesses, and used in {!Storage_functors} to provide restricted views to the context. *) module type T = sig - type t + type context = t (** Tells if the key is already defined as a value. *) - val mem: context -> key -> bool Lwt.t + val mem : context -> key -> bool Lwt.t (** Tells if the key is already defined as a directory. *) - val dir_mem: context -> key -> bool Lwt.t + val dir_mem : context -> key -> bool Lwt.t (** Retrieve the value from the storage bucket ; returns a {!Storage_error Missing_key} if the key is not set. *) - val get: context -> key -> value tzresult Lwt.t + val get : context -> key -> value tzresult Lwt.t (** Retrieves the value from the storage bucket ; returns [None] if the data is not initialized. *) - val get_option: context -> key -> value option Lwt.t + val get_option : context -> key -> value option Lwt.t (** Allocates the storage bucket and initializes it ; returns a {!Storage_error Existing_key} if the bucket exists. *) - val init: context -> key -> value -> context tzresult Lwt.t + val init : context -> key -> value -> context tzresult Lwt.t (** Updates the content of the bucket ; returns a {!Storage_error Missing_key} if the value does not exists. *) - val set: context -> key -> value -> context tzresult Lwt.t + val set : context -> key -> value -> context tzresult Lwt.t (** Allocates the data and initializes it with a value ; just updates it if the bucket exists. *) - val init_set: context -> key -> value -> context Lwt.t + val init_set : context -> key -> value -> context Lwt.t (** When the value is [Some v], allocates the data and initializes it with [v] ; just updates it if the bucket exists. When the valus is [None], delete the storage bucket when the value ; does nothing if the bucket does not exists. *) - val set_option: context -> key -> value option -> context Lwt.t + val set_option : context -> key -> value option -> context Lwt.t (** Delete the storage bucket ; returns a {!Storage_error Missing_key} if the bucket does not exists. *) - val delete: context -> key -> context tzresult Lwt.t + val delete : context -> key -> context tzresult Lwt.t (** Removes the storage bucket and its contents ; does nothing if the bucket does not exists. *) - val remove: context -> key -> context Lwt.t + val remove : context -> key -> context Lwt.t (** Recursively removes all the storage buckets and contents ; does nothing if no bucket exists. *) - val remove_rec: context -> key -> context Lwt.t + val remove_rec : context -> key -> context Lwt.t - val copy: context -> from:key -> to_:key -> context tzresult Lwt.t + val copy : context -> from:key -> to_:key -> context tzresult Lwt.t (** Iterator on all the items of a given directory. *) - val fold: - context -> key -> init:'a -> - f:([ `Key of key | `Dir of key ] -> 'a -> 'a Lwt.t) -> + val fold : + context -> + key -> + init:'a -> + f:([`Key of key | `Dir of key] -> 'a -> 'a Lwt.t) -> 'a Lwt.t (** Recursively list all subkeys of a given key. *) - val keys: context -> key -> key list Lwt.t + val keys : context -> key -> key list Lwt.t (** Recursive iterator on all the subkeys of a given key. *) - val fold_keys: + val fold_keys : context -> key -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t (** Internally used in {!Storage_functors} to escape from a view. *) - val project: context -> root_context + val project : context -> root_context (** Internally used in {!Storage_functors} to retrieve a full key from partial key relative a view. *) - val absolute_key: context -> key -> key + val absolute_key : context -> key -> key (** Internally used in {!Storage_functors} to consume gas from within a view. *) - val consume_gas: context -> Gas_limit_repr.cost -> context tzresult + val consume_gas : context -> Gas_limit_repr.cost -> context tzresult (** Check if consume_gas will fail *) - val check_enough_gas: context -> Gas_limit_repr.cost -> unit tzresult - - val description: context Storage_description.t + val check_enough_gas : context -> Gas_limit_repr.cost -> unit tzresult + val description : context Storage_description.t end include T with type t := t and type context := context (** Initialize the local nonce used for preventing a script to duplicate an internal operation to replay it. *) -val reset_internal_nonce: context -> context +val reset_internal_nonce : context -> context (** Increments the internal operation nonce. *) -val fresh_internal_nonce: context -> (context * int) tzresult +val fresh_internal_nonce : context -> (context * int) tzresult (** Mark an internal operation nonce as taken. *) -val record_internal_nonce: context -> int -> context +val record_internal_nonce : context -> int -> context (** Check is the internal operation nonce has been taken. *) -val internal_nonce_already_recorded: context -> int -> bool +val internal_nonce_already_recorded : context -> int -> bool (** Returns a map where to each endorser's pkh is associated the list of its endorsing slots (in decreasing order) for a given level. *) -val allowed_endorsements: +val allowed_endorsements : context -> (Signature.Public_key.t * int list * bool) Signature.Public_key_hash.Map.t (** Keep track of the number of endorsements that are included in a block *) -val included_endorsements: context -> int +val included_endorsements : context -> int (** Initializes the map of allowed endorsements, this function must only be called once. *) -val init_endorsements: +val init_endorsements : context -> (Signature.Public_key.t * int list * bool) Signature.Public_key_hash.Map.t -> context (** Marks an endorsment in the map as used. *) -val record_endorsement: - context -> Signature.Public_key_hash.t -> context +val record_endorsement : context -> Signature.Public_key_hash.t -> context (** Provide a fresh identifier for a temporary big map (negative index). *) -val fresh_temporary_big_map: context -> context * Z.t +val fresh_temporary_big_map : context -> context * Z.t (** Reset the temporary big_map identifier generator to [-1]. *) -val reset_temporary_big_map: context -> context +val reset_temporary_big_map : context -> context (** Iterate over all created temporary big maps since the last {!reset_temporary_big_map}. *) -val temporary_big_maps: context -> ('a -> Z.t -> 'a Lwt.t) -> 'a -> 'a Lwt.t +val temporary_big_maps : context -> ('a -> Z.t -> 'a Lwt.t) -> 'a -> 'a Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.ml index 16b4f2d62..b5953a94e 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.ml @@ -24,37 +24,43 @@ (*****************************************************************************) type t = int32 + type raw_level = t + include (Compare.Int32 : Compare.S with type t := t) + let encoding = Data_encoding.int32 + let pp ppf level = Format.fprintf ppf "%ld" level + let rpc_arg = let construct raw_level = Int32.to_string raw_level in let destruct str = match Int32.of_string str with - | exception _ -> Error "Cannot parse level" - | raw_level -> Ok raw_level in + | exception _ -> + Error "Cannot parse level" + | raw_level -> + Ok raw_level + in RPC_arg.make ~descr:"A level integer" - ~name: "block_level" + ~name:"block_level" ~construct ~destruct () let root = 0l + let succ = Int32.succ -let pred l = - if l = 0l - then None - else Some (Int32.pred l) + +let pred l = if l = 0l then None else Some (Int32.pred l) let diff = Int32.sub let to_int32 l = l + let of_int32_exn l = - if Compare.Int32.(l >= 0l) - then l - else invalid_arg "Level_repr.of_int32" + if Compare.Int32.(l >= 0l) then l else invalid_arg "Level_repr.of_int32" type error += Unexpected_level of Int32.t (* `Permanent *) @@ -65,26 +71,32 @@ let () = ~title:"Unexpected level" ~description:"Level must be non-negative." ~pp:(fun ppf l -> - Format.fprintf ppf "The level is %s but should be non-negative." (Int32.to_string l)) + Format.fprintf + ppf + "The level is %s but should be non-negative." + (Int32.to_string l)) Data_encoding.(obj1 (req "level" int32)) (function Unexpected_level l -> Some l | _ -> None) (fun l -> Unexpected_level l) -let of_int32 l = - try Ok (of_int32_exn l) - with _ -> error (Unexpected_level l) +let of_int32 l = try Ok (of_int32_exn l) with _ -> error (Unexpected_level l) module Index = struct type t = raw_level + let path_length = 1 + let to_path level l = Int32.to_string level :: l + let of_path = function - | [s] -> begin - try Some (Int32.of_string s) - with _ -> None - end - | _ -> None + | [s] -> ( + try Some (Int32.of_string s) with _ -> None ) + | _ -> + None + let rpc_arg = rpc_arg + let encoding = encoding + let compare = compare end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.mli index d7171dcf3..0f7dad593 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/raw_level_repr.mli @@ -27,21 +27,29 @@ since genesis: genesis is 0, all other blocks have increasing levels from there. *) type t + type raw_level = t -val encoding: raw_level Data_encoding.t -val rpc_arg: raw_level RPC_arg.arg -val pp: Format.formatter -> raw_level -> unit + +val encoding : raw_level Data_encoding.t + +val rpc_arg : raw_level RPC_arg.arg + +val pp : Format.formatter -> raw_level -> unit + include Compare.S with type t := raw_level -val to_int32: raw_level -> int32 -val of_int32_exn: int32 -> raw_level -val of_int32: int32 -> raw_level tzresult +val to_int32 : raw_level -> int32 -val diff: raw_level -> raw_level -> int32 +val of_int32_exn : int32 -> raw_level -val root: raw_level +val of_int32 : int32 -> raw_level tzresult -val succ: raw_level -> raw_level -val pred: raw_level -> raw_level option +val diff : raw_level -> raw_level -> int32 + +val root : raw_level + +val succ : raw_level -> raw_level + +val pred : raw_level -> raw_level option module Index : Storage_description.INDEX with type t = raw_level diff --git a/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.ml index 65e3d8e73..105ce476b 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.ml @@ -24,38 +24,42 @@ (*****************************************************************************) include Compare.Int32 + type roll = t let encoding = Data_encoding.int32 let first = 0l + let succ i = Int32.succ i -let random sequence ~bound = - Seed_repr.take_int32 sequence bound +let random sequence ~bound = Seed_repr.take_int32 sequence bound -let rpc_arg = - RPC_arg.like - RPC_arg.int32 - "roll" +let rpc_arg = RPC_arg.like RPC_arg.int32 "roll" let to_int32 v = v - module Index = struct type t = roll + let path_length = 3 + let to_path roll l = - (Int32.to_string @@ Int32.logand roll (Int32.of_int 0xff)) :: - (Int32.to_string @@ Int32.logand (Int32.shift_right_logical roll 8) (Int32.of_int 0xff)) :: - Int32.to_string roll :: l + (Int32.to_string @@ Int32.logand roll (Int32.of_int 0xff)) + :: ( Int32.to_string + @@ Int32.logand (Int32.shift_right_logical roll 8) (Int32.of_int 0xff) + ) + :: Int32.to_string roll :: l + let of_path = function - | _ :: _ :: s :: _ -> begin - try Some (Int32.of_string s) - with _ -> None - end - | _ -> None + | _ :: _ :: s :: _ -> ( + try Some (Int32.of_string s) with _ -> None ) + | _ -> + None + let rpc_arg = rpc_arg + let encoding = encoding + let compare = compare end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.mli index 000e1c7c4..cb792b012 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/roll_repr.mli @@ -24,19 +24,21 @@ (*****************************************************************************) type t = private int32 + type roll = t -val encoding: roll Data_encoding.t -val rpc_arg: roll RPC_arg.t +val encoding : roll Data_encoding.t -val random: - Seed_repr.sequence -> bound:roll -> roll * Seed_repr.sequence +val rpc_arg : roll RPC_arg.t -val first: roll -val succ: roll -> roll +val random : Seed_repr.sequence -> bound:roll -> roll * Seed_repr.sequence -val to_int32: roll -> Int32.t +val first : roll -val (=): roll -> roll -> bool +val succ : roll -> roll + +val to_int32 : roll -> Int32.t + +val ( = ) : roll -> roll -> bool module Index : Storage_description.INDEX with type t = roll diff --git a/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.ml index 5c23075b0..2d9601c29 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.ml @@ -29,7 +29,9 @@ type error += | Consume_roll_change (* `Permanent *) | No_roll_for_delegate (* `Permanent *) | No_roll_snapshot_for_cycle of Cycle_repr.t (* `Permanent *) - | Unregistered_delegate of Signature.Public_key_hash.t (* `Permanent *) + | Unregistered_delegate of Signature.Public_key_hash.t + +(* `Permanent *) let () = let open Data_encoding in @@ -40,7 +42,7 @@ let () = ~title:"Consume roll change" ~description:"Change is not enough to consume a roll." ~pp:(fun ppf () -> - Format.fprintf ppf "Not enough change to consume a roll.") + Format.fprintf ppf "Not enough change to consume a roll.") empty (function Consume_roll_change -> Some () | _ -> None) (fun () -> Consume_roll_change) ; @@ -59,12 +61,16 @@ let () = `Permanent ~id:"contract.manager.no_roll_snapshot_for_cycle" ~title:"No roll snapshot for cycle" - ~description:"A snapshot of the rolls distribution does not exist for this cycle." + ~description: + "A snapshot of the rolls distribution does not exist for this cycle." ~pp:(fun ppf c -> - Format.fprintf ppf - "A snapshot of the rolls distribution does not exist for cycle %a" Cycle_repr.pp c) + Format.fprintf + ppf + "A snapshot of the rolls distribution does not exist for cycle %a" + Cycle_repr.pp + c) (obj1 (req "cycle" Cycle_repr.encoding)) - (function No_roll_snapshot_for_cycle c-> Some c | _ -> None) + (function No_roll_snapshot_for_cycle c -> Some c | _ -> None) (fun c -> No_roll_snapshot_for_cycle c) ; (* Unregistered delegate *) register_error_kind @@ -72,10 +78,13 @@ let () = ~id:"contract.manager.unregistered_delegate" ~title:"Unregistered delegate" ~description:"A contract cannot be delegated to an unregistered delegate" - ~pp:(fun ppf k-> - Format.fprintf ppf "The provided public key (with hash %a) is \ - \ not registered as valid delegate key." - Signature.Public_key_hash.pp k) + ~pp:(fun ppf k -> + Format.fprintf + ppf + "The provided public key (with hash %a) is not registered as valid \ + delegate key." + Signature.Public_key_hash.pp + k) (obj1 (req "hash" Signature.Public_key_hash.encoding)) (function Unregistered_delegate k -> Some k | _ -> None) (fun k -> Unregistered_delegate k) @@ -84,96 +93,109 @@ let get_contract_delegate c contract = Storage.Contract.Delegate.get_option c contract let delegate_pubkey ctxt delegate = - Storage.Contract.Manager.get_option ctxt - (Contract_repr.implicit_contract delegate) >>=? function + Storage.Contract.Manager.get_option + ctxt + (Contract_repr.implicit_contract delegate) + >>=? function | None | Some (Manager_repr.Hash _) -> fail (Unregistered_delegate delegate) | Some (Manager_repr.Public_key pk) -> return pk let clear_cycle c cycle = - Storage.Roll.Snapshot_for_cycle.get c cycle >>=? fun index -> - Storage.Roll.Snapshot_for_cycle.delete c cycle >>=? fun c -> - Storage.Roll.Last_for_snapshot.delete (c, cycle) index >>=? fun c -> - Storage.Roll.Owner.delete_snapshot c (cycle, index) >>= fun c -> - return c + Storage.Roll.Snapshot_for_cycle.get c cycle + >>=? fun index -> + Storage.Roll.Snapshot_for_cycle.delete c cycle + >>=? fun c -> + Storage.Roll.Last_for_snapshot.delete (c, cycle) index + >>=? fun c -> + Storage.Roll.Owner.delete_snapshot c (cycle, index) >>= fun c -> return c let fold ctxt ~f init = - Storage.Roll.Next.get ctxt >>=? fun last -> + Storage.Roll.Next.get ctxt + >>=? fun last -> let rec loop ctxt roll acc = - acc >>=? fun acc -> - if Roll_repr.(roll = last) then - return acc + acc + >>=? fun acc -> + if Roll_repr.(roll = last) then return acc else - Storage.Roll.Owner.get_option ctxt roll >>=? function + Storage.Roll.Owner.get_option ctxt roll + >>=? function | None -> loop ctxt (Roll_repr.succ roll) (return acc) | Some delegate -> - loop ctxt (Roll_repr.succ roll) (f roll delegate acc) in + loop ctxt (Roll_repr.succ roll) (f roll delegate acc) + in loop ctxt Roll_repr.first (return init) let snapshot_rolls_for_cycle ctxt cycle = - Storage.Roll.Snapshot_for_cycle.get ctxt cycle >>=? fun index -> - Storage.Roll.Snapshot_for_cycle.set ctxt cycle (index + 1) >>=? fun ctxt -> - Storage.Roll.Owner.snapshot ctxt (cycle, index) >>=? fun ctxt -> - Storage.Roll.Next.get ctxt >>=? fun last -> - Storage.Roll.Last_for_snapshot.init (ctxt, cycle) index last >>=? fun ctxt -> - return ctxt + Storage.Roll.Snapshot_for_cycle.get ctxt cycle + >>=? fun index -> + Storage.Roll.Snapshot_for_cycle.set ctxt cycle (index + 1) + >>=? fun ctxt -> + Storage.Roll.Owner.snapshot ctxt (cycle, index) + >>=? fun ctxt -> + Storage.Roll.Next.get ctxt + >>=? fun last -> + Storage.Roll.Last_for_snapshot.init (ctxt, cycle) index last + >>=? fun ctxt -> return ctxt let freeze_rolls_for_cycle ctxt cycle = - Storage.Roll.Snapshot_for_cycle.get ctxt cycle >>=? fun max_index -> - Storage.Seed.For_cycle.get ctxt cycle >>=? fun seed -> + Storage.Roll.Snapshot_for_cycle.get ctxt cycle + >>=? fun max_index -> + Storage.Seed.For_cycle.get ctxt cycle + >>=? fun seed -> let rd = Seed_repr.initialize_new seed [MBytes.of_string "roll_snapshot"] in let seq = Seed_repr.sequence rd 0l in let selected_index = - Seed_repr.take_int32 seq (Int32.of_int max_index) |> fst |> Int32.to_int in - Storage.Roll.Snapshot_for_cycle.set ctxt cycle selected_index >>=? fun ctxt -> + Seed_repr.take_int32 seq (Int32.of_int max_index) |> fst |> Int32.to_int + in + Storage.Roll.Snapshot_for_cycle.set ctxt cycle selected_index + >>=? fun ctxt -> fold_left_s (fun ctxt index -> - if Compare.Int.(index = selected_index) then - return ctxt - else - Storage.Roll.Owner.delete_snapshot ctxt (cycle, index) >>= fun ctxt -> - Storage.Roll.Last_for_snapshot.delete (ctxt, cycle) index >>=? fun ctxt -> - return ctxt - ) + if Compare.Int.(index = selected_index) then return ctxt + else + Storage.Roll.Owner.delete_snapshot ctxt (cycle, index) + >>= fun ctxt -> + Storage.Roll.Last_for_snapshot.delete (ctxt, cycle) index + >>=? fun ctxt -> return ctxt) ctxt - Misc.(0 --> (max_index - 1)) >>=? fun ctxt -> - return ctxt + Misc.(0 --> (max_index - 1)) + >>=? fun ctxt -> return ctxt (* Roll selection *) module Random = struct - let int32_to_bytes i = let b = MBytes.create 4 in - MBytes.set_int32 b 0 i; - b + MBytes.set_int32 b 0 i ; b let level_random seed use level = let position = level.Level_repr.cycle_position in - Seed_repr.initialize_new seed - [MBytes.of_string ("level "^use^":"); - int32_to_bytes position] + Seed_repr.initialize_new + seed + [MBytes.of_string ("level " ^ use ^ ":"); int32_to_bytes position] let owner c kind level offset = let cycle = level.Level_repr.cycle in - Seed_storage.for_cycle c cycle >>=? fun random_seed -> + Seed_storage.for_cycle c cycle + >>=? fun random_seed -> let rd = level_random random_seed kind level in let sequence = Seed_repr.sequence rd (Int32.of_int offset) in - Storage.Roll.Snapshot_for_cycle.get c cycle >>=? fun index -> - Storage.Roll.Last_for_snapshot.get (c, cycle) index >>=? fun bound -> + Storage.Roll.Snapshot_for_cycle.get c cycle + >>=? fun index -> + Storage.Roll.Last_for_snapshot.get (c, cycle) index + >>=? fun bound -> let rec loop sequence = - let roll, sequence = Roll_repr.random sequence ~bound in - Storage.Roll.Owner.Snapshot.get_option c ((cycle, index), roll) >>=? function - | None -> - loop sequence - | Some delegate -> - return delegate in - Storage.Roll.Owner.snapshot_exists c (cycle, index) >>= fun snapshot_exists -> - fail_unless snapshot_exists (No_roll_snapshot_for_cycle cycle) >>=? fun () -> - loop sequence - + let (roll, sequence) = Roll_repr.random sequence ~bound in + Storage.Roll.Owner.Snapshot.get_option c ((cycle, index), roll) + >>=? function None -> loop sequence | Some delegate -> return delegate + in + Storage.Roll.Owner.snapshot_exists c (cycle, index) + >>= fun snapshot_exists -> + fail_unless snapshot_exists (No_roll_snapshot_for_cycle cycle) + >>=? fun () -> loop sequence end let baking_rights_owner c level ~priority = @@ -184,125 +206,153 @@ let endorsement_rights_owner c level ~slot = let traverse_rolls ctxt head = let rec loop acc roll = - Storage.Roll.Successor.get_option ctxt roll >>=? function - | None -> return (List.rev acc) - | Some next -> loop (next :: acc) next in + Storage.Roll.Successor.get_option ctxt roll + >>=? function + | None -> return (List.rev acc) | Some next -> loop (next :: acc) next + in loop [head] head let get_rolls ctxt delegate = - Storage.Roll.Delegate_roll_list.get_option ctxt delegate >>=? function - | None -> return_nil - | Some head_roll -> traverse_rolls ctxt head_roll + Storage.Roll.Delegate_roll_list.get_option ctxt delegate + >>=? function + | None -> return_nil | Some head_roll -> traverse_rolls ctxt head_roll let count_rolls ctxt delegate = - Storage.Roll.Delegate_roll_list.get_option ctxt delegate >>=? function - | None -> return 0 + Storage.Roll.Delegate_roll_list.get_option ctxt delegate + >>=? function + | None -> + return 0 | Some head_roll -> let rec loop acc roll = - Storage.Roll.Successor.get_option ctxt roll >>=? function - | None -> return acc - | Some next -> loop (succ acc) next in + Storage.Roll.Successor.get_option ctxt roll + >>=? function None -> return acc | Some next -> loop (succ acc) next + in loop 1 head_roll let get_change c delegate = - Storage.Roll.Delegate_change.get_option c delegate >>=? function - | None -> return Tez_repr.zero - | Some change -> return change + Storage.Roll.Delegate_change.get_option c delegate + >>=? function None -> return Tez_repr.zero | Some change -> return change module Delegate = struct - let fresh_roll c = - Storage.Roll.Next.get c >>=? fun roll -> - Storage.Roll.Next.set c (Roll_repr.succ roll) >>=? fun c -> - return (roll, c) + Storage.Roll.Next.get c + >>=? fun roll -> + Storage.Roll.Next.set c (Roll_repr.succ roll) >>=? fun c -> return (roll, c) let get_limbo_roll c = - Storage.Roll.Limbo.get_option c >>=? function + Storage.Roll.Limbo.get_option c + >>=? function | None -> - fresh_roll c >>=? fun (roll, c) -> - Storage.Roll.Limbo.init c roll >>=? fun c -> - return (roll, c) + fresh_roll c + >>=? fun (roll, c) -> + Storage.Roll.Limbo.init c roll >>=? fun c -> return (roll, c) | Some roll -> return (roll, c) let consume_roll_change c delegate = let tokens_per_roll = Constants_storage.tokens_per_roll c in - Storage.Roll.Delegate_change.get c delegate >>=? fun change -> - trace Consume_roll_change - (Lwt.return Tez_repr.(change -? tokens_per_roll)) >>=? fun new_change -> + Storage.Roll.Delegate_change.get c delegate + >>=? fun change -> + trace Consume_roll_change (Lwt.return Tez_repr.(change -? tokens_per_roll)) + >>=? fun new_change -> Storage.Roll.Delegate_change.set c delegate new_change let recover_roll_change c delegate = let tokens_per_roll = Constants_storage.tokens_per_roll c in - Storage.Roll.Delegate_change.get c delegate >>=? fun change -> - Lwt.return Tez_repr.(change +? tokens_per_roll) >>=? fun new_change -> + Storage.Roll.Delegate_change.get c delegate + >>=? fun change -> + Lwt.return Tez_repr.(change +? tokens_per_roll) + >>=? fun new_change -> Storage.Roll.Delegate_change.set c delegate new_change let pop_roll_from_delegate c delegate = - recover_roll_change c delegate >>=? fun c -> + recover_roll_change c delegate + >>=? fun c -> (* beginning: delegate : roll -> successor_roll -> ... limbo : limbo_head -> ... *) - Storage.Roll.Limbo.get_option c >>=? fun limbo_head -> - Storage.Roll.Delegate_roll_list.get_option c delegate >>=? function - | None -> fail No_roll_for_delegate + Storage.Roll.Limbo.get_option c + >>=? fun limbo_head -> + Storage.Roll.Delegate_roll_list.get_option c delegate + >>=? function + | None -> + fail No_roll_for_delegate | Some roll -> - Storage.Roll.Owner.delete c roll >>=? fun c -> - Storage.Roll.Successor.get_option c roll >>=? fun successor_roll -> - Storage.Roll.Delegate_roll_list.set_option c delegate successor_roll >>= fun c -> + Storage.Roll.Owner.delete c roll + >>=? fun c -> + Storage.Roll.Successor.get_option c roll + >>=? fun successor_roll -> + Storage.Roll.Delegate_roll_list.set_option c delegate successor_roll + >>= fun c -> (* delegate : successor_roll -> ... roll ------^ limbo : limbo_head -> ... *) - Storage.Roll.Successor.set_option c roll limbo_head >>= fun c -> + Storage.Roll.Successor.set_option c roll limbo_head + >>= fun c -> (* delegate : successor_roll -> ... roll ------v limbo : limbo_head -> ... *) - Storage.Roll.Limbo.init_set c roll >>= fun c -> + Storage.Roll.Limbo.init_set c roll + >>= fun c -> (* delegate : successor_roll -> ... limbo : roll -> limbo_head -> ... *) return (roll, c) let create_roll_in_delegate c delegate delegate_pk = - consume_roll_change c delegate >>=? fun c -> - + consume_roll_change c delegate + >>=? fun c -> (* beginning: delegate : delegate_head -> ... limbo : roll -> limbo_successor -> ... *) - Storage.Roll.Delegate_roll_list.get_option c delegate >>=? fun delegate_head -> - get_limbo_roll c >>=? fun (roll, c) -> - Storage.Roll.Owner.init c roll delegate_pk >>=? fun c -> - Storage.Roll.Successor.get_option c roll >>=? fun limbo_successor -> - Storage.Roll.Limbo.set_option c limbo_successor >>= fun c -> + Storage.Roll.Delegate_roll_list.get_option c delegate + >>=? fun delegate_head -> + get_limbo_roll c + >>=? fun (roll, c) -> + Storage.Roll.Owner.init c roll delegate_pk + >>=? fun c -> + Storage.Roll.Successor.get_option c roll + >>=? fun limbo_successor -> + Storage.Roll.Limbo.set_option c limbo_successor + >>= fun c -> (* delegate : delegate_head -> ... roll ------v limbo : limbo_successor -> ... *) - Storage.Roll.Successor.set_option c roll delegate_head >>= fun c -> + Storage.Roll.Successor.set_option c roll delegate_head + >>= fun c -> (* delegate : delegate_head -> ... roll ------^ limbo : limbo_successor -> ... *) - Storage.Roll.Delegate_roll_list.init_set c delegate roll >>= fun c -> + Storage.Roll.Delegate_roll_list.init_set c delegate roll + >>= fun c -> (* delegate : roll -> delegate_head -> ... limbo : limbo_successor -> ... *) return c let ensure_inited c delegate = - Storage.Roll.Delegate_change.mem c delegate >>= function - | true -> return c + Storage.Roll.Delegate_change.mem c delegate + >>= function + | true -> + return c | false -> Storage.Roll.Delegate_change.init c delegate Tez_repr.zero let is_inactive c delegate = - Storage.Contract.Inactive_delegate.mem c - (Contract_repr.implicit_contract delegate) >>= fun inactive -> - if inactive then - return inactive + Storage.Contract.Inactive_delegate.mem + c + (Contract_repr.implicit_contract delegate) + >>= fun inactive -> + if inactive then return inactive else - Storage.Contract.Delegate_desactivation.get_option c - (Contract_repr.implicit_contract delegate) >>=? function + Storage.Contract.Delegate_desactivation.get_option + c + (Contract_repr.implicit_contract delegate) + >>=? function | Some last_active_cycle -> - let { Level_repr.cycle = current_cycle } = Raw_context.current_level c in + let {Level_repr.cycle = current_cycle} = + Raw_context.current_level c + in return Cycle_repr.(last_active_cycle < current_cycle) | None -> (* This case is only when called from `set_active`, when creating @@ -310,79 +360,101 @@ module Delegate = struct return_false let add_amount c delegate amount = - ensure_inited c delegate >>=? fun c -> + ensure_inited c delegate + >>=? fun c -> let tokens_per_roll = Constants_storage.tokens_per_roll c in - Storage.Roll.Delegate_change.get c delegate >>=? fun change -> - Lwt.return Tez_repr.(amount +? change) >>=? fun change -> - Storage.Roll.Delegate_change.set c delegate change >>=? fun c -> - delegate_pubkey c delegate >>=? fun delegate_pk -> + Storage.Roll.Delegate_change.get c delegate + >>=? fun change -> + Lwt.return Tez_repr.(amount +? change) + >>=? fun change -> + Storage.Roll.Delegate_change.set c delegate change + >>=? fun c -> + delegate_pubkey c delegate + >>=? fun delegate_pk -> let rec loop c change = - if Tez_repr.(change < tokens_per_roll) then - return c + if Tez_repr.(change < tokens_per_roll) then return c else - Lwt.return Tez_repr.(change -? tokens_per_roll) >>=? fun change -> - create_roll_in_delegate c delegate delegate_pk >>=? fun c -> - loop c change in - is_inactive c delegate >>=? fun inactive -> - if inactive then - return c + Lwt.return Tez_repr.(change -? tokens_per_roll) + >>=? fun change -> + create_roll_in_delegate c delegate delegate_pk + >>=? fun c -> loop c change + in + is_inactive c delegate + >>=? fun inactive -> + if inactive then return c else - loop c change >>=? fun c -> - Storage.Roll.Delegate_roll_list.get_option c delegate >>=? fun rolls -> + loop c change + >>=? fun c -> + Storage.Roll.Delegate_roll_list.get_option c delegate + >>=? fun rolls -> match rolls with | None -> return c | Some _ -> - Storage.Active_delegates_with_rolls.add c delegate >>= fun c -> - return c + Storage.Active_delegates_with_rolls.add c delegate + >>= fun c -> return c let remove_amount c delegate amount = let tokens_per_roll = Constants_storage.tokens_per_roll c in let rec loop c change = - if Tez_repr.(amount <= change) - then return (c, change) + if Tez_repr.(amount <= change) then return (c, change) else - pop_roll_from_delegate c delegate >>=? fun (_, c) -> - Lwt.return Tez_repr.(change +? tokens_per_roll) >>=? fun change -> - loop c change in - Storage.Roll.Delegate_change.get c delegate >>=? fun change -> - is_inactive c delegate >>=? fun inactive -> - begin - if inactive then - return (c, change) - else - loop c change >>=? fun (c, change) -> - Storage.Roll.Delegate_roll_list.get_option c delegate >>=? fun rolls -> - match rolls with - | None -> - Storage.Active_delegates_with_rolls.del c delegate >>= fun c -> - return (c, change) - | Some _ -> - return (c, change) - end >>=? fun (c, change) -> - Lwt.return Tez_repr.(change -? amount) >>=? fun change -> - Storage.Roll.Delegate_change.set c delegate change + pop_roll_from_delegate c delegate + >>=? fun (_, c) -> + Lwt.return Tez_repr.(change +? tokens_per_roll) + >>=? fun change -> loop c change + in + Storage.Roll.Delegate_change.get c delegate + >>=? fun change -> + is_inactive c delegate + >>=? fun inactive -> + ( if inactive then return (c, change) + else + loop c change + >>=? fun (c, change) -> + Storage.Roll.Delegate_roll_list.get_option c delegate + >>=? fun rolls -> + match rolls with + | None -> + Storage.Active_delegates_with_rolls.del c delegate + >>= fun c -> return (c, change) + | Some _ -> + return (c, change) ) + >>=? fun (c, change) -> + Lwt.return Tez_repr.(change -? amount) + >>=? fun change -> Storage.Roll.Delegate_change.set c delegate change let set_inactive ctxt delegate = - ensure_inited ctxt delegate >>=? fun ctxt -> + ensure_inited ctxt delegate + >>=? fun ctxt -> let tokens_per_roll = Constants_storage.tokens_per_roll ctxt in - Storage.Roll.Delegate_change.get ctxt delegate >>=? fun change -> - Storage.Contract.Inactive_delegate.add ctxt - (Contract_repr.implicit_contract delegate) >>= fun ctxt -> - Storage.Active_delegates_with_rolls.del ctxt delegate >>= fun ctxt -> + Storage.Roll.Delegate_change.get ctxt delegate + >>=? fun change -> + Storage.Contract.Inactive_delegate.add + ctxt + (Contract_repr.implicit_contract delegate) + >>= fun ctxt -> + Storage.Active_delegates_with_rolls.del ctxt delegate + >>= fun ctxt -> let rec loop ctxt change = - Storage.Roll.Delegate_roll_list.get_option ctxt delegate >>=? function - | None -> return (ctxt, change) + Storage.Roll.Delegate_roll_list.get_option ctxt delegate + >>=? function + | None -> + return (ctxt, change) | Some _roll -> - pop_roll_from_delegate ctxt delegate >>=? fun (_, ctxt) -> - Lwt.return Tez_repr.(change +? tokens_per_roll) >>=? fun change -> - loop ctxt change in - loop ctxt change >>=? fun (ctxt, change) -> - Storage.Roll.Delegate_change.set ctxt delegate change >>=? fun ctxt -> - return ctxt + pop_roll_from_delegate ctxt delegate + >>=? fun (_, ctxt) -> + Lwt.return Tez_repr.(change +? tokens_per_roll) + >>=? fun change -> loop ctxt change + in + loop ctxt change + >>=? fun (ctxt, change) -> + Storage.Roll.Delegate_change.set ctxt delegate change + >>=? fun ctxt -> return ctxt let set_active ctxt delegate = - is_inactive ctxt delegate >>=? fun inactive -> + is_inactive ctxt delegate + >>=? fun inactive -> let current_cycle = (Raw_context.current_level ctxt).cycle in let preserved_cycles = Constants_storage.preserved_cycles ctxt in (* When the delegate is new or inactive, she will become active in @@ -390,126 +462,143 @@ module Delegate = struct delegate to start baking. When the delegate is active, we only give her at least `preserved_cycles` after the current cycle before to be deactivated. *) - Storage.Contract.Delegate_desactivation.get_option ctxt - (Contract_repr.implicit_contract delegate) >>=? fun current_expiration -> - let expiration = match current_expiration with + Storage.Contract.Delegate_desactivation.get_option + ctxt + (Contract_repr.implicit_contract delegate) + >>=? fun current_expiration -> + let expiration = + match current_expiration with | None -> - Cycle_repr.add current_cycle (1+2*preserved_cycles) + Cycle_repr.add current_cycle (1 + (2 * preserved_cycles)) | Some current_expiration -> let delay = - if inactive then (1+2*preserved_cycles) else 1+preserved_cycles in - let updated = - Cycle_repr.add current_cycle delay in - Cycle_repr.max current_expiration updated in - Storage.Contract.Delegate_desactivation.init_set ctxt + if inactive then 1 + (2 * preserved_cycles) + else 1 + preserved_cycles + in + let updated = Cycle_repr.add current_cycle delay in + Cycle_repr.max current_expiration updated + in + Storage.Contract.Delegate_desactivation.init_set + ctxt (Contract_repr.implicit_contract delegate) - expiration >>= fun ctxt -> - if not inactive then - return ctxt - else begin - ensure_inited ctxt delegate >>=? fun ctxt -> + expiration + >>= fun ctxt -> + if not inactive then return ctxt + else + ensure_inited ctxt delegate + >>=? fun ctxt -> let tokens_per_roll = Constants_storage.tokens_per_roll ctxt in - Storage.Roll.Delegate_change.get ctxt delegate >>=? fun change -> - Storage.Contract.Inactive_delegate.del ctxt - (Contract_repr.implicit_contract delegate) >>= fun ctxt -> - delegate_pubkey ctxt delegate >>=? fun delegate_pk -> + Storage.Roll.Delegate_change.get ctxt delegate + >>=? fun change -> + Storage.Contract.Inactive_delegate.del + ctxt + (Contract_repr.implicit_contract delegate) + >>= fun ctxt -> + delegate_pubkey ctxt delegate + >>=? fun delegate_pk -> let rec loop ctxt change = - if Tez_repr.(change < tokens_per_roll) then - return ctxt + if Tez_repr.(change < tokens_per_roll) then return ctxt else - Lwt.return Tez_repr.(change -? tokens_per_roll) >>=? fun change -> - create_roll_in_delegate ctxt delegate delegate_pk >>=? fun ctxt -> - loop ctxt change in - loop ctxt change >>=? fun ctxt -> - Storage.Roll.Delegate_roll_list.get_option ctxt delegate >>=? fun rolls -> + Lwt.return Tez_repr.(change -? tokens_per_roll) + >>=? fun change -> + create_roll_in_delegate ctxt delegate delegate_pk + >>=? fun ctxt -> loop ctxt change + in + loop ctxt change + >>=? fun ctxt -> + Storage.Roll.Delegate_roll_list.get_option ctxt delegate + >>=? fun rolls -> match rolls with | None -> return ctxt | Some _ -> - Storage.Active_delegates_with_rolls.add ctxt delegate >>= fun ctxt -> - return ctxt - end - + Storage.Active_delegates_with_rolls.add ctxt delegate + >>= fun ctxt -> return ctxt end module Contract = struct - let add_amount c contract amount = - get_contract_delegate c contract >>=? function - | None -> return c - | Some delegate -> - Delegate.add_amount c delegate amount + get_contract_delegate c contract + >>=? function + | None -> return c | Some delegate -> Delegate.add_amount c delegate amount let remove_amount c contract amount = - get_contract_delegate c contract >>=? function - | None -> return c + get_contract_delegate c contract + >>=? function + | None -> + return c | Some delegate -> Delegate.remove_amount c delegate amount - end -let init ctxt = - Storage.Roll.Next.init ctxt Roll_repr.first +let init ctxt = Storage.Roll.Next.init ctxt Roll_repr.first let init_first_cycles ctxt = let preserved = Constants_storage.preserved_cycles ctxt in (* Precompute rolls for cycle (0 --> preserved_cycles) *) List.fold_left (fun ctxt c -> - ctxt >>=? fun ctxt -> - let cycle = Cycle_repr.of_int32_exn (Int32.of_int c) in - Storage.Roll.Snapshot_for_cycle.init ctxt cycle 0 >>=? fun ctxt -> - snapshot_rolls_for_cycle ctxt cycle >>=? fun ctxt -> - freeze_rolls_for_cycle ctxt cycle) - (return ctxt) (0 --> preserved) >>=? fun ctxt -> + ctxt + >>=? fun ctxt -> + let cycle = Cycle_repr.of_int32_exn (Int32.of_int c) in + Storage.Roll.Snapshot_for_cycle.init ctxt cycle 0 + >>=? fun ctxt -> + snapshot_rolls_for_cycle ctxt cycle + >>=? fun ctxt -> freeze_rolls_for_cycle ctxt cycle) + (return ctxt) + (0 --> preserved) + >>=? fun ctxt -> let cycle = Cycle_repr.of_int32_exn (Int32.of_int (preserved + 1)) in (* Precomputed a snapshot for cycle (preserved_cycles + 1) *) - Storage.Roll.Snapshot_for_cycle.init ctxt cycle 0 >>=? fun ctxt -> - snapshot_rolls_for_cycle ctxt cycle >>=? fun ctxt -> + Storage.Roll.Snapshot_for_cycle.init ctxt cycle 0 + >>=? fun ctxt -> + snapshot_rolls_for_cycle ctxt cycle + >>=? fun ctxt -> (* Prepare storage for storing snapshots for cycle (preserved_cycles+2) *) let cycle = Cycle_repr.of_int32_exn (Int32.of_int (preserved + 2)) in - Storage.Roll.Snapshot_for_cycle.init ctxt cycle 0 >>=? fun ctxt -> - return ctxt + Storage.Roll.Snapshot_for_cycle.init ctxt cycle 0 + >>=? fun ctxt -> return ctxt let snapshot_rolls ctxt = let current_level = Raw_context.current_level ctxt in let preserved = Constants_storage.preserved_cycles ctxt in - let cycle = Cycle_repr.add current_level.cycle (preserved+2) in + let cycle = Cycle_repr.add current_level.cycle (preserved + 2) in snapshot_rolls_for_cycle ctxt cycle let cycle_end ctxt last_cycle = let preserved = Constants_storage.preserved_cycles ctxt in - begin - match Cycle_repr.sub last_cycle preserved with - | None -> return ctxt - | Some cleared_cycle -> - clear_cycle ctxt cleared_cycle - end >>=? fun ctxt -> - let frozen_roll_cycle = Cycle_repr.add last_cycle (preserved+1) in - freeze_rolls_for_cycle ctxt frozen_roll_cycle >>=? fun ctxt -> + ( match Cycle_repr.sub last_cycle preserved with + | None -> + return ctxt + | Some cleared_cycle -> + clear_cycle ctxt cleared_cycle ) + >>=? fun ctxt -> + let frozen_roll_cycle = Cycle_repr.add last_cycle (preserved + 1) in + freeze_rolls_for_cycle ctxt frozen_roll_cycle + >>=? fun ctxt -> Storage.Roll.Snapshot_for_cycle.init - ctxt (Cycle_repr.succ (Cycle_repr.succ frozen_roll_cycle)) 0 >>=? fun ctxt -> - return ctxt + ctxt + (Cycle_repr.succ (Cycle_repr.succ frozen_roll_cycle)) + 0 + >>=? fun ctxt -> return ctxt let update_tokens_per_roll ctxt new_tokens_per_roll = let constants = Raw_context.constants ctxt in let old_tokens_per_roll = constants.tokens_per_roll in - Raw_context.patch_constants ctxt begin fun constants -> - { constants with Constants_repr.tokens_per_roll = new_tokens_per_roll } - end >>= fun ctxt -> + Raw_context.patch_constants ctxt (fun constants -> + {constants with Constants_repr.tokens_per_roll = new_tokens_per_roll}) + >>= fun ctxt -> let decrease = Tez_repr.(new_tokens_per_roll < old_tokens_per_roll) in - begin - if decrease then - Lwt.return Tez_repr.(old_tokens_per_roll -? new_tokens_per_roll) - else - Lwt.return Tez_repr.(new_tokens_per_roll -? old_tokens_per_roll) - end >>=? fun abs_diff -> - Storage.Delegates.fold ctxt (Ok ctxt) begin fun pkh ctxt -> - Lwt.return ctxt >>=? fun ctxt -> - count_rolls ctxt pkh >>=? fun rolls -> - Lwt.return Tez_repr.(abs_diff *? Int64.of_int rolls) >>=? fun amount -> - if decrease then - Delegate.add_amount ctxt pkh amount - else - Delegate.remove_amount ctxt pkh amount - end + ( if decrease then + Lwt.return Tez_repr.(old_tokens_per_roll -? new_tokens_per_roll) + else Lwt.return Tez_repr.(new_tokens_per_roll -? old_tokens_per_roll) ) + >>=? fun abs_diff -> + Storage.Delegates.fold ctxt (Ok ctxt) (fun pkh ctxt -> + Lwt.return ctxt + >>=? fun ctxt -> + count_rolls ctxt pkh + >>=? fun rolls -> + Lwt.return Tez_repr.(abs_diff *? Int64.of_int rolls) + >>=? fun amount -> + if decrease then Delegate.add_amount ctxt pkh amount + else Delegate.remove_amount ctxt pkh amount) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.mli index 5e901e72c..8d028b746 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/roll_storage.mli @@ -37,68 +37,96 @@ type error += | Consume_roll_change | No_roll_for_delegate | No_roll_snapshot_for_cycle of Cycle_repr.t - | Unregistered_delegate of Signature.Public_key_hash.t (* `Permanent *) + | Unregistered_delegate of Signature.Public_key_hash.t + +(* `Permanent *) val init : Raw_context.t -> Raw_context.t tzresult Lwt.t + val init_first_cycles : Raw_context.t -> Raw_context.t tzresult Lwt.t val cycle_end : Raw_context.t -> Cycle_repr.t -> Raw_context.t tzresult Lwt.t -val snapshot_rolls : Raw_context.t -> Raw_context.t tzresult Lwt.t +val snapshot_rolls : Raw_context.t -> Raw_context.t tzresult Lwt.t val fold : Raw_context.t -> f:(Roll_repr.roll -> Signature.Public_key.t -> 'a -> 'a tzresult Lwt.t) -> - 'a -> 'a tzresult Lwt.t + 'a -> + 'a tzresult Lwt.t val baking_rights_owner : - Raw_context.t -> Level_repr.t -> priority:int -> + Raw_context.t -> + Level_repr.t -> + priority:int -> Signature.Public_key.t tzresult Lwt.t val endorsement_rights_owner : - Raw_context.t -> Level_repr.t -> slot:int -> + Raw_context.t -> + Level_repr.t -> + slot:int -> Signature.Public_key.t tzresult Lwt.t module Delegate : sig - val is_inactive : Raw_context.t -> Signature.Public_key_hash.t -> bool tzresult Lwt.t val add_amount : - Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t + Raw_context.t -> + Signature.Public_key_hash.t -> + Tez_repr.t -> + Raw_context.t tzresult Lwt.t val remove_amount : - Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t + Raw_context.t -> + Signature.Public_key_hash.t -> + Tez_repr.t -> + Raw_context.t tzresult Lwt.t - val set_inactive : Raw_context.t -> Signature.Public_key_hash.t -> Raw_context.t tzresult Lwt.t - - val set_active : Raw_context.t -> Signature.Public_key_hash.t -> Raw_context.t tzresult Lwt.t + val set_inactive : + Raw_context.t -> + Signature.Public_key_hash.t -> + Raw_context.t tzresult Lwt.t + val set_active : + Raw_context.t -> + Signature.Public_key_hash.t -> + Raw_context.t tzresult Lwt.t end module Contract : sig - val add_amount : - Raw_context.t -> Contract_repr.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t + Raw_context.t -> + Contract_repr.t -> + Tez_repr.t -> + Raw_context.t tzresult Lwt.t val remove_amount : - Raw_context.t -> Contract_repr.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t - + Raw_context.t -> + Contract_repr.t -> + Tez_repr.t -> + Raw_context.t tzresult Lwt.t end -val delegate_pubkey: - Raw_context.t -> Signature.Public_key_hash.t -> +val delegate_pubkey : + Raw_context.t -> + Signature.Public_key_hash.t -> Signature.Public_key.t tzresult Lwt.t -val get_rolls: - Raw_context.t -> Signature.Public_key_hash.t -> Roll_repr.t list tzresult Lwt.t -val get_change: +val get_rolls : + Raw_context.t -> + Signature.Public_key_hash.t -> + Roll_repr.t list tzresult Lwt.t + +val get_change : Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t tzresult Lwt.t -val update_tokens_per_roll: +val update_tokens_per_roll : Raw_context.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t (**/**) -val get_contract_delegate: - Raw_context.t -> Contract_repr.t -> Signature.Public_key_hash.t option tzresult Lwt.t +val get_contract_delegate : + Raw_context.t -> + Contract_repr.t -> + Signature.Public_key_hash.t option tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_expr_hash.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_expr_hash.ml index a21e77fc8..2c7f93a04 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_expr_hash.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_expr_hash.ml @@ -25,12 +25,16 @@ let script_expr_hash = "\013\044\064\027" (* expr(54) *) -include Blake2B.Make(Base58)(struct - let name = "script_expr" - let title = "A script expression ID" - let b58check_prefix = script_expr_hash - let size = None - end) +include Blake2B.Make + (Base58) + (struct + let name = "script_expr" -let () = - Base58.check_encoded_prefix b58check_encoding "expr" 54 + let title = "A script expression ID" + + let b58check_prefix = script_expr_hash + + let size = None + end) + +let () = Base58.check_encoded_prefix b58check_encoding "expr" 54 diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.ml index 7e96549e4..a29c10189 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.ml @@ -24,28 +24,37 @@ (*****************************************************************************) type n = Natural_tag + type z = Integer_tag + type 't num = Z.t let compare x y = Z.compare x y let zero = Z.zero + let zero_n = Z.zero let to_string x = Z.to_string x + let of_string s = try Some (Z.of_string s) with _ -> None let to_int64 x = try Some (Z.to_int64 x) with _ -> None + let of_int64 n = Z.of_int64 n let to_int x = try Some (Z.to_int x) with _ -> None + let of_int n = Z.of_int n let of_zint x = x + let to_zint x = x let add x y = Z.add x y + let sub x y = Z.sub x y + let mul x y = Z.mul x y let ediv x y = @@ -55,33 +64,39 @@ let ediv x y = with _ -> None let add_n = add + let mul_n = mul + let ediv_n = ediv let abs x = Z.abs x -let is_nat x = - if Compare.Z.(x < Z.zero) then None else Some x + +let is_nat x = if Compare.Z.(x < Z.zero) then None else Some x + let neg x = Z.neg x + let int x = x let shift_left x y = - if Compare.Int.(Z.compare y (Z.of_int 256) > 0) then - None + if Compare.Int.(Z.compare y (Z.of_int 256) > 0) then None else let y = Z.to_int y in Some (Z.shift_left x y) let shift_right x y = - if Compare.Int.(Z.compare y (Z.of_int 256) > 0) then - None + if Compare.Int.(Z.compare y (Z.of_int 256) > 0) then None else let y = Z.to_int y in Some (Z.shift_right x y) let shift_left_n = shift_left + let shift_right_n = shift_right let logor x y = Z.logor x y + let logxor x y = Z.logxor x y + let logand x y = Z.logand x y + let lognot x = Z.lognot x diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.mli index 592e3a410..604878f4e 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_int_repr.mli @@ -81,7 +81,7 @@ val mul_n : n num -> n num -> n num (** Euclidean division between naturals. [ediv_n n d] returns [None] if divisor is zero, or [Some (q, r)] where [n = d * q + r] and [[0 <= r < d]] otherwise. *) -val ediv_n: n num -> n num -> (n num * n num) option +val ediv_n : n num -> n num -> (n num * n num) option (** Sign agnostic addition. Use {!add_n} when working with naturals to preserve the sign. *) @@ -99,7 +99,7 @@ val mul : _ num -> _ num -> z num [ediv n d] returns [None] if divisor is zero, or [Some (q, r)] where [n = d * q + r] and [[0 <= r < |d|]] otherwise. Use {!ediv_n} when working with naturals to preserve the sign. *) -val ediv: _ num -> _ num -> (z num * n num) option +val ediv : _ num -> _ num -> (z num * n num) option (** Compute the absolute value of a relative, turning it into a natural. *) val abs : z num -> n num diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.ml index 3e4917b1a..37c036c2b 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.ml @@ -33,72 +33,80 @@ open Script_ir_translator type execution_trace = (Script.location * Gas.t * (Script.expr * string option) list) list -type error += Reject of Script.location * Script.expr * execution_trace option +type error += + | Reject of Script.location * Script.expr * execution_trace option + type error += Overflow of Script.location * execution_trace option + type error += Runtime_contract_error : Contract.t * Script.expr -> error + type error += Bad_contract_parameter of Contract.t (* `Permanent *) + type error += Cannot_serialize_log + type error += Cannot_serialize_failure + type error += Cannot_serialize_storage let () = let open Data_encoding in let trace_encoding = - (list @@ obj3 - (req "location" Script.location_encoding) - (req "gas" Gas.encoding) - (req "stack" - (list - (obj2 - (req "item" (Script.expr_encoding)) - (opt "annot" string))))) in + list + @@ obj3 + (req "location" Script.location_encoding) + (req "gas" Gas.encoding) + (req + "stack" + (list (obj2 (req "item" Script.expr_encoding) (opt "annot" string)))) + in (* Reject *) register_error_kind `Temporary ~id:"michelson_v1.script_rejected" - ~title: "Script failed" - ~description: "A FAILWITH instruction was reached" + ~title:"Script failed" + ~description:"A FAILWITH instruction was reached" (obj3 (req "location" Script.location_encoding) (req "with" Script.expr_encoding) (opt "trace" trace_encoding)) (function Reject (loc, v, trace) -> Some (loc, v, trace) | _ -> None) - (fun (loc, v, trace) -> Reject (loc, v, trace)); + (fun (loc, v, trace) -> Reject (loc, v, trace)) ; (* Overflow *) register_error_kind `Temporary ~id:"michelson_v1.script_overflow" - ~title: "Script failed (overflow error)" - ~description: "A FAIL instruction was reached due to the detection of an overflow" + ~title:"Script failed (overflow error)" + ~description: + "A FAIL instruction was reached due to the detection of an overflow" (obj2 (req "location" Script.location_encoding) (opt "trace" trace_encoding)) (function Overflow (loc, trace) -> Some (loc, trace) | _ -> None) - (fun (loc, trace) -> Overflow (loc, trace)); + (fun (loc, trace) -> Overflow (loc, trace)) ; (* Runtime contract error *) register_error_kind `Temporary ~id:"michelson_v1.runtime_error" - ~title: "Script runtime error" - ~description: "Toplevel error for all runtime script errors" + ~title:"Script runtime error" + ~description:"Toplevel error for all runtime script errors" (obj2 (req "contract_handle" Contract.encoding) (req "contract_code" Script.expr_encoding)) (function | Runtime_contract_error (contract, expr) -> Some (contract, expr) - | _ -> None) - (fun (contract, expr) -> - Runtime_contract_error (contract, expr)) ; + | _ -> + None) + (fun (contract, expr) -> Runtime_contract_error (contract, expr)) ; (* Bad contract parameter *) register_error_kind `Permanent ~id:"michelson_v1.bad_contract_parameter" ~title:"Contract supplied an invalid parameter" - ~description:"Either no parameter was supplied to a contract with \ - a non-unit parameter type, a non-unit parameter was \ - passed to an account, or a parameter was supplied of \ - the wrong type" + ~description: + "Either no parameter was supplied to a contract with a non-unit \ + parameter type, a non-unit parameter was passed to an account, or a \ + parameter was supplied of the wrong type" Data_encoding.(obj1 (req "contract" Contract.encoding)) (function Bad_contract_parameter c -> Some c | _ -> None) (fun c -> Bad_contract_parameter c) ; @@ -107,8 +115,9 @@ let () = `Temporary ~id:"michelson_v1.cannot_serialize_log" ~title:"Not enough gas to serialize execution trace" - ~description:"Execution trace with stacks was to big to be serialized with \ - the provided gas" + ~description: + "Execution trace with stacks was to big to be serialized with the \ + provided gas" Data_encoding.empty (function Cannot_serialize_log -> Some () | _ -> None) (fun () -> Cannot_serialize_log) ; @@ -117,8 +126,8 @@ let () = `Temporary ~id:"michelson_v1.cannot_serialize_failure" ~title:"Not enough gas to serialize argument of FAILWITH" - ~description:"Argument of FAILWITH was too big to be serialized with \ - the provided gas" + ~description: + "Argument of FAILWITH was too big to be serialized with the provided gas" Data_encoding.empty (function Cannot_serialize_failure -> Some () | _ -> None) (fun () -> Cannot_serialize_failure) ; @@ -127,8 +136,8 @@ let () = `Temporary ~id:"michelson_v1.cannot_serialize_storage" ~title:"Not enough gas to serialize execution storage" - ~description:"The returned storage was too big to be serialized with \ - the provided gas" + ~description: + "The returned storage was too big to be serialized with the provided gas" Data_encoding.empty (function Cannot_serialize_storage -> Some () | _ -> None) (fun () -> Cannot_serialize_storage) @@ -142,891 +151,1358 @@ type 'tys stack = let unparse_stack ctxt (stack, stack_ty) = (* We drop the gas limit as this function is only used for debugging/errors. *) let ctxt = Gas.set_unlimited ctxt in - let rec unparse_stack - : type a. a stack * a stack_ty -> (Script.expr * string option) list tzresult Lwt.t - = function - | Empty, Empty_t -> return_nil - | Item (v, rest), Item_t (ty, rest_ty, annot) -> - unparse_data ctxt Readable ty v >>=? fun (data, _ctxt) -> - unparse_stack (rest, rest_ty) >>=? fun rest -> - let annot = match Script_ir_annot.unparse_var_annot annot with - | [] -> None - | [ a ] -> Some a - | _ -> assert false in - let data = Micheline.strip_locations data in - return ((data, annot) :: rest) in + let rec unparse_stack : + type a. + a stack * a stack_ty -> (Script.expr * string option) list tzresult Lwt.t + = function + | (Empty, Empty_t) -> + return_nil + | (Item (v, rest), Item_t (ty, rest_ty, annot)) -> + unparse_data ctxt Readable ty v + >>=? fun (data, _ctxt) -> + unparse_stack (rest, rest_ty) + >>=? fun rest -> + let annot = + match Script_ir_annot.unparse_var_annot annot with + | [] -> + None + | [a] -> + Some a + | _ -> + assert false + in + let data = Micheline.strip_locations data in + return ((data, annot) :: rest) + in unparse_stack (stack, stack_ty) module Interp_costs = Michelson_v1_gas.Cost_of.Interpreter -let rec interp_stack_prefix_preserving_operation : type fbef bef faft aft result . - (fbef stack -> (faft stack * result) tzresult Lwt.t) - -> (fbef, faft, bef, aft) stack_prefix_preservation_witness - -> bef stack - -> (aft stack * result) tzresult Lwt.t = - fun f n stk -> - match n,stk with - | Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix (Prefix n))))))))))))))), - Item (v0, Item (v1, Item (v2, Item (v3, Item (v4, Item (v5, Item (v6, Item (v7, Item (v8, Item (v9, Item (va, Item (vb, Item (vc, Item (vd, Item (ve, Item (vf, rest)))))))))))))))) -> - interp_stack_prefix_preserving_operation f n rest >>=? fun (rest', result) -> - return (Item (v0, Item (v1, Item (v2, Item (v3, Item (v4, Item (v5, Item (v6, Item (v7, Item (v8, Item (v9, Item (va, Item (vb, Item (vc, Item (vd, Item (ve, Item (vf, rest')))))))))))))))), result) - | Prefix (Prefix (Prefix (Prefix n))), - Item (v0, Item (v1, Item (v2, Item (v3, rest)))) -> - interp_stack_prefix_preserving_operation f n rest >>=? fun (rest', result) -> - return (Item (v0, Item (v1, Item (v2, Item (v3, rest')))), result) - | Prefix n, Item (v, rest) -> - interp_stack_prefix_preserving_operation f n rest >>=? fun (rest', result) -> - return (Item (v, rest'), result) - | Rest, v -> f v +let rec interp_stack_prefix_preserving_operation : + type fbef bef faft aft result. + (fbef stack -> (faft stack * result) tzresult Lwt.t) -> + (fbef, faft, bef, aft) stack_prefix_preservation_witness -> + bef stack -> + (aft stack * result) tzresult Lwt.t = + fun f n stk -> + match (n, stk) with + | ( Prefix + (Prefix + (Prefix + (Prefix + (Prefix + (Prefix + (Prefix + (Prefix + (Prefix + (Prefix + (Prefix + (Prefix (Prefix (Prefix (Prefix (Prefix n))))))))))))))), + Item + ( v0, + Item + ( v1, + Item + ( v2, + Item + ( v3, + Item + ( v4, + Item + ( v5, + Item + ( v6, + Item + ( v7, + Item + ( v8, + Item + ( v9, + Item + ( va, + Item + ( vb, + Item + ( vc, + Item + ( vd, + Item + ( ve, + Item + (vf, rest) + ) ) ) ) ) ) ) + ) ) ) ) ) ) ) ) ) -> + interp_stack_prefix_preserving_operation f n rest + >>=? fun (rest', result) -> + return + ( Item + ( v0, + Item + ( v1, + Item + ( v2, + Item + ( v3, + Item + ( v4, + Item + ( v5, + Item + ( v6, + Item + ( v7, + Item + ( v8, + Item + ( v9, + Item + ( va, + Item + ( vb, + Item + ( vc, + Item + ( vd, + Item + ( ve, + Item + ( vf, + rest' + ) ) ) + ) ) ) ) ) ) ) ) ) + ) ) ) ), + result ) + | ( Prefix (Prefix (Prefix (Prefix n))), + Item (v0, Item (v1, Item (v2, Item (v3, rest)))) ) -> + interp_stack_prefix_preserving_operation f n rest + >>=? fun (rest', result) -> + return (Item (v0, Item (v1, Item (v2, Item (v3, rest')))), result) + | (Prefix n, Item (v, rest)) -> + interp_stack_prefix_preserving_operation f n rest + >>=? fun (rest', result) -> return (Item (v, rest'), result) + | (Rest, v) -> + f v -type step_constants = - { source : Contract.t ; - payer : Contract.t ; - self : Contract.t ; - amount : Tez.t ; - chain_id : Chain_id.t } +type step_constants = { + source : Contract.t; + payer : Contract.t; + self : Contract.t; + amount : Tez.t; + chain_id : Chain_id.t; +} -let rec step - : type b a. - (?log: execution_trace ref -> - context -> step_constants -> (b, a) descr -> b stack -> - (a stack * context) tzresult Lwt.t) = - fun ?log ctxt step_constants ({ instr ; loc ; _ } as descr) stack -> - Lwt.return (Gas.consume ctxt Interp_costs.cycle) >>=? fun ctxt -> - let logged_return : type a b. - (b, a) descr -> - a stack * context -> - (a stack * context) tzresult Lwt.t = - fun descr (ret, ctxt) -> - match log with - | None -> return (ret, ctxt) - | Some log -> - trace - Cannot_serialize_log - (unparse_stack ctxt (ret, descr.aft)) >>=? fun stack -> - log := (descr.loc, Gas.level ctxt, stack) :: !log ; - return (ret, ctxt) in - let get_log (log : execution_trace ref option) = - Option.map ~f:(fun l -> List.rev !l) log in - let consume_gas_terop : type ret arg1 arg2 arg3 rest. +let rec step : + type b a. + ?log:execution_trace ref -> + context -> + step_constants -> + (b, a) descr -> + b stack -> + (a stack * context) tzresult Lwt.t = + fun ?log ctxt step_constants ({instr; loc; _} as descr) stack -> + Lwt.return (Gas.consume ctxt Interp_costs.cycle) + >>=? fun ctxt -> + let logged_return : + type a b. + (b, a) descr -> a stack * context -> (a stack * context) tzresult Lwt.t = + fun descr (ret, ctxt) -> + match log with + | None -> + return (ret, ctxt) + | Some log -> + trace Cannot_serialize_log (unparse_stack ctxt (ret, descr.aft)) + >>=? fun stack -> + log := (descr.loc, Gas.level ctxt, stack) :: !log ; + return (ret, ctxt) + in + let get_log (log : execution_trace ref option) = + Option.map ~f:(fun l -> List.rev !l) log + in + let consume_gas_terop : + type ret arg1 arg2 arg3 rest. (_ * (_ * (_ * rest)), ret * rest) descr -> - ((arg1 -> arg2 -> arg3 -> ret) * arg1 * arg2 * arg3) -> + (arg1 -> arg2 -> arg3 -> ret) * arg1 * arg2 * arg3 -> (arg1 -> arg2 -> arg3 -> Gas.cost) -> rest stack -> ((ret * rest) stack * context) tzresult Lwt.t = - fun descr (op, x1, x2, x3) cost_func rest -> - Lwt.return (Gas.consume ctxt (cost_func x1 x2 x3)) >>=? fun ctxt -> - logged_return descr (Item (op x1 x2 x3, rest), ctxt) in - let consume_gas_binop : type ret arg1 arg2 rest. + fun descr (op, x1, x2, x3) cost_func rest -> + Lwt.return (Gas.consume ctxt (cost_func x1 x2 x3)) + >>=? fun ctxt -> logged_return descr (Item (op x1 x2 x3, rest), ctxt) + in + let consume_gas_binop : + type ret arg1 arg2 rest. (_ * (_ * rest), ret * rest) descr -> - ((arg1 -> arg2 -> ret) * arg1 * arg2) -> + (arg1 -> arg2 -> ret) * arg1 * arg2 -> (arg1 -> arg2 -> Gas.cost) -> rest stack -> context -> ((ret * rest) stack * context) tzresult Lwt.t = - fun descr (op, x1, x2) cost_func rest ctxt -> - Lwt.return (Gas.consume ctxt (cost_func x1 x2)) >>=? fun ctxt -> - logged_return descr (Item (op x1 x2, rest), ctxt) in - let consume_gas_unop : type ret arg rest. + fun descr (op, x1, x2) cost_func rest ctxt -> + Lwt.return (Gas.consume ctxt (cost_func x1 x2)) + >>=? fun ctxt -> logged_return descr (Item (op x1 x2, rest), ctxt) + in + let consume_gas_unop : + type ret arg rest. (_ * rest, ret * rest) descr -> - ((arg -> ret) * arg) -> + (arg -> ret) * arg -> (arg -> Gas.cost) -> rest stack -> context -> ((ret * rest) stack * context) tzresult Lwt.t = - fun descr (op, arg) cost_func rest ctxt -> - Lwt.return (Gas.consume ctxt (cost_func arg)) >>=? fun ctxt -> - logged_return descr (Item (op arg, rest), ctxt) in - let logged_return : - a stack * context -> - (a stack * context) tzresult Lwt.t = - logged_return descr in - match instr, stack with - (* stack ops *) - | Drop, Item (_, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.stack_op) >>=? fun ctxt -> - logged_return (rest, ctxt) - | Dup, Item (v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.stack_op) >>=? fun ctxt -> - logged_return (Item (v, Item (v, rest)), ctxt) - | Swap, Item (vi, Item (vo, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.stack_op) >>=? fun ctxt -> - logged_return (Item (vo, Item (vi, rest)), ctxt) - | Const v, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.push) >>=? fun ctxt -> - logged_return (Item (v, rest), ctxt) - (* options *) - | Cons_some, Item (v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.wrap) >>=? fun ctxt -> - logged_return (Item (Some v, rest), ctxt) - | Cons_none _, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.variant_no_data) >>=? fun ctxt -> - logged_return (Item (None, rest), ctxt) - | If_none (bt, _), Item (None, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bt rest - | If_none (_, bf), Item (Some v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bf (Item (v, rest)) - (* pairs *) - | Cons_pair, Item (a, Item (b, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.pair) >>=? fun ctxt -> - logged_return (Item ((a, b), rest), ctxt) - (* Peephole optimization for UNPAIR *) - | Seq ({instr=Dup;_}, - {instr=Seq ({instr=Car;_}, - {instr=Seq ({instr=Dip {instr=Cdr}}, - {instr=Nop;_});_});_}), - Item ((a, b), rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.pair_access) >>=? fun ctxt -> - logged_return (Item (a, Item (b, rest)), ctxt) - | Car, Item ((a, _), rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.pair_access) >>=? fun ctxt -> - logged_return (Item (a, rest), ctxt) - | Cdr, Item ((_, b), rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.pair_access) >>=? fun ctxt -> - logged_return (Item (b, rest), ctxt) - (* unions *) - | Left, Item (v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.wrap) >>=? fun ctxt -> - logged_return (Item (L v, rest), ctxt) - | Right, Item (v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.wrap) >>=? fun ctxt -> - logged_return (Item (R v, rest), ctxt) - | If_left (bt, _), Item (L v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bt (Item (v, rest)) - | If_left (_, bf), Item (R v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bf (Item (v, rest)) - (* lists *) - | Cons_list, Item (hd, Item (tl, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.cons) >>=? fun ctxt -> - logged_return (Item (hd :: tl, rest), ctxt) - | Nil, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.variant_no_data) >>=? fun ctxt -> - logged_return (Item ([], rest), ctxt) - | If_cons (_, bf), Item ([], rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bf rest - | If_cons (bt, _), Item (hd :: tl, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bt (Item (hd, Item (tl, rest))) - | List_map body, Item (l, rest) -> - let rec loop rest ctxt l acc = - Lwt.return (Gas.consume ctxt Interp_costs.loop_map) >>=? fun ctxt -> - match l with - | [] -> return (Item (List.rev acc, rest), ctxt) - | hd :: tl -> - step ?log ctxt step_constants body (Item (hd, rest)) - >>=? fun (Item (hd, rest), ctxt) -> - loop rest ctxt tl (hd :: acc) - in loop rest ctxt l [] >>=? fun (res, ctxt) -> - logged_return (res, ctxt) - | List_size, Item (list, rest) -> + fun descr (op, arg) cost_func rest ctxt -> + Lwt.return (Gas.consume ctxt (cost_func arg)) + >>=? fun ctxt -> logged_return descr (Item (op arg, rest), ctxt) + in + let logged_return : a stack * context -> (a stack * context) tzresult Lwt.t = + logged_return descr + in + match (instr, stack) with + (* stack ops *) + | (Drop, Item (_, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.stack_op) + >>=? fun ctxt -> logged_return (rest, ctxt) + | (Dup, Item (v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.stack_op) + >>=? fun ctxt -> logged_return (Item (v, Item (v, rest)), ctxt) + | (Swap, Item (vi, Item (vo, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.stack_op) + >>=? fun ctxt -> logged_return (Item (vo, Item (vi, rest)), ctxt) + | (Const v, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.push) + >>=? fun ctxt -> logged_return (Item (v, rest), ctxt) + (* options *) + | (Cons_some, Item (v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.wrap) + >>=? fun ctxt -> logged_return (Item (Some v, rest), ctxt) + | (Cons_none _, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.variant_no_data) + >>=? fun ctxt -> logged_return (Item (None, rest), ctxt) + | (If_none (bt, _), Item (None, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> step ?log ctxt step_constants bt rest + | (If_none (_, bf), Item (Some v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> step ?log ctxt step_constants bf (Item (v, rest)) + (* pairs *) + | (Cons_pair, Item (a, Item (b, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.pair) + >>=? fun ctxt -> logged_return (Item ((a, b), rest), ctxt) + | (Car, Item ((a, _), rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.pair_access) + >>=? fun ctxt -> logged_return (Item (a, rest), ctxt) + | (Cdr, Item ((_, b), rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.pair_access) + >>=? fun ctxt -> logged_return (Item (b, rest), ctxt) + (* unions *) + | (Left, Item (v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.wrap) + >>=? fun ctxt -> logged_return (Item (L v, rest), ctxt) + | (Right, Item (v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.wrap) + >>=? fun ctxt -> logged_return (Item (R v, rest), ctxt) + | (If_left (bt, _), Item (L v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> step ?log ctxt step_constants bt (Item (v, rest)) + | (If_left (_, bf), Item (R v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> step ?log ctxt step_constants bf (Item (v, rest)) + (* lists *) + | (Cons_list, Item (hd, Item (tl, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.cons) + >>=? fun ctxt -> logged_return (Item (hd :: tl, rest), ctxt) + | (Nil, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.variant_no_data) + >>=? fun ctxt -> logged_return (Item ([], rest), ctxt) + | (If_cons (_, bf), Item ([], rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> step ?log ctxt step_constants bf rest + | (If_cons (bt, _), Item (hd :: tl, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> + step ?log ctxt step_constants bt (Item (hd, Item (tl, rest))) + | (List_map body, Item (l, rest)) -> + let rec loop rest ctxt l acc = + Lwt.return (Gas.consume ctxt Interp_costs.loop_map) + >>=? fun ctxt -> + match l with + | [] -> + return (Item (List.rev acc, rest), ctxt) + | hd :: tl -> + step ?log ctxt step_constants body (Item (hd, rest)) + >>=? fun (Item (hd, rest), ctxt) -> loop rest ctxt tl (hd :: acc) + in + loop rest ctxt l [] >>=? fun (res, ctxt) -> logged_return (res, ctxt) + | (List_size, Item (list, rest)) -> + Lwt.return + (List.fold_left + (fun acc _ -> + acc + >>? fun (size, ctxt) -> + Gas.consume ctxt Interp_costs.loop_size + >>? fun ctxt -> ok (size + 1 (* FIXME: overflow *), ctxt)) + (ok (0, ctxt)) + list) + >>=? fun (len, ctxt) -> + logged_return (Item (Script_int.(abs (of_int len)), rest), ctxt) + | (List_iter body, Item (l, init)) -> + let rec loop ctxt l stack = + Lwt.return (Gas.consume ctxt Interp_costs.loop_iter) + >>=? fun ctxt -> + match l with + | [] -> + return (stack, ctxt) + | hd :: tl -> + step ?log ctxt step_constants body (Item (hd, stack)) + >>=? fun (stack, ctxt) -> loop ctxt tl stack + in + loop ctxt l init >>=? fun (res, ctxt) -> logged_return (res, ctxt) + (* sets *) + | (Empty_set t, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.empty_set) + >>=? fun ctxt -> logged_return (Item (empty_set t, rest), ctxt) + | (Set_iter body, Item (set, init)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.set_to_list set)) + >>=? fun ctxt -> + let l = List.rev (set_fold (fun e acc -> e :: acc) set []) in + let rec loop ctxt l stack = + Lwt.return (Gas.consume ctxt Interp_costs.loop_iter) + >>=? fun ctxt -> + match l with + | [] -> + return (stack, ctxt) + | hd :: tl -> + step ?log ctxt step_constants body (Item (hd, stack)) + >>=? fun (stack, ctxt) -> loop ctxt tl stack + in + loop ctxt l init >>=? fun (res, ctxt) -> logged_return (res, ctxt) + | (Set_mem, Item (v, Item (set, rest))) -> + consume_gas_binop descr (set_mem, v, set) Interp_costs.set_mem rest ctxt + | (Set_update, Item (v, Item (presence, Item (set, rest)))) -> + consume_gas_terop + descr + (set_update, v, presence, set) + Interp_costs.set_update + rest + | (Set_size, Item (set, rest)) -> + consume_gas_unop + descr + (set_size, set) + (fun _ -> Interp_costs.set_size) + rest + ctxt + (* maps *) + | (Empty_map (t, _), rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.empty_map) + >>=? fun ctxt -> logged_return (Item (empty_map t, rest), ctxt) + | (Map_map body, Item (map, rest)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.map_to_list map)) + >>=? fun ctxt -> + let l = List.rev (map_fold (fun k v acc -> (k, v) :: acc) map []) in + let rec loop rest ctxt l acc = + Lwt.return (Gas.consume ctxt Interp_costs.loop_map) + >>=? fun ctxt -> + match l with + | [] -> + return (Item (acc, rest), ctxt) + | ((k, _) as hd) :: tl -> + step ?log ctxt step_constants body (Item (hd, rest)) + >>=? fun (Item (hd, rest), ctxt) -> + loop rest ctxt tl (map_update k (Some hd) acc) + in + loop rest ctxt l (empty_map (map_key_ty map)) + >>=? fun (res, ctxt) -> logged_return (res, ctxt) + | (Map_iter body, Item (map, init)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.map_to_list map)) + >>=? fun ctxt -> + let l = List.rev (map_fold (fun k v acc -> (k, v) :: acc) map []) in + let rec loop ctxt l stack = + Lwt.return (Gas.consume ctxt Interp_costs.loop_iter) + >>=? fun ctxt -> + match l with + | [] -> + return (stack, ctxt) + | hd :: tl -> + step ?log ctxt step_constants body (Item (hd, stack)) + >>=? fun (stack, ctxt) -> loop ctxt tl stack + in + loop ctxt l init >>=? fun (res, ctxt) -> logged_return (res, ctxt) + | (Map_mem, Item (v, Item (map, rest))) -> + consume_gas_binop descr (map_mem, v, map) Interp_costs.map_mem rest ctxt + | (Map_get, Item (v, Item (map, rest))) -> + consume_gas_binop descr (map_get, v, map) Interp_costs.map_get rest ctxt + | (Map_update, Item (k, Item (v, Item (map, rest)))) -> + consume_gas_terop + descr + (map_update, k, v, map) + Interp_costs.map_update + rest + | (Map_size, Item (map, rest)) -> + consume_gas_unop + descr + (map_size, map) + (fun _ -> Interp_costs.map_size) + rest + ctxt + (* Big map operations *) + | (Empty_big_map (tk, tv), rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.empty_map) + >>=? fun ctxt -> + logged_return + (Item (Script_ir_translator.empty_big_map tk tv, rest), ctxt) + | (Big_map_mem, Item (key, Item (map, rest))) -> + Lwt.return (Gas.consume ctxt (Interp_costs.map_mem key map.diff)) + >>=? fun ctxt -> + Script_ir_translator.big_map_mem ctxt key map + >>=? fun (res, ctxt) -> logged_return (Item (res, rest), ctxt) + | (Big_map_get, Item (key, Item (map, rest))) -> + Lwt.return (Gas.consume ctxt (Interp_costs.map_get key map.diff)) + >>=? fun ctxt -> + Script_ir_translator.big_map_get ctxt key map + >>=? fun (res, ctxt) -> logged_return (Item (res, rest), ctxt) + | (Big_map_update, Item (key, Item (maybe_value, Item (map, rest)))) -> + consume_gas_terop + descr + (Script_ir_translator.big_map_update, key, maybe_value, map) + (fun k v m -> Interp_costs.map_update k (Some v) m.diff) + rest + (* timestamp operations *) + | (Add_seconds_to_timestamp, Item (n, Item (t, rest))) -> + consume_gas_binop + descr + (Script_timestamp.add_delta, t, n) + Interp_costs.add_timestamp + rest + ctxt + | (Add_timestamp_to_seconds, Item (t, Item (n, rest))) -> + consume_gas_binop + descr + (Script_timestamp.add_delta, t, n) + Interp_costs.add_timestamp + rest + ctxt + | (Sub_timestamp_seconds, Item (t, Item (s, rest))) -> + consume_gas_binop + descr + (Script_timestamp.sub_delta, t, s) + Interp_costs.sub_timestamp + rest + ctxt + | (Diff_timestamps, Item (t1, Item (t2, rest))) -> + consume_gas_binop + descr + (Script_timestamp.diff, t1, t2) + Interp_costs.diff_timestamps + rest + ctxt + (* string operations *) + | (Concat_string_pair, Item (x, Item (y, rest))) -> + Lwt.return (Gas.consume ctxt (Interp_costs.concat_string [x; y])) + >>=? fun ctxt -> + let s = String.concat "" [x; y] in + logged_return (Item (s, rest), ctxt) + | (Concat_string, Item (ss, rest)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.concat_string ss)) + >>=? fun ctxt -> + let s = String.concat "" ss in + logged_return (Item (s, rest), ctxt) + | (Slice_string, Item (offset, Item (length, Item (s, rest)))) -> + let s_length = Z.of_int (String.length s) in + let offset = Script_int.to_zint offset in + let length = Script_int.to_zint length in + if Compare.Z.(offset < s_length && Z.add offset length <= s_length) then Lwt.return - (List.fold_left - (fun acc _ -> - acc >>? fun (size, ctxt) -> - Gas.consume ctxt Interp_costs.loop_size >>? fun ctxt -> - ok (size + 1 (* FIXME: overflow *), ctxt)) - (ok (0, ctxt)) list) >>=? fun (len, ctxt) -> - logged_return (Item (Script_int.(abs (of_int len)), rest), ctxt) - | List_iter body, Item (l, init) -> - let rec loop ctxt l stack = - Lwt.return (Gas.consume ctxt Interp_costs.loop_iter) >>=? fun ctxt -> - match l with - | [] -> return (stack, ctxt) - | hd :: tl -> - step ?log ctxt step_constants body (Item (hd, stack)) - >>=? fun (stack, ctxt) -> - loop ctxt tl stack - in loop ctxt l init >>=? fun (res, ctxt) -> - logged_return (res, ctxt) - (* sets *) - | Empty_set t, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.empty_set) >>=? fun ctxt -> - logged_return (Item (empty_set t, rest), ctxt) - | Set_iter body, Item (set, init) -> - Lwt.return (Gas.consume ctxt (Interp_costs.set_to_list set)) >>=? fun ctxt -> - let l = List.rev (set_fold (fun e acc -> e :: acc) set []) in - let rec loop ctxt l stack = - Lwt.return (Gas.consume ctxt Interp_costs.loop_iter) >>=? fun ctxt -> - match l with - | [] -> return (stack, ctxt) - | hd :: tl -> - step ?log ctxt step_constants body (Item (hd, stack)) - >>=? fun (stack, ctxt) -> - loop ctxt tl stack - in loop ctxt l init >>=? fun (res, ctxt) -> - logged_return (res, ctxt) - | Set_mem, Item (v, Item (set, rest)) -> - consume_gas_binop descr (set_mem, v, set) Interp_costs.set_mem rest ctxt - | Set_update, Item (v, Item (presence, Item (set, rest))) -> - consume_gas_terop descr (set_update, v, presence, set) Interp_costs.set_update rest - | Set_size, Item (set, rest) -> - consume_gas_unop descr (set_size, set) (fun _ -> Interp_costs.set_size) rest ctxt - (* maps *) - | Empty_map (t, _), rest -> - Lwt.return (Gas.consume ctxt Interp_costs.empty_map) >>=? fun ctxt -> - logged_return (Item (empty_map t, rest), ctxt) - | Map_map body, Item (map, rest) -> - Lwt.return (Gas.consume ctxt (Interp_costs.map_to_list map)) >>=? fun ctxt -> - let l = List.rev (map_fold (fun k v acc -> (k, v) :: acc) map []) in - let rec loop rest ctxt l acc = - Lwt.return (Gas.consume ctxt Interp_costs.loop_map) >>=? fun ctxt -> - match l with - | [] -> return (acc, ctxt) - | (k, _) as hd :: tl -> - step ?log ctxt step_constants body (Item (hd, rest)) - >>=? fun (Item (hd, rest), ctxt) -> - loop rest ctxt tl (map_update k (Some hd) acc) - in loop rest ctxt l (empty_map (map_key_ty map)) >>=? fun (res, ctxt) -> - logged_return (Item (res, rest), ctxt) - | Map_iter body, Item (map, init) -> - Lwt.return (Gas.consume ctxt (Interp_costs.map_to_list map)) >>=? fun ctxt -> - let l = List.rev (map_fold (fun k v acc -> (k, v) :: acc) map []) in - let rec loop ctxt l stack = - Lwt.return (Gas.consume ctxt Interp_costs.loop_iter) >>=? fun ctxt -> - match l with - | [] -> return (stack, ctxt) - | hd :: tl -> - step ?log ctxt step_constants body (Item (hd, stack)) - >>=? fun (stack, ctxt) -> - loop ctxt tl stack - in loop ctxt l init >>=? fun (res, ctxt) -> - logged_return (res, ctxt) - | Map_mem, Item (v, Item (map, rest)) -> - consume_gas_binop descr (map_mem, v, map) Interp_costs.map_mem rest ctxt - | Map_get, Item (v, Item (map, rest)) -> - consume_gas_binop descr (map_get, v, map) Interp_costs.map_get rest ctxt - | Map_update, Item (k, Item (v, Item (map, rest))) -> - consume_gas_terop descr (map_update, k, v, map) Interp_costs.map_update rest - | Map_size, Item (map, rest) -> - consume_gas_unop descr (map_size, map) (fun _ -> Interp_costs.map_size) rest ctxt - (* Big map operations *) - | Empty_big_map (tk, tv), rest -> - Lwt.return (Gas.consume ctxt Interp_costs.empty_map) >>=? fun ctxt -> - logged_return (Item (Script_ir_translator.empty_big_map tk tv, rest), ctxt) - | Big_map_mem, Item (key, Item (map, rest)) -> - Lwt.return (Gas.consume ctxt (Interp_costs.map_mem key map.diff)) >>=? fun ctxt -> - Script_ir_translator.big_map_mem ctxt key map >>=? fun (res, ctxt) -> - logged_return (Item (res, rest), ctxt) - | Big_map_get, Item (key, Item (map, rest)) -> - Lwt.return (Gas.consume ctxt (Interp_costs.map_get key map.diff)) >>=? fun ctxt -> - Script_ir_translator.big_map_get ctxt key map >>=? fun (res, ctxt) -> - logged_return (Item (res, rest), ctxt) - | Big_map_update, Item (key, Item (maybe_value, Item (map, rest))) -> - consume_gas_terop descr - (Script_ir_translator.big_map_update, key, maybe_value, map) - (fun k v m -> Interp_costs.map_update k (Some v) m.diff) rest - (* timestamp operations *) - | Add_seconds_to_timestamp, Item (n, Item (t, rest)) -> - consume_gas_binop descr - (Script_timestamp.add_delta, t, n) - Interp_costs.add_timestamp rest ctxt - | Add_timestamp_to_seconds, Item (t, Item (n, rest)) -> - consume_gas_binop descr (Script_timestamp.add_delta, t, n) - Interp_costs.add_timestamp rest ctxt - | Sub_timestamp_seconds, Item (t, Item (s, rest)) -> - consume_gas_binop descr (Script_timestamp.sub_delta, t, s) - Interp_costs.sub_timestamp rest ctxt - | Diff_timestamps, Item (t1, Item (t2, rest)) -> - consume_gas_binop descr (Script_timestamp.diff, t1, t2) - Interp_costs.diff_timestamps rest ctxt - (* string operations *) - | Concat_string_pair, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt (Interp_costs.concat_string [x; y])) >>=? fun ctxt -> - let s = String.concat "" [x; y] in - logged_return (Item (s, rest), ctxt) - | Concat_string, Item (ss, rest) -> - Lwt.return (Gas.consume ctxt (Interp_costs.concat_string ss)) >>=? fun ctxt -> - let s = String.concat "" ss in - logged_return (Item (s, rest), ctxt) - | Slice_string, Item (offset, Item (length, Item (s, rest))) -> - let s_length = Z.of_int (String.length s) in - let offset = Script_int.to_zint offset in - let length = Script_int.to_zint length in - if Compare.Z.(offset < s_length && Z.add offset length <= s_length) then - Lwt.return (Gas.consume ctxt (Interp_costs.slice_string (Z.to_int length))) >>=? fun ctxt -> - logged_return (Item (Some (String.sub s (Z.to_int offset) (Z.to_int length)), rest), ctxt) - else - Lwt.return (Gas.consume ctxt (Interp_costs.slice_string 0)) >>=? fun ctxt -> - logged_return (Item (None, rest), ctxt) - | String_size, Item (s, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.push) >>=? fun ctxt -> - logged_return (Item (Script_int.(abs (of_int (String.length s))), rest), ctxt) - (* bytes operations *) - | Concat_bytes_pair, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt (Interp_costs.concat_bytes [x; y])) >>=? fun ctxt -> - let s = MBytes.concat "" [x; y] in - logged_return (Item (s, rest), ctxt) - | Concat_bytes, Item (ss, rest) -> - Lwt.return (Gas.consume ctxt (Interp_costs.concat_bytes ss)) >>=? fun ctxt -> - let s = MBytes.concat "" ss in - logged_return (Item (s, rest), ctxt) - | Slice_bytes, Item (offset, Item (length, Item (s, rest))) -> - let s_length = Z.of_int (MBytes.length s) in - let offset = Script_int.to_zint offset in - let length = Script_int.to_zint length in - if Compare.Z.(offset < s_length && Z.add offset length <= s_length) then - Lwt.return (Gas.consume ctxt (Interp_costs.slice_string (Z.to_int length))) >>=? fun ctxt -> - logged_return (Item (Some (MBytes.sub s (Z.to_int offset) (Z.to_int length)), rest), ctxt) - else - Lwt.return (Gas.consume ctxt (Interp_costs.slice_string 0)) >>=? fun ctxt -> - logged_return (Item (None, rest), ctxt) - | Bytes_size, Item (s, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.push) >>=? fun ctxt -> - logged_return (Item (Script_int.(abs (of_int (MBytes.length s))), rest), ctxt) - (* currency operations *) - | Add_tez, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.int64_op) >>=? fun ctxt -> - Lwt.return Tez.(x +? y) >>=? fun res -> - logged_return (Item (res, rest), ctxt) - | Sub_tez, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.int64_op) >>=? fun ctxt -> - Lwt.return Tez.(x -? y) >>=? fun res -> - logged_return (Item (res, rest), ctxt) - | Mul_teznat, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.int64_op) >>=? fun ctxt -> - Lwt.return (Gas.consume ctxt Interp_costs.z_to_int64) >>=? fun ctxt -> - begin - match Script_int.to_int64 y with - | None -> fail (Overflow (loc, get_log log)) - | Some y -> - Lwt.return Tez.(x *? y) >>=? fun res -> - logged_return (Item (res, rest), ctxt) - end - | Mul_nattez, Item (y, Item (x, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.int64_op) >>=? fun ctxt -> - Lwt.return (Gas.consume ctxt Interp_costs.z_to_int64) >>=? fun ctxt -> - begin - match Script_int.to_int64 y with - | None -> fail (Overflow (loc, get_log log)) - | Some y -> - Lwt.return Tez.(x *? y) >>=? fun res -> - logged_return (Item (res, rest), ctxt) - end - (* boolean operations *) - | Or, Item (x, Item (y, rest)) -> - consume_gas_binop descr ((||), x, y) Interp_costs.bool_binop rest ctxt - | And, Item (x, Item (y, rest)) -> - consume_gas_binop descr ((&&), x, y) Interp_costs.bool_binop rest ctxt - | Xor, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Compare.Bool.(<>), x, y) Interp_costs.bool_binop rest ctxt - | Not, Item (x, rest) -> - consume_gas_unop descr (not, x) Interp_costs.bool_unop rest ctxt - (* integer operations *) - | Is_nat, Item (x, rest) -> - consume_gas_unop descr (Script_int.is_nat, x) Interp_costs.abs rest ctxt - | Abs_int, Item (x, rest) -> - consume_gas_unop descr (Script_int.abs, x) Interp_costs.abs rest ctxt - | Int_nat, Item (x, rest) -> - consume_gas_unop descr (Script_int.int, x) Interp_costs.int rest ctxt - | Neg_int, Item (x, rest) -> - consume_gas_unop descr (Script_int.neg, x) Interp_costs.neg rest ctxt - | Neg_nat, Item (x, rest) -> - consume_gas_unop descr (Script_int.neg, x) Interp_costs.neg rest ctxt - | Add_intint, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.add, x, y) Interp_costs.add rest ctxt - | Add_intnat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.add, x, y) Interp_costs.add rest ctxt - | Add_natint, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.add, x, y) Interp_costs.add rest ctxt - | Add_natnat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.add_n, x, y) Interp_costs.add rest ctxt - | Sub_int, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.sub, x, y) Interp_costs.sub rest ctxt - | Mul_intint, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.mul, x, y) Interp_costs.mul rest ctxt - | Mul_intnat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.mul, x, y) Interp_costs.mul rest ctxt - | Mul_natint, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.mul, x, y) Interp_costs.mul rest ctxt - | Mul_natnat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.mul_n, x, y) Interp_costs.mul rest ctxt - | Ediv_teznat, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.int64_to_z) >>=? fun ctxt -> - let x = Script_int.of_int64 (Tez.to_mutez x) in - consume_gas_binop descr - ((fun x y -> - match Script_int.ediv x y with - | None -> None - | Some (q, r) -> - match Script_int.to_int64 q, - Script_int.to_int64 r with - | Some q, Some r -> - begin - match Tez.of_mutez q, Tez.of_mutez r with - | Some q, Some r -> Some (q,r) - (* Cannot overflow *) - | _ -> assert false - end - (* Cannot overflow *) - | _ -> assert false), - x, y) - Interp_costs.div - rest - ctxt - | Ediv_tez, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.int64_to_z) >>=? fun ctxt -> - Lwt.return (Gas.consume ctxt Interp_costs.int64_to_z) >>=? fun ctxt -> - let x = Script_int.abs (Script_int.of_int64 (Tez.to_mutez x)) in - let y = Script_int.abs (Script_int.of_int64 (Tez.to_mutez y)) in - consume_gas_binop descr - ((fun x y -> match Script_int.ediv_n x y with - | None -> None - | Some (q, r) -> - match Script_int.to_int64 r with - | None -> assert false (* Cannot overflow *) - | Some r -> - match Tez.of_mutez r with - | None -> assert false (* Cannot overflow *) - | Some r -> Some (q, r)), - x, y) - Interp_costs.div - rest - ctxt - | Ediv_intint, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.ediv, x, y) Interp_costs.div rest ctxt - | Ediv_intnat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.ediv, x, y) Interp_costs.div rest ctxt - | Ediv_natint, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.ediv, x, y) Interp_costs.div rest ctxt - | Ediv_natnat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.ediv_n, x, y) Interp_costs.div rest ctxt - | Lsl_nat, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt (Interp_costs.shift_left x y)) >>=? fun ctxt -> - begin - match Script_int.shift_left_n x y with - | None -> fail (Overflow (loc, get_log log)) - | Some x -> logged_return (Item (x, rest), ctxt) - end - | Lsr_nat, Item (x, Item (y, rest)) -> - Lwt.return (Gas.consume ctxt (Interp_costs.shift_right x y)) >>=? fun ctxt -> - begin - match Script_int.shift_right_n x y with - | None -> fail (Overflow (loc, get_log log)) - | Some r -> logged_return (Item (r, rest), ctxt) - end - | Or_nat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.logor, x, y) Interp_costs.logor rest ctxt - | And_nat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.logand, x, y) Interp_costs.logand rest ctxt - | And_int_nat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.logand, x, y) Interp_costs.logand rest ctxt - | Xor_nat, Item (x, Item (y, rest)) -> - consume_gas_binop descr (Script_int.logxor, x, y) Interp_costs.logxor rest ctxt - | Not_int, Item (x, rest) -> - consume_gas_unop descr (Script_int.lognot, x) Interp_costs.lognot rest ctxt - | Not_nat, Item (x, rest) -> - consume_gas_unop descr (Script_int.lognot, x) Interp_costs.lognot rest ctxt - (* control *) - | Seq (hd, tl), stack -> - step ?log ctxt step_constants hd stack >>=? fun (trans, ctxt) -> - step ?log ctxt step_constants tl trans - | If (bt, _), Item (true, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bt rest - | If (_, bf), Item (false, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.branch) >>=? fun ctxt -> - step ?log ctxt step_constants bf rest - | Loop body, Item (true, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.loop_cycle) >>=? fun ctxt -> - step ?log ctxt step_constants body rest >>=? fun (trans, ctxt) -> - step ?log ctxt step_constants descr trans - | Loop _, Item (false, rest) -> - logged_return (rest, ctxt) - | Loop_left body, Item (L v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.loop_cycle) >>=? fun ctxt -> - step ?log ctxt step_constants body (Item (v, rest)) >>=? fun (trans, ctxt) -> - step ?log ctxt step_constants descr trans - | Loop_left _, Item (R v, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.loop_cycle) >>=? fun ctxt -> - logged_return (Item (v, rest), ctxt) - | Dip b, Item (ign, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.stack_op) >>=? fun ctxt -> - step ?log ctxt step_constants b rest >>=? fun (res, ctxt) -> - logged_return (Item (ign, res), ctxt) - | Exec, Item (arg, Item (lam, rest)) -> - Lwt.return (Gas.consume ctxt Interp_costs.exec) >>=? fun ctxt -> - interp ?log ctxt step_constants lam arg >>=? fun (res, ctxt) -> - logged_return (Item (res, rest), ctxt) - | Apply capture_ty, Item (capture, Item (lam, rest)) -> ( - Lwt.return (Gas.consume ctxt Interp_costs.apply) >>=? fun ctxt -> - let (Lam (descr, expr)) = lam in - let (Item_t (full_arg_ty , _ , _)) = descr.bef in - unparse_data ctxt Optimized capture_ty capture >>=? fun (const_expr, ctxt) -> - unparse_ty ctxt capture_ty >>=? fun (ty_expr, ctxt) -> - match full_arg_ty with - | Pair_t ((capture_ty, _, _), (arg_ty, _, _), _, _) -> ( - let arg_stack_ty = Item_t (arg_ty, Empty_t, None) in - let const_descr = ({ - loc = descr.loc ; - bef = arg_stack_ty ; - aft = Item_t (capture_ty, arg_stack_ty, None) ; - instr = Const capture ; - } : (_, _) descr) in - let pair_descr = ({ - loc = descr.loc ; - bef = Item_t (capture_ty, arg_stack_ty, None) ; - aft = Item_t (full_arg_ty, Empty_t, None) ; - instr = Cons_pair ; - } : (_, _) descr) in - let seq_descr = ({ - loc = descr.loc ; - bef = arg_stack_ty ; - aft = Item_t (full_arg_ty, Empty_t, None) ; - instr = Seq (const_descr, pair_descr) ; - } : (_, _) descr) in - let full_descr = ({ - loc = descr.loc ; - bef = arg_stack_ty ; - aft = descr.aft ; - instr = Seq (seq_descr, descr) ; - } : (_, _) descr) in - let full_expr = Micheline.Seq (0, [ - Prim (0, I_PUSH, [ ty_expr ; const_expr ], []) ; - Prim (0, I_PAIR, [], []) ; - expr ]) in - let lam' = Lam (full_descr, full_expr) in - logged_return (Item (lam', rest), ctxt) - ) - | _ -> assert false - ) - | Lambda lam, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.push) >>=? fun ctxt -> - logged_return (Item (lam, rest), ctxt) - | Failwith tv, Item (v, _) -> - trace Cannot_serialize_failure - (unparse_data ctxt Optimized tv v) >>=? fun (v, _ctxt) -> - let v = Micheline.strip_locations v in - fail (Reject (loc, v, get_log log)) - | Nop, stack -> - logged_return (stack, ctxt) - (* comparison *) - | Compare ty, Item (a, Item (b, rest)) -> - Lwt.return (Gas.consume ctxt (Interp_costs.compare ty a b)) >>=? fun ctxt -> - logged_return (Item (Script_int.of_int @@ Script_ir_translator.compare_comparable ty a b, rest), ctxt) - (* comparators *) - | Eq, Item (cmpres, rest) -> - let cmpres = Script_int.compare cmpres Script_int.zero in - let cmpres = Compare.Int.(cmpres = 0) in - Lwt.return (Gas.consume ctxt Interp_costs.compare_res) >>=? fun ctxt -> - logged_return (Item (cmpres, rest), ctxt) - | Neq, Item (cmpres, rest) -> - let cmpres = Script_int.compare cmpres Script_int.zero in - let cmpres = Compare.Int.(cmpres <> 0) in - Lwt.return (Gas.consume ctxt Interp_costs.compare_res) >>=? fun ctxt -> - logged_return (Item (cmpres, rest), ctxt) - | Lt, Item (cmpres, rest) -> - let cmpres = Script_int.compare cmpres Script_int.zero in - let cmpres = Compare.Int.(cmpres < 0) in - Lwt.return (Gas.consume ctxt Interp_costs.compare_res) >>=? fun ctxt -> - logged_return (Item (cmpres, rest), ctxt) - | Le, Item (cmpres, rest) -> - let cmpres = Script_int.compare cmpres Script_int.zero in - let cmpres = Compare.Int.(cmpres <= 0) in - Lwt.return (Gas.consume ctxt Interp_costs.compare_res) >>=? fun ctxt -> - logged_return (Item (cmpres, rest), ctxt) - | Gt, Item (cmpres, rest) -> - let cmpres = Script_int.compare cmpres Script_int.zero in - let cmpres = Compare.Int.(cmpres > 0) in - Lwt.return (Gas.consume ctxt Interp_costs.compare_res) >>=? fun ctxt -> - logged_return (Item (cmpres, rest), ctxt) - | Ge, Item (cmpres, rest) -> - let cmpres = Script_int.compare cmpres Script_int.zero in - let cmpres = Compare.Int.(cmpres >= 0) in - Lwt.return (Gas.consume ctxt Interp_costs.compare_res) >>=? fun ctxt -> - logged_return (Item (cmpres, rest), ctxt) - (* packing *) - | Pack t, Item (value, rest) -> - Script_ir_translator.pack_data ctxt t value >>=? fun (bytes, ctxt) -> - logged_return (Item (bytes, rest), ctxt) - | Unpack t, Item (bytes, rest) -> - Lwt.return (Gas.check_enough ctxt (Script.serialized_cost bytes)) >>=? fun () -> - if Compare.Int.(MBytes.length bytes >= 1) && - Compare.Int.(MBytes.get_uint8 bytes 0 = 0x05) then - let bytes = MBytes.sub bytes 1 (MBytes.length bytes - 1) in - match Data_encoding.Binary.of_bytes Script.expr_encoding bytes with - | None -> - Lwt.return (Gas.consume ctxt (Interp_costs.unpack_failed bytes)) >>=? fun ctxt -> - logged_return (Item (None, rest), ctxt) - | Some expr -> - Lwt.return (Gas.consume ctxt (Script.deserialized_cost expr)) >>=? fun ctxt -> - parse_data ctxt ~legacy:false t (Micheline.root expr) >>= function - | Ok (value, ctxt) -> - logged_return (Item (Some value, rest), ctxt) - | Error _ignored -> - Lwt.return (Gas.consume ctxt (Interp_costs.unpack_failed bytes)) >>=? fun ctxt -> - logged_return (Item (None, rest), ctxt) - else - logged_return (Item (None, rest), ctxt) - (* protocol *) - | Address, Item ((_, address), rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.address) >>=? fun ctxt -> - logged_return (Item (address, rest), ctxt) - | Contract (t, entrypoint), Item (contract, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.contract) >>=? fun ctxt -> - begin match contract, entrypoint with - | (contract, "default"), entrypoint | (contract, entrypoint), "default" -> - Script_ir_translator.parse_contract_for_script - ~legacy:false ctxt loc t contract ~entrypoint >>=? fun (ctxt, maybe_contract) -> - logged_return (Item (maybe_contract, rest), ctxt) - | _ -> logged_return (Item (None, rest), ctxt) - end - | Transfer_tokens, - Item (p, Item (amount, Item ((tp, (destination, entrypoint)), rest))) -> - Lwt.return (Gas.consume ctxt Interp_costs.transfer) >>=? fun ctxt -> - collect_big_maps ctxt tp p >>=? fun (to_duplicate, ctxt) -> - let to_update = no_big_map_id in - extract_big_map_diff ctxt Optimized tp p - ~to_duplicate ~to_update ~temporary:true >>=? fun (p, big_map_diff, ctxt) -> - unparse_data ctxt Optimized tp p >>=? fun (p, ctxt) -> - let operation = - Transaction - { amount ; destination ; entrypoint ; - parameters = Script.lazy_expr (Micheline.strip_locations p) } in - Lwt.return (fresh_internal_nonce ctxt) >>=? fun (ctxt, nonce) -> - logged_return (Item ((Internal_operation { source = step_constants.self ; operation ; nonce }, big_map_diff), rest), ctxt) - | Create_account, - Item (manager, Item (delegate, Item (_delegatable, Item (credit, rest)))) -> - Lwt.return (Gas.consume ctxt Interp_costs.create_account) >>=? fun ctxt -> - Contract.fresh_contract_from_current_nonce ctxt >>=? fun (ctxt, contract) -> - (* store in optimized binary representation - as unparsed with [Optimized]. *) - let manager_bytes = - Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding manager in - let storage = - Script_repr.lazy_expr @@ Micheline.strip_locations @@ - Micheline.Bytes (0, manager_bytes) in - let script = - { code = Legacy_support.manager_script_code ; - storage ; - } in - let operation = - Origination - { credit ; delegate ; preorigination = Some contract ; script } in - Lwt.return (fresh_internal_nonce ctxt) >>=? fun (ctxt, nonce) -> - logged_return (Item ((Internal_operation { source = step_constants.self ; operation ; nonce }, None), - Item ((contract, "default"), rest)), ctxt) - | Implicit_account, Item (key, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.implicit_account) >>=? fun ctxt -> - let contract = Contract.implicit_contract key in - logged_return (Item ((Unit_t None, (contract, "default")), rest), ctxt) - | Create_contract (storage_type, param_type, Lam (_, code), root_name), - Item (manager, Item - (delegate, Item - (spendable, Item - (delegatable, Item - (credit, Item - (init, rest)))))) -> - Lwt.return (Gas.consume ctxt Interp_costs.create_contract) >>=? fun ctxt -> - unparse_ty ctxt param_type >>=? fun (unparsed_param_type, ctxt) -> - let unparsed_param_type = - Script_ir_translator.add_field_annot (Option.map ~f:(fun n -> `Field_annot n) root_name) None unparsed_param_type in - unparse_ty ctxt storage_type >>=? fun (unparsed_storage_type, ctxt) -> - let code = - Script.lazy_expr @@ - Micheline.strip_locations - (Seq (0, [ Prim (0, K_parameter, [ unparsed_param_type ], []) ; - Prim (0, K_storage, [ unparsed_storage_type ], []) ; - Prim (0, K_code, [ code ], []) ])) in - collect_big_maps ctxt storage_type init >>=? fun (to_duplicate, ctxt) -> - let to_update = no_big_map_id in - extract_big_map_diff ctxt Optimized storage_type init - ~to_duplicate ~to_update ~temporary:true >>=? fun (init, big_map_diff, ctxt) -> - unparse_data ctxt Optimized storage_type init >>=? fun (storage, ctxt) -> - let storage = Script.lazy_expr @@ Micheline.strip_locations storage in - begin - if spendable then - Legacy_support.add_do ~manager_pkh:manager - ~script_code:code ~script_storage:storage - else if delegatable then - Legacy_support.add_set_delegate ~manager_pkh:manager - ~script_code:code ~script_storage:storage - else if Legacy_support.has_default_entrypoint code then - Legacy_support.add_root_entrypoint code >>=? fun code -> - return (code, storage) - else return (code, storage) - end >>=? fun (code, storage) -> - Contract.fresh_contract_from_current_nonce ctxt >>=? fun (ctxt, contract) -> - let operation = - Origination - { credit ; delegate ; preorigination = Some contract ; - script = { code ; storage } } in - Lwt.return (fresh_internal_nonce ctxt) >>=? fun (ctxt, nonce) -> + (Gas.consume ctxt (Interp_costs.slice_string (Z.to_int length))) + >>=? fun ctxt -> logged_return - (Item ((Internal_operation { source = step_constants.self ; operation ; nonce }, big_map_diff), - Item ((contract, "default"), rest)), ctxt) - | Create_contract_2 (storage_type, param_type, Lam (_, code), root_name), + ( Item (Some (String.sub s (Z.to_int offset) (Z.to_int length)), rest), + ctxt ) + else + Lwt.return (Gas.consume ctxt (Interp_costs.slice_string 0)) + >>=? fun ctxt -> logged_return (Item (None, rest), ctxt) + | (String_size, Item (s, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.push) + >>=? fun ctxt -> + logged_return + (Item (Script_int.(abs (of_int (String.length s))), rest), ctxt) + (* bytes operations *) + | (Concat_bytes_pair, Item (x, Item (y, rest))) -> + Lwt.return (Gas.consume ctxt (Interp_costs.concat_bytes [x; y])) + >>=? fun ctxt -> + let s = MBytes.concat "" [x; y] in + logged_return (Item (s, rest), ctxt) + | (Concat_bytes, Item (ss, rest)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.concat_bytes ss)) + >>=? fun ctxt -> + let s = MBytes.concat "" ss in + logged_return (Item (s, rest), ctxt) + | (Slice_bytes, Item (offset, Item (length, Item (s, rest)))) -> + let s_length = Z.of_int (MBytes.length s) in + let offset = Script_int.to_zint offset in + let length = Script_int.to_zint length in + if Compare.Z.(offset < s_length && Z.add offset length <= s_length) then + Lwt.return + (Gas.consume ctxt (Interp_costs.slice_string (Z.to_int length))) + >>=? fun ctxt -> + logged_return + ( Item (Some (MBytes.sub s (Z.to_int offset) (Z.to_int length)), rest), + ctxt ) + else + Lwt.return (Gas.consume ctxt (Interp_costs.slice_string 0)) + >>=? fun ctxt -> logged_return (Item (None, rest), ctxt) + | (Bytes_size, Item (s, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.push) + >>=? fun ctxt -> + logged_return + (Item (Script_int.(abs (of_int (MBytes.length s))), rest), ctxt) + (* currency operations *) + | (Add_tez, Item (x, Item (y, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.int64_op) + >>=? fun ctxt -> + Lwt.return Tez.(x +? y) + >>=? fun res -> logged_return (Item (res, rest), ctxt) + | (Sub_tez, Item (x, Item (y, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.int64_op) + >>=? fun ctxt -> + Lwt.return Tez.(x -? y) + >>=? fun res -> logged_return (Item (res, rest), ctxt) + | (Mul_teznat, Item (x, Item (y, rest))) -> ( + Lwt.return (Gas.consume ctxt Interp_costs.int64_op) + >>=? fun ctxt -> + Lwt.return (Gas.consume ctxt Interp_costs.z_to_int64) + >>=? fun ctxt -> + match Script_int.to_int64 y with + | None -> + fail (Overflow (loc, get_log log)) + | Some y -> + Lwt.return Tez.(x *? y) + >>=? fun res -> logged_return (Item (res, rest), ctxt) ) + | (Mul_nattez, Item (y, Item (x, rest))) -> ( + Lwt.return (Gas.consume ctxt Interp_costs.int64_op) + >>=? fun ctxt -> + Lwt.return (Gas.consume ctxt Interp_costs.z_to_int64) + >>=? fun ctxt -> + match Script_int.to_int64 y with + | None -> + fail (Overflow (loc, get_log log)) + | Some y -> + Lwt.return Tez.(x *? y) + >>=? fun res -> logged_return (Item (res, rest), ctxt) ) + (* boolean operations *) + | (Or, Item (x, Item (y, rest))) -> + consume_gas_binop descr (( || ), x, y) Interp_costs.bool_binop rest ctxt + | (And, Item (x, Item (y, rest))) -> + consume_gas_binop descr (( && ), x, y) Interp_costs.bool_binop rest ctxt + | (Xor, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Compare.Bool.( <> ), x, y) + Interp_costs.bool_binop + rest + ctxt + | (Not, Item (x, rest)) -> + consume_gas_unop descr (not, x) Interp_costs.bool_unop rest ctxt + (* integer operations *) + | (Is_nat, Item (x, rest)) -> + consume_gas_unop descr (Script_int.is_nat, x) Interp_costs.abs rest ctxt + | (Abs_int, Item (x, rest)) -> + consume_gas_unop descr (Script_int.abs, x) Interp_costs.abs rest ctxt + | (Int_nat, Item (x, rest)) -> + consume_gas_unop descr (Script_int.int, x) Interp_costs.int rest ctxt + | (Neg_int, Item (x, rest)) -> + consume_gas_unop descr (Script_int.neg, x) Interp_costs.neg rest ctxt + | (Neg_nat, Item (x, rest)) -> + consume_gas_unop descr (Script_int.neg, x) Interp_costs.neg rest ctxt + | (Add_intint, Item (x, Item (y, rest))) -> + consume_gas_binop descr (Script_int.add, x, y) Interp_costs.add rest ctxt + | (Add_intnat, Item (x, Item (y, rest))) -> + consume_gas_binop descr (Script_int.add, x, y) Interp_costs.add rest ctxt + | (Add_natint, Item (x, Item (y, rest))) -> + consume_gas_binop descr (Script_int.add, x, y) Interp_costs.add rest ctxt + | (Add_natnat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.add_n, x, y) + Interp_costs.add + rest + ctxt + | (Sub_int, Item (x, Item (y, rest))) -> + consume_gas_binop descr (Script_int.sub, x, y) Interp_costs.sub rest ctxt + | (Mul_intint, Item (x, Item (y, rest))) -> + consume_gas_binop descr (Script_int.mul, x, y) Interp_costs.mul rest ctxt + | (Mul_intnat, Item (x, Item (y, rest))) -> + consume_gas_binop descr (Script_int.mul, x, y) Interp_costs.mul rest ctxt + | (Mul_natint, Item (x, Item (y, rest))) -> + consume_gas_binop descr (Script_int.mul, x, y) Interp_costs.mul rest ctxt + | (Mul_natnat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.mul_n, x, y) + Interp_costs.mul + rest + ctxt + | (Ediv_teznat, Item (x, Item (y, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.int64_to_z) + >>=? fun ctxt -> + let x = Script_int.of_int64 (Tez.to_mutez x) in + consume_gas_binop + descr + ( (fun x y -> + match Script_int.ediv x y with + | None -> + None + | Some (q, r) -> ( + match (Script_int.to_int64 q, Script_int.to_int64 r) with + | (Some q, Some r) -> ( + match (Tez.of_mutez q, Tez.of_mutez r) with + | (Some q, Some r) -> + Some (q, r) + (* Cannot overflow *) + | _ -> + assert false ) + (* Cannot overflow *) + | _ -> + assert false )), + x, + y ) + Interp_costs.div + rest + ctxt + | (Ediv_tez, Item (x, Item (y, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.int64_to_z) + >>=? fun ctxt -> + Lwt.return (Gas.consume ctxt Interp_costs.int64_to_z) + >>=? fun ctxt -> + let x = Script_int.abs (Script_int.of_int64 (Tez.to_mutez x)) in + let y = Script_int.abs (Script_int.of_int64 (Tez.to_mutez y)) in + consume_gas_binop + descr + ( (fun x y -> + match Script_int.ediv_n x y with + | None -> + None + | Some (q, r) -> ( + match Script_int.to_int64 r with + | None -> + assert false (* Cannot overflow *) + | Some r -> ( + match Tez.of_mutez r with + | None -> + assert false (* Cannot overflow *) + | Some r -> + Some (q, r) ) )), + x, + y ) + Interp_costs.div + rest + ctxt + | (Ediv_intint, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.ediv, x, y) + Interp_costs.div + rest + ctxt + | (Ediv_intnat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.ediv, x, y) + Interp_costs.div + rest + ctxt + | (Ediv_natint, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.ediv, x, y) + Interp_costs.div + rest + ctxt + | (Ediv_natnat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.ediv_n, x, y) + Interp_costs.div + rest + ctxt + | (Lsl_nat, Item (x, Item (y, rest))) -> ( + Lwt.return (Gas.consume ctxt (Interp_costs.shift_left x y)) + >>=? fun ctxt -> + match Script_int.shift_left_n x y with + | None -> + fail (Overflow (loc, get_log log)) + | Some x -> + logged_return (Item (x, rest), ctxt) ) + | (Lsr_nat, Item (x, Item (y, rest))) -> ( + Lwt.return (Gas.consume ctxt (Interp_costs.shift_right x y)) + >>=? fun ctxt -> + match Script_int.shift_right_n x y with + | None -> + fail (Overflow (loc, get_log log)) + | Some r -> + logged_return (Item (r, rest), ctxt) ) + | (Or_nat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.logor, x, y) + Interp_costs.logor + rest + ctxt + | (And_nat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.logand, x, y) + Interp_costs.logand + rest + ctxt + | (And_int_nat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.logand, x, y) + Interp_costs.logand + rest + ctxt + | (Xor_nat, Item (x, Item (y, rest))) -> + consume_gas_binop + descr + (Script_int.logxor, x, y) + Interp_costs.logxor + rest + ctxt + | (Not_int, Item (x, rest)) -> + consume_gas_unop + descr + (Script_int.lognot, x) + Interp_costs.lognot + rest + ctxt + | (Not_nat, Item (x, rest)) -> + consume_gas_unop + descr + (Script_int.lognot, x) + Interp_costs.lognot + rest + ctxt + (* control *) + | (Seq (hd, tl), stack) -> + step ?log ctxt step_constants hd stack + >>=? fun (trans, ctxt) -> step ?log ctxt step_constants tl trans + | (If (bt, _), Item (true, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> step ?log ctxt step_constants bt rest + | (If (_, bf), Item (false, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.branch) + >>=? fun ctxt -> step ?log ctxt step_constants bf rest + | (Loop body, Item (true, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.loop_cycle) + >>=? fun ctxt -> + step ?log ctxt step_constants body rest + >>=? fun (trans, ctxt) -> step ?log ctxt step_constants descr trans + | (Loop _, Item (false, rest)) -> + logged_return (rest, ctxt) + | (Loop_left body, Item (L v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.loop_cycle) + >>=? fun ctxt -> + step ?log ctxt step_constants body (Item (v, rest)) + >>=? fun (trans, ctxt) -> step ?log ctxt step_constants descr trans + | (Loop_left _, Item (R v, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.loop_cycle) + >>=? fun ctxt -> logged_return (Item (v, rest), ctxt) + | (Dip b, Item (ign, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.stack_op) + >>=? fun ctxt -> + step ?log ctxt step_constants b rest + >>=? fun (res, ctxt) -> logged_return (Item (ign, res), ctxt) + | (Exec, Item (arg, Item (lam, rest))) -> + Lwt.return (Gas.consume ctxt Interp_costs.exec) + >>=? fun ctxt -> + interp ?log ctxt step_constants lam arg + >>=? fun (res, ctxt) -> logged_return (Item (res, rest), ctxt) + | (Apply capture_ty, Item (capture, Item (lam, rest))) -> ( + Lwt.return (Gas.consume ctxt Interp_costs.apply) + >>=? fun ctxt -> + let (Lam (descr, expr)) = lam in + let (Item_t (full_arg_ty, _, _)) = descr.bef in + unparse_data ctxt Optimized capture_ty capture + >>=? fun (const_expr, ctxt) -> + unparse_ty ctxt capture_ty + >>=? fun (ty_expr, ctxt) -> + match full_arg_ty with + | Pair_t ((capture_ty, _, _), (arg_ty, _, _), _, _) -> + let arg_stack_ty = Item_t (arg_ty, Empty_t, None) in + let const_descr = + ( { + loc = descr.loc; + bef = arg_stack_ty; + aft = Item_t (capture_ty, arg_stack_ty, None); + instr = Const capture; + } + : (_, _) descr ) + in + let pair_descr = + ( { + loc = descr.loc; + bef = Item_t (capture_ty, arg_stack_ty, None); + aft = Item_t (full_arg_ty, Empty_t, None); + instr = Cons_pair; + } + : (_, _) descr ) + in + let seq_descr = + ( { + loc = descr.loc; + bef = arg_stack_ty; + aft = Item_t (full_arg_ty, Empty_t, None); + instr = Seq (const_descr, pair_descr); + } + : (_, _) descr ) + in + let full_descr = + ( { + loc = descr.loc; + bef = arg_stack_ty; + aft = descr.aft; + instr = Seq (seq_descr, descr); + } + : (_, _) descr ) + in + let full_expr = + Micheline.Seq + ( 0, + [ Prim (0, I_PUSH, [ty_expr; const_expr], []); + Prim (0, I_PAIR, [], []); + expr ] ) + in + let lam' = Lam (full_descr, full_expr) in + logged_return (Item (lam', rest), ctxt) + | _ -> + assert false ) + | (Lambda lam, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.push) + >>=? fun ctxt -> logged_return (Item (lam, rest), ctxt) + | (Failwith tv, Item (v, _)) -> + trace Cannot_serialize_failure (unparse_data ctxt Optimized tv v) + >>=? fun (v, _ctxt) -> + let v = Micheline.strip_locations v in + fail (Reject (loc, v, get_log log)) + | (Nop, stack) -> + logged_return (stack, ctxt) + (* comparison *) + | (Compare ty, Item (a, Item (b, rest))) -> + Lwt.return (Gas.consume ctxt (Interp_costs.compare ty a b)) + >>=? fun ctxt -> + logged_return + ( Item + ( Script_int.of_int + @@ Script_ir_translator.compare_comparable ty a b, + rest ), + ctxt ) + (* comparators *) + | (Eq, Item (cmpres, rest)) -> + let cmpres = Script_int.compare cmpres Script_int.zero in + let cmpres = Compare.Int.(cmpres = 0) in + Lwt.return (Gas.consume ctxt Interp_costs.compare_res) + >>=? fun ctxt -> logged_return (Item (cmpres, rest), ctxt) + | (Neq, Item (cmpres, rest)) -> + let cmpres = Script_int.compare cmpres Script_int.zero in + let cmpres = Compare.Int.(cmpres <> 0) in + Lwt.return (Gas.consume ctxt Interp_costs.compare_res) + >>=? fun ctxt -> logged_return (Item (cmpres, rest), ctxt) + | (Lt, Item (cmpres, rest)) -> + let cmpres = Script_int.compare cmpres Script_int.zero in + let cmpres = Compare.Int.(cmpres < 0) in + Lwt.return (Gas.consume ctxt Interp_costs.compare_res) + >>=? fun ctxt -> logged_return (Item (cmpres, rest), ctxt) + | (Le, Item (cmpres, rest)) -> + let cmpres = Script_int.compare cmpres Script_int.zero in + let cmpres = Compare.Int.(cmpres <= 0) in + Lwt.return (Gas.consume ctxt Interp_costs.compare_res) + >>=? fun ctxt -> logged_return (Item (cmpres, rest), ctxt) + | (Gt, Item (cmpres, rest)) -> + let cmpres = Script_int.compare cmpres Script_int.zero in + let cmpres = Compare.Int.(cmpres > 0) in + Lwt.return (Gas.consume ctxt Interp_costs.compare_res) + >>=? fun ctxt -> logged_return (Item (cmpres, rest), ctxt) + | (Ge, Item (cmpres, rest)) -> + let cmpres = Script_int.compare cmpres Script_int.zero in + let cmpres = Compare.Int.(cmpres >= 0) in + Lwt.return (Gas.consume ctxt Interp_costs.compare_res) + >>=? fun ctxt -> logged_return (Item (cmpres, rest), ctxt) + (* packing *) + | (Pack t, Item (value, rest)) -> + Script_ir_translator.pack_data ctxt t value + >>=? fun (bytes, ctxt) -> logged_return (Item (bytes, rest), ctxt) + | (Unpack t, Item (bytes, rest)) -> + Lwt.return (Gas.check_enough ctxt (Script.serialized_cost bytes)) + >>=? fun () -> + if + Compare.Int.(MBytes.length bytes >= 1) + && Compare.Int.(MBytes.get_uint8 bytes 0 = 0x05) + then + let bytes = MBytes.sub bytes 1 (MBytes.length bytes - 1) in + match Data_encoding.Binary.of_bytes Script.expr_encoding bytes with + | None -> + Lwt.return (Gas.consume ctxt (Interp_costs.unpack_failed bytes)) + >>=? fun ctxt -> logged_return (Item (None, rest), ctxt) + | Some expr -> ( + Lwt.return (Gas.consume ctxt (Script.deserialized_cost expr)) + >>=? fun ctxt -> + parse_data ctxt ~legacy:false t (Micheline.root expr) + >>= function + | Ok (value, ctxt) -> + logged_return (Item (Some value, rest), ctxt) + | Error _ignored -> + Lwt.return + (Gas.consume ctxt (Interp_costs.unpack_failed bytes)) + >>=? fun ctxt -> logged_return (Item (None, rest), ctxt) ) + else logged_return (Item (None, rest), ctxt) + (* protocol *) + | (Address, Item ((_, address), rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.address) + >>=? fun ctxt -> logged_return (Item (address, rest), ctxt) + | (Contract (t, entrypoint), Item (contract, rest)) -> ( + Lwt.return (Gas.consume ctxt Interp_costs.contract) + >>=? fun ctxt -> + match (contract, entrypoint) with + | ((contract, "default"), entrypoint) + | ((contract, entrypoint), "default") -> + Script_ir_translator.parse_contract_for_script + ~legacy:false + ctxt + loc + t + contract + ~entrypoint + >>=? fun (ctxt, maybe_contract) -> + logged_return (Item (maybe_contract, rest), ctxt) + | _ -> + logged_return (Item (None, rest), ctxt) ) + | ( Transfer_tokens, + Item (p, Item (amount, Item ((tp, (destination, entrypoint)), rest))) ) + -> + Lwt.return (Gas.consume ctxt Interp_costs.transfer) + >>=? fun ctxt -> + collect_big_maps ctxt tp p + >>=? fun (to_duplicate, ctxt) -> + let to_update = no_big_map_id in + extract_big_map_diff + ctxt + Optimized + tp + p + ~to_duplicate + ~to_update + ~temporary:true + >>=? fun (p, big_map_diff, ctxt) -> + unparse_data ctxt Optimized tp p + >>=? fun (p, ctxt) -> + let operation = + Transaction + { + amount; + destination; + entrypoint; + parameters = Script.lazy_expr (Micheline.strip_locations p); + } + in + Lwt.return (fresh_internal_nonce ctxt) + >>=? fun (ctxt, nonce) -> + logged_return + ( Item + ( ( Internal_operation + {source = step_constants.self; operation; nonce}, + big_map_diff ), + rest ), + ctxt ) + | ( Create_account, + Item (manager, Item (delegate, Item (_delegatable, Item (credit, rest)))) + ) -> + Lwt.return (Gas.consume ctxt Interp_costs.create_account) + >>=? fun ctxt -> + Contract.fresh_contract_from_current_nonce ctxt + >>=? fun (ctxt, contract) -> + (* store in optimized binary representation - as unparsed with [Optimized]. *) + let manager_bytes = + Data_encoding.Binary.to_bytes_exn + Signature.Public_key_hash.encoding + manager + in + let storage = + Script_repr.lazy_expr @@ Micheline.strip_locations + @@ Micheline.Bytes (0, manager_bytes) + in + let script = {code = Legacy_support.manager_script_code; storage} in + let operation = + Origination {credit; delegate; preorigination = Some contract; script} + in + Lwt.return (fresh_internal_nonce ctxt) + >>=? fun (ctxt, nonce) -> + logged_return + ( Item + ( ( Internal_operation + {source = step_constants.self; operation; nonce}, + None ), + Item ((contract, "default"), rest) ), + ctxt ) + | (Implicit_account, Item (key, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.implicit_account) + >>=? fun ctxt -> + let contract = Contract.implicit_contract key in + logged_return (Item ((Unit_t None, (contract, "default")), rest), ctxt) + | ( Create_contract (storage_type, param_type, Lam (_, code), root_name), + Item + ( manager, + Item + ( delegate, + Item + ( spendable, + Item (delegatable, Item (credit, Item (init, rest))) ) ) ) ) + -> + Lwt.return (Gas.consume ctxt Interp_costs.create_contract) + >>=? fun ctxt -> + unparse_ty ctxt param_type + >>=? fun (unparsed_param_type, ctxt) -> + let unparsed_param_type = + Script_ir_translator.add_field_annot + (Option.map ~f:(fun n -> `Field_annot n) root_name) + None + unparsed_param_type + in + unparse_ty ctxt storage_type + >>=? fun (unparsed_storage_type, ctxt) -> + let code = + Script.lazy_expr + @@ Micheline.strip_locations + (Seq + ( 0, + [ Prim (0, K_parameter, [unparsed_param_type], []); + Prim (0, K_storage, [unparsed_storage_type], []); + Prim (0, K_code, [code], []) ] )) + in + collect_big_maps ctxt storage_type init + >>=? fun (to_duplicate, ctxt) -> + let to_update = no_big_map_id in + extract_big_map_diff + ctxt + Optimized + storage_type + init + ~to_duplicate + ~to_update + ~temporary:true + >>=? fun (init, big_map_diff, ctxt) -> + unparse_data ctxt Optimized storage_type init + >>=? fun (storage, ctxt) -> + let storage = Script.lazy_expr @@ Micheline.strip_locations storage in + ( if spendable then + Legacy_support.add_do + ~manager_pkh:manager + ~script_code:code + ~script_storage:storage + else if delegatable then + Legacy_support.add_set_delegate + ~manager_pkh:manager + ~script_code:code + ~script_storage:storage + else if Legacy_support.has_default_entrypoint code then + Legacy_support.add_root_entrypoint code + >>=? fun code -> return (code, storage) + else return (code, storage) ) + >>=? fun (code, storage) -> + Contract.fresh_contract_from_current_nonce ctxt + >>=? fun (ctxt, contract) -> + let operation = + Origination + { + credit; + delegate; + preorigination = Some contract; + script = {code; storage}; + } + in + Lwt.return (fresh_internal_nonce ctxt) + >>=? fun (ctxt, nonce) -> + logged_return + ( Item + ( ( Internal_operation + {source = step_constants.self; operation; nonce}, + big_map_diff ), + Item ((contract, "default"), rest) ), + ctxt ) + | ( Create_contract_2 (storage_type, param_type, Lam (_, code), root_name), (* Removed the instruction's arguments manager, spendable and delegatable *) - Item (delegate, Item - (credit, Item - (init, rest))) -> - Lwt.return (Gas.consume ctxt Interp_costs.create_contract) >>=? fun ctxt -> - unparse_ty ctxt param_type >>=? fun (unparsed_param_type, ctxt) -> - let unparsed_param_type = - Script_ir_translator.add_field_annot (Option.map ~f:(fun n -> `Field_annot n) root_name) None unparsed_param_type in - unparse_ty ctxt storage_type >>=? fun (unparsed_storage_type, ctxt) -> - let code = - Micheline.strip_locations - (Seq (0, [ Prim (0, K_parameter, [ unparsed_param_type ], []) ; - Prim (0, K_storage, [ unparsed_storage_type ], []) ; - Prim (0, K_code, [ code ], []) ])) in - collect_big_maps ctxt storage_type init >>=? fun (to_duplicate, ctxt) -> - let to_update = no_big_map_id in - extract_big_map_diff ctxt Optimized storage_type init - ~to_duplicate ~to_update ~temporary:true >>=? fun (init, big_map_diff, ctxt) -> - unparse_data ctxt Optimized storage_type init >>=? fun (storage, ctxt) -> - let storage = Micheline.strip_locations storage in - Contract.fresh_contract_from_current_nonce ctxt >>=? fun (ctxt, contract) -> - let operation = - Origination - { credit ; delegate ; preorigination = Some contract ; - script = { code = Script.lazy_expr code ; - storage = Script.lazy_expr storage } } in - Lwt.return (fresh_internal_nonce ctxt) >>=? fun (ctxt, nonce) -> - logged_return - (Item ((Internal_operation { source = step_constants.self ; operation ; nonce }, big_map_diff), - Item ((contract, "default"), rest)), ctxt) - | Set_delegate, - Item (delegate, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.create_account) >>=? fun ctxt -> - let operation = Delegation delegate in - Lwt.return (fresh_internal_nonce ctxt) >>=? fun (ctxt, nonce) -> - logged_return (Item ((Internal_operation { source = step_constants.self ; operation ; nonce }, None), rest), ctxt) - | Balance, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.balance) >>=? fun ctxt -> - Contract.get_balance ctxt step_constants.self >>=? fun balance -> - logged_return (Item (balance, rest), ctxt) - | Now, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.now) >>=? fun ctxt -> - let now = Script_timestamp.now ctxt in - logged_return (Item (now, rest), ctxt) - | Check_signature, Item (key, Item (signature, Item (message, rest))) -> - Lwt.return (Gas.consume ctxt (Interp_costs.check_signature key message)) >>=? fun ctxt -> - let res = Signature.check key signature message in - logged_return (Item (res, rest), ctxt) - | Hash_key, Item (key, rest) -> - Lwt.return (Gas.consume ctxt Interp_costs.hash_key) >>=? fun ctxt -> - logged_return (Item (Signature.Public_key.hash key, rest), ctxt) - | Blake2b, Item (bytes, rest) -> - Lwt.return (Gas.consume ctxt (Interp_costs.hash_blake2b bytes)) >>=? fun ctxt -> - let hash = Raw_hashes.blake2b bytes in - logged_return (Item (hash, rest), ctxt) - | Sha256, Item (bytes, rest) -> - Lwt.return (Gas.consume ctxt (Interp_costs.hash_sha256 bytes)) >>=? fun ctxt -> - let hash = Raw_hashes.sha256 bytes in - logged_return (Item (hash, rest), ctxt) - | Sha512, Item (bytes, rest) -> - Lwt.return (Gas.consume ctxt (Interp_costs.hash_sha512 bytes)) >>=? fun ctxt -> - let hash = Raw_hashes.sha512 bytes in - logged_return (Item (hash, rest), ctxt) - | Steps_to_quota, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.steps_to_quota) >>=? fun ctxt -> - let steps = match Gas.level ctxt with - | Limited { remaining } -> remaining - | Unaccounted -> Z.of_string "99999999" in - logged_return (Item (Script_int.(abs (of_zint steps)), rest), ctxt) - | Source, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.source) >>=? fun ctxt -> - logged_return (Item ((step_constants.payer, "default"), rest), ctxt) - | Sender, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.source) >>=? fun ctxt -> - logged_return (Item ((step_constants.source, "default"), rest), ctxt) - | Self (t, entrypoint), rest -> - Lwt.return (Gas.consume ctxt Interp_costs.self) >>=? fun ctxt -> - logged_return (Item ((t, (step_constants.self, entrypoint)), rest), ctxt) - | Amount, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.amount) >>=? fun ctxt -> - logged_return (Item (step_constants.amount, rest), ctxt) - | Dig (n, n'), stack -> - Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) >>=? fun ctxt -> - interp_stack_prefix_preserving_operation (fun (Item (v, rest)) -> return (rest, v)) n' stack - >>=? fun (aft, x) -> logged_return (Item (x, aft), ctxt) - | Dug (n, n'), Item (v, rest) -> - Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) >>=? fun ctxt -> - interp_stack_prefix_preserving_operation (fun stk -> return (Item (v, stk), ())) n' rest - >>=? fun (aft, ()) -> logged_return (aft, ctxt) - | Dipn (n, n', b), stack -> - Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) >>=? fun ctxt -> - interp_stack_prefix_preserving_operation (fun stk -> - step ?log ctxt step_constants b stk >>=? fun (res, ctxt') -> - return (res, ctxt')) n' stack - >>=? fun (aft, ctxt') -> logged_return (aft, ctxt') - | Dropn (n, n'), stack -> - Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) >>=? fun ctxt -> - interp_stack_prefix_preserving_operation (fun stk -> return (stk, stk)) n' stack - >>=? fun (_, rest) -> logged_return (rest, ctxt) - | ChainId, rest -> - Lwt.return (Gas.consume ctxt Interp_costs.chain_id) >>=? fun ctxt -> - logged_return (Item (step_constants.chain_id, rest), ctxt) + Item (delegate, Item (credit, Item (init, rest))) ) -> + Lwt.return (Gas.consume ctxt Interp_costs.create_contract) + >>=? fun ctxt -> + unparse_ty ctxt param_type + >>=? fun (unparsed_param_type, ctxt) -> + let unparsed_param_type = + Script_ir_translator.add_field_annot + (Option.map ~f:(fun n -> `Field_annot n) root_name) + None + unparsed_param_type + in + unparse_ty ctxt storage_type + >>=? fun (unparsed_storage_type, ctxt) -> + let code = + Micheline.strip_locations + (Seq + ( 0, + [ Prim (0, K_parameter, [unparsed_param_type], []); + Prim (0, K_storage, [unparsed_storage_type], []); + Prim (0, K_code, [code], []) ] )) + in + collect_big_maps ctxt storage_type init + >>=? fun (to_duplicate, ctxt) -> + let to_update = no_big_map_id in + extract_big_map_diff + ctxt + Optimized + storage_type + init + ~to_duplicate + ~to_update + ~temporary:true + >>=? fun (init, big_map_diff, ctxt) -> + unparse_data ctxt Optimized storage_type init + >>=? fun (storage, ctxt) -> + let storage = Micheline.strip_locations storage in + Contract.fresh_contract_from_current_nonce ctxt + >>=? fun (ctxt, contract) -> + let operation = + Origination + { + credit; + delegate; + preorigination = Some contract; + script = + { + code = Script.lazy_expr code; + storage = Script.lazy_expr storage; + }; + } + in + Lwt.return (fresh_internal_nonce ctxt) + >>=? fun (ctxt, nonce) -> + logged_return + ( Item + ( ( Internal_operation + {source = step_constants.self; operation; nonce}, + big_map_diff ), + Item ((contract, "default"), rest) ), + ctxt ) + | (Set_delegate, Item (delegate, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.create_account) + >>=? fun ctxt -> + let operation = Delegation delegate in + Lwt.return (fresh_internal_nonce ctxt) + >>=? fun (ctxt, nonce) -> + logged_return + ( Item + ( ( Internal_operation + {source = step_constants.self; operation; nonce}, + None ), + rest ), + ctxt ) + | (Balance, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.balance) + >>=? fun ctxt -> + Contract.get_balance ctxt step_constants.self + >>=? fun balance -> logged_return (Item (balance, rest), ctxt) + | (Now, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.now) + >>=? fun ctxt -> + let now = Script_timestamp.now ctxt in + logged_return (Item (now, rest), ctxt) + | (Check_signature, Item (key, Item (signature, Item (message, rest)))) -> + Lwt.return (Gas.consume ctxt (Interp_costs.check_signature key message)) + >>=? fun ctxt -> + let res = Signature.check key signature message in + logged_return (Item (res, rest), ctxt) + | (Hash_key, Item (key, rest)) -> + Lwt.return (Gas.consume ctxt Interp_costs.hash_key) + >>=? fun ctxt -> + logged_return (Item (Signature.Public_key.hash key, rest), ctxt) + | (Blake2b, Item (bytes, rest)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.hash_blake2b bytes)) + >>=? fun ctxt -> + let hash = Raw_hashes.blake2b bytes in + logged_return (Item (hash, rest), ctxt) + | (Sha256, Item (bytes, rest)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.hash_sha256 bytes)) + >>=? fun ctxt -> + let hash = Raw_hashes.sha256 bytes in + logged_return (Item (hash, rest), ctxt) + | (Sha512, Item (bytes, rest)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.hash_sha512 bytes)) + >>=? fun ctxt -> + let hash = Raw_hashes.sha512 bytes in + logged_return (Item (hash, rest), ctxt) + | (Steps_to_quota, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.steps_to_quota) + >>=? fun ctxt -> + let steps = + match Gas.level ctxt with + | Limited {remaining} -> + remaining + | Unaccounted -> + Z.of_string "99999999" + in + logged_return (Item (Script_int.(abs (of_zint steps)), rest), ctxt) + | (Source, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.source) + >>=? fun ctxt -> + logged_return (Item ((step_constants.payer, "default"), rest), ctxt) + | (Sender, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.source) + >>=? fun ctxt -> + logged_return (Item ((step_constants.source, "default"), rest), ctxt) + | (Self (t, entrypoint), rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.self) + >>=? fun ctxt -> + logged_return (Item ((t, (step_constants.self, entrypoint)), rest), ctxt) + | (Amount, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.amount) + >>=? fun ctxt -> logged_return (Item (step_constants.amount, rest), ctxt) + | (Dig (n, n'), stack) -> + Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) + >>=? fun ctxt -> + interp_stack_prefix_preserving_operation + (fun (Item (v, rest)) -> return (rest, v)) + n' + stack + >>=? fun (aft, x) -> logged_return (Item (x, aft), ctxt) + | (Dug (n, n'), Item (v, rest)) -> + Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) + >>=? fun ctxt -> + interp_stack_prefix_preserving_operation + (fun stk -> return (Item (v, stk), ())) + n' + rest + >>=? fun (aft, ()) -> logged_return (aft, ctxt) + | (Dipn (n, n', b), stack) -> + Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) + >>=? fun ctxt -> + interp_stack_prefix_preserving_operation + (fun stk -> + step ?log ctxt step_constants b stk + >>=? fun (res, ctxt') -> return (res, ctxt')) + n' + stack + >>=? fun (aft, ctxt') -> logged_return (aft, ctxt') + | (Dropn (n, n'), stack) -> + Lwt.return (Gas.consume ctxt (Interp_costs.stack_n_op n)) + >>=? fun ctxt -> + interp_stack_prefix_preserving_operation + (fun stk -> return (stk, stk)) + n' + stack + >>=? fun (_, rest) -> logged_return (rest, ctxt) + | (ChainId, rest) -> + Lwt.return (Gas.consume ctxt Interp_costs.chain_id) + >>=? fun ctxt -> + logged_return (Item (step_constants.chain_id, rest), ctxt) -and interp - : type p r. - (?log: execution_trace ref -> - context -> - step_constants -> (p, r) lambda -> p -> - (r * context) tzresult Lwt.t) - = fun ?log ctxt step_constants (Lam (code, _)) arg -> - let stack = (Item (arg, Empty)) in - begin match log with - | None -> return_unit - | Some log -> - trace Cannot_serialize_log - (unparse_stack ctxt (stack, code.bef)) >>=? fun stack -> - log := (code.loc, Gas.level ctxt, stack) :: !log ; - return_unit - end >>=? fun () -> - step ?log ctxt step_constants code stack >>=? fun (Item (ret, Empty), ctxt) -> - return (ret, ctxt) +and interp : + type p r. + ?log:execution_trace ref -> + context -> + step_constants -> + (p, r) lambda -> + p -> + (r * context) tzresult Lwt.t = + fun ?log ctxt step_constants (Lam (code, _)) arg -> + let stack = Item (arg, Empty) in + ( match log with + | None -> + return_unit + | Some log -> + trace Cannot_serialize_log (unparse_stack ctxt (stack, code.bef)) + >>=? fun stack -> + log := (code.loc, Gas.level ctxt, stack) :: !log ; + return_unit ) + >>=? fun () -> + step ?log ctxt step_constants code stack + >>=? fun (Item (ret, Empty), ctxt) -> return (ret, ctxt) (* ---- contract handling ---------------------------------------------------*) - and execute ?log ctxt mode step_constants ~entrypoint unparsed_script arg : - (Script.expr * packed_internal_operation list * context * Contract.big_map_diff option) tzresult Lwt.t = + ( Script.expr + * packed_internal_operation list + * context + * Contract.big_map_diff option ) + tzresult + Lwt.t = parse_script ctxt unparsed_script ~legacy:true - >>=? fun (Ex_script { code ; arg_type ; storage ; storage_type ; root_name }, ctxt) -> + >>=? fun (Ex_script {code; arg_type; storage; storage_type; root_name}, ctxt) -> trace (Bad_contract_parameter step_constants.self) - (Lwt.return (find_entrypoint arg_type ~root_name entrypoint)) >>=? fun (box, _) -> + (Lwt.return (find_entrypoint arg_type ~root_name entrypoint)) + >>=? fun (box, _) -> trace (Bad_contract_parameter step_constants.self) - (parse_data ctxt ~legacy:false arg_type (box arg)) >>=? fun (arg, ctxt) -> - Script.force_decode ctxt unparsed_script.code >>=? fun (script_code, ctxt) -> - Script_ir_translator.collect_big_maps ctxt arg_type arg >>=? fun (to_duplicate, ctxt) -> - Script_ir_translator.collect_big_maps ctxt storage_type storage >>=? fun (to_update, ctxt) -> + (parse_data ctxt ~legacy:false arg_type (box arg)) + >>=? fun (arg, ctxt) -> + Script.force_decode ctxt unparsed_script.code + >>=? fun (script_code, ctxt) -> + Script_ir_translator.collect_big_maps ctxt arg_type arg + >>=? fun (to_duplicate, ctxt) -> + Script_ir_translator.collect_big_maps ctxt storage_type storage + >>=? fun (to_update, ctxt) -> trace (Runtime_contract_error (step_constants.self, script_code)) (interp ?log ctxt step_constants code (arg, storage)) >>=? fun ((ops, storage), ctxt) -> - Script_ir_translator.extract_big_map_diff ctxt mode - ~temporary:false ~to_duplicate ~to_update storage_type storage + Script_ir_translator.extract_big_map_diff + ctxt + mode + ~temporary:false + ~to_duplicate + ~to_update + storage_type + storage >>=? fun (storage, big_map_diff, ctxt) -> - trace Cannot_serialize_storage - (unparse_data ctxt mode storage_type storage) >>=? fun (storage, ctxt) -> - let ops, op_diffs = List.split ops in - let big_map_diff = match - List.flatten (List.map (Option.unopt ~default:[]) (op_diffs @ [ big_map_diff ])) + trace Cannot_serialize_storage (unparse_data ctxt mode storage_type storage) + >>=? fun (storage, ctxt) -> + let (ops, op_diffs) = List.split ops in + let big_map_diff = + match + List.flatten + (List.map (Option.unopt ~default:[]) (op_diffs @ [big_map_diff])) with - | [] -> None - | diff -> Some diff in + | [] -> + None + | diff -> + Some diff + in return (Micheline.strip_locations storage, ops, ctxt, big_map_diff) -type execution_result = - { ctxt : context ; - storage : Script.expr ; - big_map_diff : Contract.big_map_diff option ; - operations : packed_internal_operation list } +type execution_result = { + ctxt : context; + storage : Script.expr; + big_map_diff : Contract.big_map_diff option; + operations : packed_internal_operation list; +} let trace ctxt mode step_constants ~script ~entrypoint ~parameter = let log = ref [] in - execute ~log ctxt mode step_constants ~entrypoint script (Micheline.root parameter) + execute + ~log + ctxt + mode + step_constants + ~entrypoint + script + (Micheline.root parameter) >>=? fun (storage, operations, ctxt, big_map_diff) -> let trace = List.rev !log in - return ({ ctxt ; storage ; big_map_diff ; operations }, trace) + return ({ctxt; storage; big_map_diff; operations}, trace) let execute ctxt mode step_constants ~script ~entrypoint ~parameter = - execute ctxt mode step_constants ~entrypoint script (Micheline.root parameter) + execute + ctxt + mode + step_constants + ~entrypoint + script + (Micheline.root parameter) >>=? fun (storage, operations, ctxt, big_map_diff) -> - return { ctxt ; storage ; big_map_diff ; operations } + return {ctxt; storage; big_map_diff; operations} diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.mli b/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.mli index 7d583d37a..f327451fe 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_interpreter.mli @@ -28,52 +28,62 @@ open Alpha_context type execution_trace = (Script.location * Gas.t * (Script.expr * string option) list) list -type error += Reject of Script.location * Script.expr * execution_trace option +type error += + | Reject of Script.location * Script.expr * execution_trace option + type error += Overflow of Script.location * execution_trace option + type error += Runtime_contract_error : Contract.t * Script.expr -> error + type error += Bad_contract_parameter of Contract.t (* `Permanent *) + type error += Cannot_serialize_log + type error += Cannot_serialize_failure + type error += Cannot_serialize_storage -type execution_result = - { ctxt : context ; - storage : Script.expr ; - big_map_diff : Contract.big_map_diff option ; - operations : packed_internal_operation list } +type execution_result = { + ctxt : context; + storage : Script.expr; + big_map_diff : Contract.big_map_diff option; + operations : packed_internal_operation list; +} -type step_constants = - { source : Contract.t ; - payer : Contract.t ; - self : Contract.t ; - amount : Tez.t ; - chain_id : Chain_id.t } +type step_constants = { + source : Contract.t; + payer : Contract.t; + self : Contract.t; + amount : Tez.t; + chain_id : Chain_id.t; +} type 'tys stack = | Item : 'ty * 'rest stack -> ('ty * 'rest) stack | Empty : Script_typed_ir.end_of_stack stack -val step: - ?log: execution_trace ref -> - context -> step_constants -> +val step : + ?log:execution_trace ref -> + context -> + step_constants -> ('bef, 'aft) Script_typed_ir.descr -> 'bef stack -> ('aft stack * context) tzresult Lwt.t -val execute: +val execute : Alpha_context.t -> Script_ir_translator.unparsing_mode -> step_constants -> - script: Script.t -> - entrypoint: string -> - parameter: Script.expr -> + script:Script.t -> + entrypoint:string -> + parameter:Script.expr -> execution_result tzresult Lwt.t -val trace: +val trace : Alpha_context.t -> Script_ir_translator.unparsing_mode -> step_constants -> - script: Script.t -> - entrypoint: string -> - parameter: Script.expr -> + script:Script.t -> + entrypoint:string -> + parameter:Script.expr -> (execution_result * execution_trace) tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.ml index 33660d98e..be405eef6 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.ml @@ -29,384 +29,517 @@ open Script_tc_errors open Script_typed_ir let default_now_annot = Some (`Var_annot "now") + let default_amount_annot = Some (`Var_annot "amount") + let default_balance_annot = Some (`Var_annot "balance") + let default_steps_annot = Some (`Var_annot "steps") + let default_source_annot = Some (`Var_annot "source") + let default_sender_annot = Some (`Var_annot "sender") + let default_self_annot = Some (`Var_annot "self") + let default_arg_annot = Some (`Var_annot "arg") + let default_param_annot = Some (`Var_annot "parameter") + let default_storage_annot = Some (`Var_annot "storage") let default_car_annot = Some (`Field_annot "car") + let default_cdr_annot = Some (`Field_annot "cdr") + let default_contract_annot = Some (`Field_annot "contract") + let default_addr_annot = Some (`Field_annot "address") + let default_manager_annot = Some (`Field_annot "manager") + let default_pack_annot = Some (`Field_annot "packed") + let default_unpack_annot = Some (`Field_annot "unpacked") + let default_slice_annot = Some (`Field_annot "slice") let default_elt_annot = Some (`Field_annot "elt") + let default_key_annot = Some (`Field_annot "key") + let default_hd_annot = Some (`Field_annot "hd") + let default_tl_annot = Some (`Field_annot "tl") + let default_some_annot = Some (`Field_annot "some") + let default_left_annot = Some (`Field_annot "left") + let default_right_annot = Some (`Field_annot "right") + let default_binding_annot = Some (`Field_annot "bnd") let unparse_type_annot : type_annot option -> string list = function - | None -> [] - | Some `Type_annot a -> [ ":" ^ a ] + | None -> + [] + | Some (`Type_annot a) -> + [":" ^ a] let unparse_var_annot : var_annot option -> string list = function - | None -> [] - | Some `Var_annot a -> [ "@" ^ a ] + | None -> + [] + | Some (`Var_annot a) -> + ["@" ^ a] let unparse_field_annot : field_annot option -> string list = function - | None -> [] - | Some `Field_annot a -> [ "%" ^ a ] + | None -> + [] + | Some (`Field_annot a) -> + ["%" ^ a] -let field_to_var_annot : field_annot option -> var_annot option = - function - | None -> None - | Some (`Field_annot s) -> Some (`Var_annot s) +let field_to_var_annot : field_annot option -> var_annot option = function + | None -> + None + | Some (`Field_annot s) -> + Some (`Var_annot s) -let type_to_var_annot : type_annot option -> var_annot option = - function - | None -> None - | Some (`Type_annot s) -> Some (`Var_annot s) +let type_to_var_annot : type_annot option -> var_annot option = function + | None -> + None + | Some (`Type_annot s) -> + Some (`Var_annot s) -let var_to_field_annot : var_annot option -> field_annot option = - function - | None -> None - | Some (`Var_annot s) -> Some (`Field_annot s) +let var_to_field_annot : var_annot option -> field_annot option = function + | None -> + None + | Some (`Var_annot s) -> + Some (`Field_annot s) -let default_annot ~default = function - | None -> default - | annot -> annot +let default_annot ~default = function None -> default | annot -> annot -let gen_access_annot - : var_annot option -> ?default:field_annot option -> field_annot option -> var_annot option - = fun value_annot ?(default=None) field_annot -> - match value_annot, field_annot, default with - | None, None, _ | Some _, None, None | None, Some `Field_annot "", _ -> None - | None, Some `Field_annot f, _ -> - Some (`Var_annot f) - | Some `Var_annot v, (None | Some `Field_annot ""), Some `Field_annot f -> - Some (`Var_annot (String.concat "." [v; f])) - | Some `Var_annot v, Some `Field_annot f, _ -> - Some (`Var_annot (String.concat "." [v; f])) +let gen_access_annot : + var_annot option -> + ?default:field_annot option -> + field_annot option -> + var_annot option = + fun value_annot ?(default = None) field_annot -> + match (value_annot, field_annot, default) with + | (None, None, _) | (Some _, None, None) | (None, Some (`Field_annot ""), _) + -> + None + | (None, Some (`Field_annot f), _) -> + Some (`Var_annot f) + | ( Some (`Var_annot v), + (None | Some (`Field_annot "")), + Some (`Field_annot f) ) -> + Some (`Var_annot (String.concat "." [v; f])) + | (Some (`Var_annot v), Some (`Field_annot f), _) -> + Some (`Var_annot (String.concat "." [v; f])) -let merge_type_annot - : legacy: bool -> type_annot option -> type_annot option -> type_annot option tzresult - = fun ~legacy annot1 annot2 -> - match annot1, annot2 with - | None, None - | Some _, None - | None, Some _ -> ok None - | Some `Type_annot a1, Some `Type_annot a2 -> - if legacy || String.equal a1 a2 - then ok annot1 - else error (Inconsistent_annotations (":" ^ a1, ":" ^ a2)) +let merge_type_annot : + legacy:bool -> + type_annot option -> + type_annot option -> + type_annot option tzresult = + fun ~legacy annot1 annot2 -> + match (annot1, annot2) with + | (None, None) | (Some _, None) | (None, Some _) -> + ok None + | (Some (`Type_annot a1), Some (`Type_annot a2)) -> + if legacy || String.equal a1 a2 then ok annot1 + else error (Inconsistent_annotations (":" ^ a1, ":" ^ a2)) -let merge_field_annot - : legacy: bool -> field_annot option -> field_annot option -> field_annot option tzresult - = fun ~legacy annot1 annot2 -> - match annot1, annot2 with - | None, None - | Some _, None - | None, Some _ -> ok None - | Some `Field_annot a1, Some `Field_annot a2 -> - if legacy || String.equal a1 a2 - then ok annot1 - else error (Inconsistent_annotations ("%" ^ a1, "%" ^ a2)) +let merge_field_annot : + legacy:bool -> + field_annot option -> + field_annot option -> + field_annot option tzresult = + fun ~legacy annot1 annot2 -> + match (annot1, annot2) with + | (None, None) | (Some _, None) | (None, Some _) -> + ok None + | (Some (`Field_annot a1), Some (`Field_annot a2)) -> + if legacy || String.equal a1 a2 then ok annot1 + else error (Inconsistent_annotations ("%" ^ a1, "%" ^ a2)) -let merge_var_annot - : var_annot option -> var_annot option -> var_annot option - = fun annot1 annot2 -> - match annot1, annot2 with - | None, None - | Some _, None - | None, Some _ -> None - | Some `Var_annot a1, Some `Var_annot a2 -> - if String.equal a1 a2 then annot1 else None +let merge_var_annot : var_annot option -> var_annot option -> var_annot option + = + fun annot1 annot2 -> + match (annot1, annot2) with + | (None, None) | (Some _, None) | (None, Some _) -> + None + | (Some (`Var_annot a1), Some (`Var_annot a2)) -> + if String.equal a1 a2 then annot1 else None let error_unexpected_annot loc annot = - match annot with - | [] -> ok () - | _ :: _ -> error (Unexpected_annotation loc) + match annot with [] -> ok () | _ :: _ -> error (Unexpected_annotation loc) let fail_unexpected_annot loc annot = Lwt.return (error_unexpected_annot loc annot) -let parse_annots loc ?(allow_special_var = false) ?(allow_special_field = false) l = +(* Check that the predicate p holds on all s.[k] for k >= i *) +let string_iter p s i = + let len = String.length s in + let rec aux i = + if Compare.Int.(i >= len) then ok () else p s.[i] >>? fun () -> aux (i + 1) + in + aux i + +(* Valid annotation characters as defined by the allowed_annot_char function from lib_micheline/micheline_parser *) +let check_char loc = function + | 'a' .. 'z' | 'A' .. 'Z' | '_' | '.' | '%' | '@' | '0' .. '9' -> + ok () + | _ -> + error (Unexpected_annotation loc) + +(* This constant is defined in lib_micheline/micheline_parser which is not available in the environment. *) +let max_annot_length = 255 + +let parse_annots loc ?(allow_special_var = false) + ?(allow_special_field = false) l = (* allow emtpty annotations as wildcards but otherwise only accept annotations that start with [a-zA-Z_] *) let sub_or_wildcard ~specials wrap s acc = let len = String.length s in - if Compare.Int.(len = 1) then ok @@ wrap None :: acc - else match s.[1] with + ( if Compare.Int.(len > max_annot_length) then + error (Unexpected_annotation loc) + else ok () ) + >>? fun () -> + if Compare.Int.(len = 1) then ok @@ (wrap None :: acc) + else + match s.[1] with | 'a' .. 'z' | 'A' .. 'Z' | '_' -> - ok @@ wrap (Some (String.sub s 1 (len - 1))) :: acc + (* check that all characters are valid*) + string_iter (check_char loc) s 2 + >>? fun () -> ok @@ (wrap (Some (String.sub s 1 (len - 1))) :: acc) | '@' when Compare.Int.(len = 2) && List.mem '@' specials -> - ok @@ wrap (Some "@") :: acc + ok @@ (wrap (Some "@") :: acc) | '%' when List.mem '%' specials -> - if Compare.Int.(len = 2) - then ok @@ wrap (Some "%") :: acc - else if Compare.Int.(len = 3) && Compare.Char.(s.[2] = '%') - then ok @@ wrap (Some "%%") :: acc + if Compare.Int.(len = 2) then ok @@ (wrap (Some "%") :: acc) + else if Compare.Int.(len = 3) && Compare.Char.(s.[2] = '%') then + ok @@ (wrap (Some "%%") :: acc) else error (Unexpected_annotation loc) - | _ -> error (Unexpected_annotation loc) in - List.fold_left (fun acc s -> - acc >>? fun acc -> + | _ -> + error (Unexpected_annotation loc) + in + List.fold_left + (fun acc s -> + acc + >>? fun acc -> if Compare.Int.(String.length s = 0) then error (Unexpected_annotation loc) - else match s.[0] with - | ':' -> sub_or_wildcard ~specials:[] (fun a -> `Type_annot a) s acc + else + match s.[0] with + | ':' -> + sub_or_wildcard ~specials:[] (fun a -> `Type_annot a) s acc | '@' -> sub_or_wildcard ~specials:(if allow_special_var then ['%'] else []) - (fun a -> `Var_annot a) s acc - | '%' -> sub_or_wildcard - ~specials:(if allow_special_field then ['@'] else []) - (fun a -> `Field_annot a) s acc - | _ -> error (Unexpected_annotation loc) - ) (ok []) l + (fun a -> `Var_annot a) + s + acc + | '%' -> + sub_or_wildcard + ~specials:(if allow_special_field then ['@'] else []) + (fun a -> `Field_annot a) + s + acc + | _ -> + error (Unexpected_annotation loc)) + (ok []) + l >|? List.rev let opt_var_of_var_opt = function - | `Var_annot None -> None - | `Var_annot Some a -> Some (`Var_annot a) + | `Var_annot None -> + None + | `Var_annot (Some a) -> + Some (`Var_annot a) let opt_field_of_field_opt = function - | `Field_annot None -> None - | `Field_annot Some a -> Some (`Field_annot a) + | `Field_annot None -> + None + | `Field_annot (Some a) -> + Some (`Field_annot a) let opt_type_of_type_opt = function - | `Type_annot None -> None - | `Type_annot Some a -> Some (`Type_annot a) + | `Type_annot None -> + None + | `Type_annot (Some a) -> + Some (`Type_annot a) -let classify_annot loc l - : (var_annot option list * type_annot option list * field_annot option list) tzresult - = +let classify_annot loc l : + (var_annot option list * type_annot option list * field_annot option list) + tzresult = try - let _, rv, _, rt, _, rf = + let (_, rv, _, rt, _, rf) = List.fold_left (fun (in_v, rv, in_t, rt, in_f, rf) a -> - match a, in_v, rv, in_t, rt, in_f, rf with - | (`Var_annot _ as a), true, _, _, _, _, _ - | (`Var_annot _ as a), false, [], _, _, _, _ -> - true, opt_var_of_var_opt a :: rv, - false, rt, - false, rf - | (`Type_annot _ as a), _, _, true, _, _, _ - | (`Type_annot _ as a), _, _, false, [], _, _ -> - false, rv, - true, opt_type_of_type_opt a :: rt, - false, rf - | (`Field_annot _ as a), _, _, _, _, true, _ - | (`Field_annot _ as a), _, _, _, _, false, [] -> - false, rv, - false, rt, - true, opt_field_of_field_opt a :: rf - | _ -> raise Exit - ) (false, [], false, [], false, []) l in + match (a, in_v, rv, in_t, rt, in_f, rf) with + | ((`Var_annot _ as a), true, _, _, _, _, _) + | ((`Var_annot _ as a), false, [], _, _, _, _) -> + (true, opt_var_of_var_opt a :: rv, false, rt, false, rf) + | ((`Type_annot _ as a), _, _, true, _, _, _) + | ((`Type_annot _ as a), _, _, false, [], _, _) -> + (false, rv, true, opt_type_of_type_opt a :: rt, false, rf) + | ((`Field_annot _ as a), _, _, _, _, true, _) + | ((`Field_annot _ as a), _, _, _, _, false, []) -> + (false, rv, false, rt, true, opt_field_of_field_opt a :: rf) + | _ -> + raise Exit) + (false, [], false, [], false, []) + l + in ok (List.rev rv, List.rev rt, List.rev rf) with Exit -> error (Ungrouped_annotations loc) let get_one_annot loc = function - | [] -> ok None - | [ a ] -> ok a - | _ -> error (Unexpected_annotation loc) + | [] -> + ok None + | [a] -> + ok a + | _ -> + error (Unexpected_annotation loc) let get_two_annot loc = function - | [] -> ok (None, None) - | [ a ] -> ok (a, None) - | [ a; b ] -> ok (a, b) - | _ -> error (Unexpected_annotation loc) + | [] -> + ok (None, None) + | [a] -> + ok (a, None) + | [a; b] -> + ok (a, b) + | _ -> + error (Unexpected_annotation loc) -let parse_type_annot - : int -> string list -> type_annot option tzresult - = fun loc annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc vars >>? fun () -> - error_unexpected_annot loc fields >>? fun () -> - get_one_annot loc types +let parse_type_annot : int -> string list -> type_annot option tzresult = + fun loc annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc vars + >>? fun () -> + error_unexpected_annot loc fields >>? fun () -> get_one_annot loc types -let parse_type_field_annot - : int -> string list -> (type_annot option * field_annot option) tzresult - = fun loc annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc vars >>? fun () -> - get_one_annot loc types >>? fun t -> - get_one_annot loc fields >|? fun f -> - (t, f) +let parse_type_field_annot : + int -> string list -> (type_annot option * field_annot option) tzresult = + fun loc annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc vars + >>? fun () -> + get_one_annot loc types + >>? fun t -> get_one_annot loc fields >|? fun f -> (t, f) -let parse_composed_type_annot - : int -> string list -> (type_annot option * field_annot option * field_annot option) tzresult - = fun loc annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc vars >>? fun () -> - get_one_annot loc types >>? fun t -> - get_two_annot loc fields >|? fun (f1, f2) -> - (t, f1, f2) +let parse_composed_type_annot : + int -> + string list -> + (type_annot option * field_annot option * field_annot option) tzresult = + fun loc annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc vars + >>? fun () -> + get_one_annot loc types + >>? fun t -> get_two_annot loc fields >|? fun (f1, f2) -> (t, f1, f2) -let parse_field_annot - : int -> string list -> field_annot option tzresult - = fun loc annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc vars >>? fun () -> - error_unexpected_annot loc types >>? fun () -> - get_one_annot loc fields +let parse_field_annot : int -> string list -> field_annot option tzresult = + fun loc annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc vars + >>? fun () -> + error_unexpected_annot loc types >>? fun () -> get_one_annot loc fields -let extract_field_annot - : Script.node -> (Script.node * field_annot option) tzresult - = function - | Prim (loc, prim, args, annot) -> - let rec extract_first acc = function - | [] -> None, annot - | s :: rest -> - if Compare.Int.(String.length s > 0) && - Compare.Char.(s.[0] = '%') then - Some s, List.rev_append acc rest - else extract_first (s :: acc) rest in - let field_annot, annot = extract_first [] annot in - let field_annot = match field_annot with - | None -> None - | Some field_annot -> Some (`Field_annot (String.sub field_annot 1 (String.length field_annot - 1))) in - ok (Prim (loc, prim, args, annot), field_annot) - | expr -> ok (expr, None) +let extract_field_annot : + Script.node -> (Script.node * field_annot option) tzresult = function + | Prim (loc, prim, args, annot) -> + let rec extract_first acc = function + | [] -> + (None, annot) + | s :: rest -> + if Compare.Int.(String.length s > 0) && Compare.Char.(s.[0] = '%') + then (Some s, List.rev_append acc rest) + else extract_first (s :: acc) rest + in + let (field_annot, annot) = extract_first [] annot in + let field_annot = + match field_annot with + | None -> + None + | Some field_annot -> + Some + (`Field_annot + (String.sub field_annot 1 (String.length field_annot - 1))) + in + ok (Prim (loc, prim, args, annot), field_annot) + | expr -> + ok (expr, None) -let check_correct_field - : field_annot option -> field_annot option -> unit tzresult - = fun f1 f2 -> - match f1, f2 with - | None, _ | _, None -> ok () - | Some `Field_annot s1, Some `Field_annot s2 -> - if String.equal s1 s2 then ok () - else error (Inconsistent_field_annotations ("%" ^ s1, "%" ^ s2)) +let check_correct_field : + field_annot option -> field_annot option -> unit tzresult = + fun f1 f2 -> + match (f1, f2) with + | (None, _) | (_, None) -> + ok () + | (Some (`Field_annot s1), Some (`Field_annot s2)) -> + if String.equal s1 s2 then ok () + else error (Inconsistent_field_annotations ("%" ^ s1, "%" ^ s2)) - -let parse_var_annot - : int -> ?default:var_annot option -> string list -> - var_annot option tzresult - = fun loc ?default annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc types >>? fun () -> - error_unexpected_annot loc fields >>? fun () -> - get_one_annot loc vars >|? function - | Some _ as a -> a - | None -> match default with - | Some a -> a - | None -> None +let parse_var_annot : + int -> + ?default:var_annot option -> + string list -> + var_annot option tzresult = + fun loc ?default annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc types + >>? fun () -> + error_unexpected_annot loc fields + >>? fun () -> + get_one_annot loc vars + >|? function + | Some _ as a -> + a + | None -> ( + match default with Some a -> a | None -> None ) let split_last_dot = function - | None -> None, None - | Some `Field_annot s -> - match String.rindex_opt s '.' with - | None -> None, Some (`Field_annot s) - | Some i -> - let s1 = String.sub s 0 i in - let s2 = String.sub s (i + 1) (String.length s - i - 1) in - let f = - if Compare.String.equal s2 "car" - || Compare.String.equal s2 "cdr" then - None - else - Some (`Field_annot s2) in - Some (`Var_annot s1), f + | None -> + (None, None) + | Some (`Field_annot s) -> ( + match String.rindex_opt s '.' with + | None -> + (None, Some (`Field_annot s)) + | Some i -> + let s1 = String.sub s 0 i in + let s2 = String.sub s (i + 1) (String.length s - i - 1) in + let f = + if Compare.String.equal s2 "car" || Compare.String.equal s2 "cdr" + then None + else Some (`Field_annot s2) + in + (Some (`Var_annot s1), f) ) let common_prefix v1 v2 = - match v1, v2 with - | Some (`Var_annot s1), Some (`Var_annot s2) when Compare.String.equal s1 s2 -> v1 - | Some _, None -> v1 - | None, Some _ -> v2 - | _, _ -> None + match (v1, v2) with + | (Some (`Var_annot s1), Some (`Var_annot s2)) + when Compare.String.equal s1 s2 -> + v1 + | (Some _, None) -> + v1 + | (None, Some _) -> + v2 + | (_, _) -> + None -let parse_constr_annot - : int -> +let parse_constr_annot : + int -> ?if_special_first:field_annot option -> ?if_special_second:field_annot option -> string list -> - (var_annot option * type_annot option * field_annot option * field_annot option) tzresult - = fun loc ?if_special_first ?if_special_second annot -> - parse_annots ~allow_special_field:true loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - get_one_annot loc vars >>? fun v -> - get_one_annot loc types >>? fun t -> - get_two_annot loc fields >>? fun (f1, f2) -> - begin match if_special_first, f1 with - | Some special_var, Some `Field_annot "@" -> - ok (split_last_dot special_var) - | None, Some `Field_annot "@" -> error (Unexpected_annotation loc) - | _, _ -> ok (v, f1) - end >>? fun (v1, f1) -> - begin match if_special_second, f2 with - | Some special_var, Some `Field_annot "@" -> - ok (split_last_dot special_var) - | None, Some `Field_annot "@" -> error (Unexpected_annotation loc) - | _, _ -> ok (v, f2) - end >|? fun (v2, f2) -> - let v = match v with - | None -> common_prefix v1 v2 - | Some _ -> v in - (v, t, f1, f2) + ( var_annot option + * type_annot option + * field_annot option + * field_annot option ) + tzresult = + fun loc ?if_special_first ?if_special_second annot -> + parse_annots ~allow_special_field:true loc annot + >>? classify_annot loc + >>? fun (vars, types, fields) -> + get_one_annot loc vars + >>? fun v -> + get_one_annot loc types + >>? fun t -> + get_two_annot loc fields + >>? fun (f1, f2) -> + ( match (if_special_first, f1) with + | (Some special_var, Some (`Field_annot "@")) -> + ok (split_last_dot special_var) + | (None, Some (`Field_annot "@")) -> + error (Unexpected_annotation loc) + | (_, _) -> + ok (v, f1) ) + >>? fun (v1, f1) -> + ( match (if_special_second, f2) with + | (Some special_var, Some (`Field_annot "@")) -> + ok (split_last_dot special_var) + | (None, Some (`Field_annot "@")) -> + error (Unexpected_annotation loc) + | (_, _) -> + ok (v, f2) ) + >|? fun (v2, f2) -> + let v = match v with None -> common_prefix v1 v2 | Some _ -> v in + (v, t, f1, f2) -let parse_two_var_annot - : int -> string list -> (var_annot option * var_annot option) tzresult - = fun loc annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc types >>? fun () -> - error_unexpected_annot loc fields >>? fun () -> - get_two_annot loc vars +let parse_two_var_annot : + int -> string list -> (var_annot option * var_annot option) tzresult = + fun loc annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc types + >>? fun () -> + error_unexpected_annot loc fields >>? fun () -> get_two_annot loc vars -let parse_destr_annot - : int -> string list -> default_accessor:field_annot option -> - field_name:field_annot option -> - pair_annot:var_annot option -> value_annot:var_annot option -> - (var_annot option * field_annot option) tzresult - = fun loc annot ~default_accessor ~field_name ~pair_annot ~value_annot -> - parse_annots loc ~allow_special_var:true annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc types >>? fun () -> - get_one_annot loc vars >>? fun v -> - get_one_annot loc fields >|? fun f -> - let default = gen_access_annot pair_annot field_name ~default:default_accessor in - let v = match v with - | Some `Var_annot "%" -> field_to_var_annot field_name - | Some `Var_annot "%%" -> default - | Some _ -> v - | None -> value_annot in - (v, f) +let parse_destr_annot : + int -> + string list -> + default_accessor:field_annot option -> + field_name:field_annot option -> + pair_annot:var_annot option -> + value_annot:var_annot option -> + (var_annot option * field_annot option) tzresult = + fun loc annot ~default_accessor ~field_name ~pair_annot ~value_annot -> + parse_annots loc ~allow_special_var:true annot + >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc types + >>? fun () -> + get_one_annot loc vars + >>? fun v -> + get_one_annot loc fields + >|? fun f -> + let default = + gen_access_annot pair_annot field_name ~default:default_accessor + in + let v = + match v with + | Some (`Var_annot "%") -> + field_to_var_annot field_name + | Some (`Var_annot "%%") -> + default + | Some _ -> + v + | None -> + value_annot + in + (v, f) -let parse_entrypoint_annot - : int -> ?default:var_annot option -> string list -> (var_annot option * field_annot option) tzresult - = fun loc ?default annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc types >>? fun () -> - get_one_annot loc fields >>? fun f -> - get_one_annot loc vars >|? function - | Some _ as a -> (a, f) - | None -> match default with - | Some a -> (a, f) - | None -> (None, f) +let parse_entrypoint_annot : + int -> + ?default:var_annot option -> + string list -> + (var_annot option * field_annot option) tzresult = + fun loc ?default annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc types + >>? fun () -> + get_one_annot loc fields + >>? fun f -> + get_one_annot loc vars + >|? function + | Some _ as a -> + (a, f) + | None -> ( + match default with Some a -> (a, f) | None -> (None, f) ) -let parse_var_type_annot - : int -> string list -> (var_annot option * type_annot option) tzresult - = fun loc annot -> - parse_annots loc annot >>? - classify_annot loc >>? fun (vars, types, fields) -> - error_unexpected_annot loc fields >>? fun () -> - get_one_annot loc vars >>? fun v -> - get_one_annot loc types >|? fun t -> - (v, t) +let parse_var_type_annot : + int -> string list -> (var_annot option * type_annot option) tzresult = + fun loc annot -> + parse_annots loc annot >>? classify_annot loc + >>? fun (vars, types, fields) -> + error_unexpected_annot loc fields + >>? fun () -> + get_one_annot loc vars + >>? fun v -> get_one_annot loc types >|? fun t -> (v, t) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.mli b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.mli index 7ac470139..0128a391e 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_annot.mli @@ -29,44 +29,71 @@ open Script_typed_ir (** Default annotations *) val default_now_annot : var_annot option + val default_amount_annot : var_annot option + val default_balance_annot : var_annot option + val default_steps_annot : var_annot option + val default_source_annot : var_annot option + val default_sender_annot : var_annot option + val default_self_annot : var_annot option + val default_arg_annot : var_annot option + val default_param_annot : var_annot option + val default_storage_annot : var_annot option val default_car_annot : field_annot option + val default_cdr_annot : field_annot option + val default_contract_annot : field_annot option + val default_addr_annot : field_annot option + val default_manager_annot : field_annot option + val default_pack_annot : field_annot option + val default_unpack_annot : field_annot option + val default_slice_annot : field_annot option val default_elt_annot : field_annot option + val default_key_annot : field_annot option + val default_hd_annot : field_annot option + val default_tl_annot : field_annot option + val default_some_annot : field_annot option + val default_left_annot : field_annot option + val default_right_annot : field_annot option + val default_binding_annot : field_annot option (** Unparse annotations to their string representation *) val unparse_type_annot : type_annot option -> string list + val unparse_var_annot : var_annot option -> string list + val unparse_field_annot : field_annot option -> string list (** Convertions functions between different annotation kinds *) val field_to_var_annot : field_annot option -> var_annot option + val type_to_var_annot : type_annot option -> var_annot option + val var_to_field_annot : var_annot option -> field_annot option (** Replace an annotation by its default value if it is [None] *) @@ -75,23 +102,30 @@ val default_annot : default:'a option -> 'a option -> 'a option (** Generate annotation for field accesses, of the form [var.field1.field2] *) val gen_access_annot : var_annot option -> - ?default:field_annot option -> field_annot option -> var_annot option + ?default:field_annot option -> + field_annot option -> + var_annot option (** Merge type annotations. @return an error {!Inconsistent_type_annotations} if they are both present and different, unless [legacy] *) val merge_type_annot : - legacy: bool -> type_annot option -> type_annot option -> type_annot option tzresult + legacy:bool -> + type_annot option -> + type_annot option -> + type_annot option tzresult (** Merge field annotations. @return an error {!Inconsistent_type_annotations} if they are both present and different, unless [legacy] *) val merge_field_annot : - legacy: bool -> field_annot option -> field_annot option -> field_annot option tzresult + legacy:bool -> + field_annot option -> + field_annot option -> + field_annot option tzresult (** Merge variable annotations, does not fail ([None] if different). *) -val merge_var_annot : - var_annot option -> var_annot option -> var_annot option +val merge_var_annot : var_annot option -> var_annot option -> var_annot option (** @return an error {!Unexpected_annotation} in the monad the list is not empty. *) val error_unexpected_annot : int -> 'a list -> unit tzresult @@ -103,8 +137,7 @@ val fail_unexpected_annot : int -> 'a list -> unit tzresult Lwt.t val parse_type_annot : int -> string list -> type_annot option tzresult (** Parse a field annotation only. *) -val parse_field_annot : - int -> string list -> field_annot option tzresult +val parse_field_annot : int -> string list -> field_annot option tzresult (** Parse an annotation for composed types, of the form [:ty_name %field] in any order. *) @@ -114,7 +147,8 @@ val parse_type_field_annot : (** Parse an annotation for composed types, of the form [:ty_name %field1 %field2] in any order. *) val parse_composed_type_annot : - int -> string list -> + int -> + string list -> (type_annot option * field_annot option * field_annot option) tzresult (** Extract and remove a field annotation from a node *) @@ -129,23 +163,25 @@ val check_correct_field : (** Parse a variable annotation, replaced by a default value if [None]. *) val parse_var_annot : - int -> - ?default:var_annot option -> - string list -> var_annot option tzresult + int -> ?default:var_annot option -> string list -> var_annot option tzresult val parse_constr_annot : int -> ?if_special_first:field_annot option -> ?if_special_second:field_annot option -> string list -> - (var_annot option * type_annot option * - field_annot option * field_annot option) tzresult + ( var_annot option + * type_annot option + * field_annot option + * field_annot option ) + tzresult val parse_two_var_annot : int -> string list -> (var_annot option * var_annot option) tzresult val parse_destr_annot : - int -> string list -> + int -> + string list -> default_accessor:field_annot option -> field_name:field_annot option -> pair_annot:var_annot option -> diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.ml index b73d610ba..df884eb02 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.ml @@ -29,226 +29,392 @@ open Script open Script_typed_ir open Script_tc_errors open Script_ir_annot - module Typecheck_costs = Michelson_v1_gas.Cost_of.Typechecking module Unparse_costs = Michelson_v1_gas.Cost_of.Unparse -type ex_comparable_ty = Ex_comparable_ty : 'a comparable_ty -> ex_comparable_ty +type ex_comparable_ty = + | Ex_comparable_ty : 'a comparable_ty -> ex_comparable_ty + type ex_ty = Ex_ty : 'a ty -> ex_ty + type ex_stack_ty = Ex_stack_ty : 'a stack_ty -> ex_stack_ty type tc_context = | Lambda : tc_context | Dip : 'a stack_ty * tc_context -> tc_context - | Toplevel : { storage_type : 'sto ty ; param_type : 'param ty ; root_name : string option ; - legacy_create_contract_literal : bool } -> tc_context + | Toplevel : { + storage_type : 'sto ty; + param_type : 'param ty; + root_name : string option; + legacy_create_contract_literal : bool; + } + -> tc_context type unparsing_mode = Optimized | Readable type type_logger = - int -> (Script.expr * Script.annot) list -> (Script.expr * Script.annot) list -> unit + int -> + (Script.expr * Script.annot) list -> + (Script.expr * Script.annot) list -> + unit let add_dip ty annot prev = match prev with - | Lambda | Toplevel _ -> Dip (Item_t (ty, Empty_t, annot), prev) - | Dip (stack, _) -> Dip (Item_t (ty, stack, annot), prev) + | Lambda | Toplevel _ -> + Dip (Item_t (ty, Empty_t, annot), prev) + | Dip (stack, _) -> + Dip (Item_t (ty, stack, annot), prev) (* ---- Type size accounting ------------------------------------------------*) -let rec comparable_type_size : type t a. (t, a) comparable_struct -> int = fun ty -> +let rec comparable_type_size : type t a. (t, a) comparable_struct -> int = + fun ty -> (* No wildcard to force the update when comparable_ty chages. *) match ty with - | Int_key _ -> 1 - | Nat_key _ -> 1 - | String_key _ -> 1 - | Bytes_key _ -> 1 - | Mutez_key _ -> 1 - | Bool_key _ -> 1 - | Key_hash_key _ -> 1 - | Timestamp_key _ -> 1 - | Address_key _ -> 1 - | Pair_key (_, (t, _), _) -> 1 + comparable_type_size t + | Int_key _ -> + 1 + | Nat_key _ -> + 1 + | String_key _ -> + 1 + | Bytes_key _ -> + 1 + | Mutez_key _ -> + 1 + | Bool_key _ -> + 1 + | Key_hash_key _ -> + 1 + | Timestamp_key _ -> + 1 + | Address_key _ -> + 1 + | Pair_key (_, (t, _), _) -> + 1 + comparable_type_size t let rec type_size : type t. t ty -> int = - fun ty -> match ty with - | Unit_t _ -> 1 - | Int_t _ -> 1 - | Nat_t _ -> 1 - | Signature_t _ -> 1 - | Bytes_t _ -> 1 - | String_t _ -> 1 - | Mutez_t _ -> 1 - | Key_hash_t _ -> 1 - | Key_t _ -> 1 - | Timestamp_t _ -> 1 - | Address_t _ -> 1 - | Bool_t _ -> 1 - | Operation_t _ -> 1 - | Pair_t ((l, _, _), (r, _, _), _, _) -> - 1 + type_size l + type_size r - | Union_t ((l, _), (r, _), _, _) -> - 1 + type_size l + type_size r - | Lambda_t (arg, ret, _) -> - 1 + type_size arg + type_size ret - | Option_t (t, _, _) -> - 1 + type_size t - | List_t (t, _, _) -> - 1 + type_size t - | Set_t (k, _) -> - 1 + comparable_type_size k - | Map_t (k, v, _, _) -> - 1 + comparable_type_size k + type_size v - | Big_map_t (k, v, _) -> - 1 + comparable_type_size k + type_size v - | Contract_t (arg, _) -> - 1 + type_size arg - | Chain_id_t _ -> 1 + fun ty -> + match ty with + | Unit_t _ -> + 1 + | Int_t _ -> + 1 + | Nat_t _ -> + 1 + | Signature_t _ -> + 1 + | Bytes_t _ -> + 1 + | String_t _ -> + 1 + | Mutez_t _ -> + 1 + | Key_hash_t _ -> + 1 + | Key_t _ -> + 1 + | Timestamp_t _ -> + 1 + | Address_t _ -> + 1 + | Bool_t _ -> + 1 + | Operation_t _ -> + 1 + | Pair_t ((l, _, _), (r, _, _), _, _) -> + 1 + type_size l + type_size r + | Union_t ((l, _), (r, _), _, _) -> + 1 + type_size l + type_size r + | Lambda_t (arg, ret, _) -> + 1 + type_size arg + type_size ret + | Option_t (t, _, _) -> + 1 + type_size t + | List_t (t, _, _) -> + 1 + type_size t + | Set_t (k, _) -> + 1 + comparable_type_size k + | Map_t (k, v, _, _) -> + 1 + comparable_type_size k + type_size v + | Big_map_t (k, v, _) -> + 1 + comparable_type_size k + type_size v + | Contract_t (arg, _) -> + 1 + type_size arg + | Chain_id_t _ -> + 1 -let rec type_size_of_stack_head - : type st. st stack_ty -> up_to:int -> int - = fun stack ~up_to -> - match stack with - | Empty_t -> 0 - | Item_t (head, tail, _annot) -> - if Compare.Int.(up_to > 0) then - Compare.Int.max (type_size head) - (type_size_of_stack_head tail ~up_to:(up_to - 1)) - else - 0 +let rec type_size_of_stack_head : type st. st stack_ty -> up_to:int -> int = + fun stack ~up_to -> + match stack with + | Empty_t -> + 0 + | Item_t (head, tail, _annot) -> + if Compare.Int.(up_to > 0) then + Compare.Int.max + (type_size head) + (type_size_of_stack_head tail ~up_to:(up_to - 1)) + else 0 (* This is the depth of the stack to inspect for sizes overflow. We only need to check the produced types that can be larger than the arguments. That's why Swap is 0 for instance as no type grows. Constant sized types are not checked: it is assumed they are lower than the bound (otherwise every program would be rejected). *) -let number_of_generated_growing_types : type b a. (b, a) instr -> int = function - | Drop -> 0 - | Dup -> 0 - | Swap -> 0 - | Const _ -> 1 - | Cons_pair -> 1 - | Car -> 0 - | Cdr -> 0 - | Cons_some -> 1 - | Cons_none _ -> 1 - | If_none _ -> 0 - | Left -> 0 - | Right -> 0 - | If_left _ -> 0 - | Cons_list -> 1 - | Nil -> 1 - | If_cons _ -> 0 - | List_map _ -> 1 - | List_size -> 0 - | List_iter _ -> 1 - | Empty_set _ -> 1 - | Set_iter _ -> 0 - | Set_mem -> 0 - | Set_update -> 0 - | Set_size -> 0 - | Empty_map _ -> 1 - | Map_map _ -> 1 - | Map_iter _ -> 1 - | Map_mem -> 0 - | Map_get -> 0 - | Map_update -> 0 - | Map_size -> 0 - | Empty_big_map _ -> 1 - | Big_map_get -> 0 - | Big_map_update -> 0 - | Big_map_mem -> 0 - | Concat_string -> 0 - | Concat_string_pair -> 0 - | Slice_string -> 0 - | String_size -> 0 - | Concat_bytes -> 0 - | Concat_bytes_pair -> 0 - | Slice_bytes -> 0 - | Bytes_size -> 0 - | Add_seconds_to_timestamp -> 0 - | Add_timestamp_to_seconds -> 0 - | Sub_timestamp_seconds -> 0 - | Diff_timestamps -> 0 - | Add_tez -> 0 - | Sub_tez -> 0 - | Mul_teznat -> 0 - | Mul_nattez -> 0 - | Ediv_teznat -> 0 - | Ediv_tez -> 0 - | Or -> 0 - | And -> 0 - | Xor -> 0 - | Not -> 0 - | Is_nat -> 0 - | Neg_nat -> 0 - | Neg_int -> 0 - | Abs_int -> 0 - | Int_nat -> 0 - | Add_intint -> 0 - | Add_intnat -> 0 - | Add_natint -> 0 - | Add_natnat -> 0 - | Sub_int -> 0 - | Mul_intint -> 0 - | Mul_intnat -> 0 - | Mul_natint -> 0 - | Mul_natnat -> 0 - | Ediv_intint -> 0 - | Ediv_intnat -> 0 - | Ediv_natint -> 0 - | Ediv_natnat -> 0 - | Lsl_nat -> 0 - | Lsr_nat -> 0 - | Or_nat -> 0 - | And_nat -> 0 - | And_int_nat -> 0 - | Xor_nat -> 0 - | Not_nat -> 0 - | Not_int -> 0 - | Seq _ -> 0 - | If _ -> 0 - | Loop _ -> 0 - | Loop_left _ -> 0 - | Dip _ -> 0 - | Exec -> 0 - | Apply _ -> 0 - | Lambda _ -> 1 - | Failwith _ -> 1 - | Nop -> 0 - | Compare _ -> 1 - | Eq -> 0 - | Neq -> 0 - | Lt -> 0 - | Gt -> 0 - | Le -> 0 - | Ge -> 0 - | Address -> 0 - | Contract _ -> 1 - | Transfer_tokens -> 1 - | Create_account -> 0 - | Implicit_account -> 0 - | Create_contract _ -> 1 - | Create_contract_2 _ -> 1 - | Now -> 0 - | Balance -> 0 - | Check_signature -> 0 - | Hash_key -> 0 - | Blake2b -> 0 - | Sha256 -> 0 - | Sha512 -> 0 - | Steps_to_quota -> 0 - | Source -> 0 - | Sender -> 0 - | Self _ -> 1 - | Amount -> 0 - | Set_delegate -> 0 - | Pack _ -> 0 - | Unpack _ -> 1 - | Dig _ -> 0 - | Dug _ -> 0 - | Dipn _ -> 0 - | Dropn _ -> 0 - | ChainId -> 0 +let number_of_generated_growing_types : type b a. (b, a) instr -> int = + function + | Drop -> + 0 + | Dup -> + 0 + | Swap -> + 0 + | Const _ -> + 1 + | Cons_pair -> + 1 + | Car -> + 0 + | Cdr -> + 0 + | Cons_some -> + 1 + | Cons_none _ -> + 1 + | If_none _ -> + 0 + | Left -> + 0 + | Right -> + 0 + | If_left _ -> + 0 + | Cons_list -> + 1 + | Nil -> + 1 + | If_cons _ -> + 0 + | List_map _ -> + 1 + | List_size -> + 0 + | List_iter _ -> + 1 + | Empty_set _ -> + 1 + | Set_iter _ -> + 0 + | Set_mem -> + 0 + | Set_update -> + 0 + | Set_size -> + 0 + | Empty_map _ -> + 1 + | Map_map _ -> + 1 + | Map_iter _ -> + 1 + | Map_mem -> + 0 + | Map_get -> + 0 + | Map_update -> + 0 + | Map_size -> + 0 + | Empty_big_map _ -> + 1 + | Big_map_get -> + 0 + | Big_map_update -> + 0 + | Big_map_mem -> + 0 + | Concat_string -> + 0 + | Concat_string_pair -> + 0 + | Slice_string -> + 0 + | String_size -> + 0 + | Concat_bytes -> + 0 + | Concat_bytes_pair -> + 0 + | Slice_bytes -> + 0 + | Bytes_size -> + 0 + | Add_seconds_to_timestamp -> + 0 + | Add_timestamp_to_seconds -> + 0 + | Sub_timestamp_seconds -> + 0 + | Diff_timestamps -> + 0 + | Add_tez -> + 0 + | Sub_tez -> + 0 + | Mul_teznat -> + 0 + | Mul_nattez -> + 0 + | Ediv_teznat -> + 0 + | Ediv_tez -> + 0 + | Or -> + 0 + | And -> + 0 + | Xor -> + 0 + | Not -> + 0 + | Is_nat -> + 0 + | Neg_nat -> + 0 + | Neg_int -> + 0 + | Abs_int -> + 0 + | Int_nat -> + 0 + | Add_intint -> + 0 + | Add_intnat -> + 0 + | Add_natint -> + 0 + | Add_natnat -> + 0 + | Sub_int -> + 0 + | Mul_intint -> + 0 + | Mul_intnat -> + 0 + | Mul_natint -> + 0 + | Mul_natnat -> + 0 + | Ediv_intint -> + 0 + | Ediv_intnat -> + 0 + | Ediv_natint -> + 0 + | Ediv_natnat -> + 0 + | Lsl_nat -> + 0 + | Lsr_nat -> + 0 + | Or_nat -> + 0 + | And_nat -> + 0 + | And_int_nat -> + 0 + | Xor_nat -> + 0 + | Not_nat -> + 0 + | Not_int -> + 0 + | Seq _ -> + 0 + | If _ -> + 0 + | Loop _ -> + 0 + | Loop_left _ -> + 0 + | Dip _ -> + 0 + | Exec -> + 0 + | Apply _ -> + 0 + | Lambda _ -> + 1 + | Failwith _ -> + 1 + | Nop -> + 0 + | Compare _ -> + 1 + | Eq -> + 0 + | Neq -> + 0 + | Lt -> + 0 + | Gt -> + 0 + | Le -> + 0 + | Ge -> + 0 + | Address -> + 0 + | Contract _ -> + 1 + | Transfer_tokens -> + 1 + | Create_account -> + 0 + | Implicit_account -> + 0 + | Create_contract _ -> + 1 + | Create_contract_2 _ -> + 1 + | Now -> + 0 + | Balance -> + 0 + | Check_signature -> + 0 + | Hash_key -> + 0 + | Blake2b -> + 0 + | Sha256 -> + 0 + | Sha512 -> + 0 + | Steps_to_quota -> + 0 + | Source -> + 0 + | Sender -> + 0 + | Self _ -> + 1 + | Amount -> + 0 + | Set_delegate -> + 0 + | Pack _ -> + 0 + | Unpack _ -> + 1 + | Dig _ -> + 0 + | Dug _ -> + 0 + | Dipn _ -> + 0 + | Dropn _ -> + 0 + | ChainId -> + 0 (* ---- Error helpers -------------------------------------------------------*) @@ -257,19 +423,24 @@ let location = function | Int (loc, _) | String (loc, _) | Bytes (loc, _) - | Seq (loc, _) -> loc + | Seq (loc, _) -> + loc let kind = function - | Int _ -> Int_kind - | String _ -> String_kind - | Bytes _ -> Bytes_kind - | Prim _ -> Prim_kind - | Seq _ -> Seq_kind + | Int _ -> + Int_kind + | String _ -> + String_kind + | Bytes _ -> + Bytes_kind + | Prim _ -> + Prim_kind + | Seq _ -> + Seq_kind let namespace = function - | K_parameter - | K_storage - | K_code -> Keyword_namespace + | K_parameter | K_storage | K_code -> + Keyword_namespace | D_False | D_Elt | D_Left @@ -278,7 +449,8 @@ let namespace = function | D_Right | D_Some | D_True - | D_Unit -> Constant_namespace + | D_Unit -> + Constant_namespace | I_PACK | I_UNPACK | I_BLAKE2B @@ -361,7 +533,8 @@ let namespace = function | I_CAST | I_RENAME | I_DIG - | I_DUG -> Instr_namespace + | I_DUG -> + Instr_namespace | T_bool | T_contract | T_int @@ -384,28 +557,31 @@ let namespace = function | T_unit | T_operation | T_address - | T_chain_id -> Type_namespace - + | T_chain_id -> + Type_namespace let unexpected expr exp_kinds exp_ns exp_prims = match expr with - | Int (loc, _) -> Invalid_kind (loc, Prim_kind :: exp_kinds, Int_kind) - | String (loc, _ ) -> Invalid_kind (loc, Prim_kind :: exp_kinds, String_kind) - | Bytes (loc, _ ) -> Invalid_kind (loc, Prim_kind :: exp_kinds, Bytes_kind) - | Seq (loc, _) -> Invalid_kind (loc, Prim_kind :: exp_kinds, Seq_kind) - | Prim (loc, name, _, _) -> - match namespace name, exp_ns with - | Type_namespace, Type_namespace - | Instr_namespace, Instr_namespace - | Constant_namespace, Constant_namespace -> - Invalid_primitive (loc, exp_prims, name) - | ns, _ -> - Invalid_namespace (loc, name, exp_ns, ns) + | Int (loc, _) -> + Invalid_kind (loc, Prim_kind :: exp_kinds, Int_kind) + | String (loc, _) -> + Invalid_kind (loc, Prim_kind :: exp_kinds, String_kind) + | Bytes (loc, _) -> + Invalid_kind (loc, Prim_kind :: exp_kinds, Bytes_kind) + | Seq (loc, _) -> + Invalid_kind (loc, Prim_kind :: exp_kinds, Seq_kind) + | Prim (loc, name, _, _) -> ( + match (namespace name, exp_ns) with + | (Type_namespace, Type_namespace) + | (Instr_namespace, Instr_namespace) + | (Constant_namespace, Constant_namespace) -> + Invalid_primitive (loc, exp_prims, name) + | (ns, _) -> + Invalid_namespace (loc, name, exp_ns, ns) ) let check_kind kinds expr = let kind = kind expr in - if List.mem kind kinds then - return_unit + if List.mem kind kinds then return_unit else let loc = location expr in fail (Invalid_kind (loc, kinds, kind)) @@ -414,3458 +590,5211 @@ let check_kind kinds expr = let wrap_compare compare a b = let res = compare a b in - if Compare.Int.(res = 0) then 0 - else if Compare.Int.(res > 0) then 1 - else -1 + if Compare.Int.(res = 0) then 0 else if Compare.Int.(res > 0) then 1 else -1 -let rec compare_comparable - : type a s. (a, s) comparable_struct -> a -> a -> int - = fun kind -> match kind with - | String_key _ -> wrap_compare Compare.String.compare - | Bool_key _ -> wrap_compare Compare.Bool.compare - | Mutez_key _ -> wrap_compare Tez.compare - | Key_hash_key _ -> wrap_compare Signature.Public_key_hash.compare - | Int_key _ -> wrap_compare Script_int.compare - | Nat_key _ -> wrap_compare Script_int.compare - | Timestamp_key _ -> wrap_compare Script_timestamp.compare - | Address_key _ -> - wrap_compare @@ fun (x, ex) (y, ey) -> - let lres = Contract.compare x y in - if Compare.Int.(lres = 0) then - Compare.String.compare ex ey - else lres - | Bytes_key _ -> wrap_compare MBytes.compare - | Pair_key ((tl, _), (tr, _), _) -> - fun (lx, rx) (ly, ry) -> - let lres = compare_comparable tl lx ly in - if Compare.Int.(lres = 0) then - compare_comparable tr rx ry - else lres +let rec compare_comparable : + type a s. (a, s) comparable_struct -> a -> a -> int = + fun kind -> + match kind with + | String_key _ -> + wrap_compare Compare.String.compare + | Bool_key _ -> + wrap_compare Compare.Bool.compare + | Mutez_key _ -> + wrap_compare Tez.compare + | Key_hash_key _ -> + wrap_compare Signature.Public_key_hash.compare + | Int_key _ -> + wrap_compare Script_int.compare + | Nat_key _ -> + wrap_compare Script_int.compare + | Timestamp_key _ -> + wrap_compare Script_timestamp.compare + | Address_key _ -> + wrap_compare + @@ fun (x, ex) (y, ey) -> + let lres = Contract.compare x y in + if Compare.Int.(lres = 0) then Compare.String.compare ex ey else lres + | Bytes_key _ -> + wrap_compare MBytes.compare + | Pair_key ((tl, _), (tr, _), _) -> + fun (lx, rx) (ly, ry) -> + let lres = compare_comparable tl lx ly in + if Compare.Int.(lres = 0) then compare_comparable tr rx ry else lres -let empty_set - : type a. a comparable_ty -> a set - = fun ty -> - let module OPS = Set.Make (struct - type t = a - let compare = compare_comparable ty - end) in - (module struct - type elt = a - let elt_ty = ty - module OPS = OPS - let boxed = OPS.empty - let size = 0 - end) +let empty_set : type a. a comparable_ty -> a set = + fun ty -> + let module OPS = Set.Make (struct + type t = a -let set_update - : type a. a -> bool -> a set -> a set - = fun v b (module Box) -> - (module struct - type elt = a - let elt_ty = Box.elt_ty - module OPS = Box.OPS - let boxed = - if b - then Box.OPS.add v Box.boxed - else Box.OPS.remove v Box.boxed - let size = - let mem = Box.OPS.mem v Box.boxed in - if mem - then if b then Box.size else Box.size - 1 - else if b then Box.size + 1 else Box.size - end) + let compare = compare_comparable ty + end) in + ( module struct + type elt = a -let set_mem - : type elt. elt -> elt set -> bool - = fun v (module Box) -> - Box.OPS.mem v Box.boxed + let elt_ty = ty -let set_fold - : type elt acc. (elt -> acc -> acc) -> elt set -> acc -> acc - = fun f (module Box) -> - Box.OPS.fold f Box.boxed + module OPS = OPS -let set_size - : type elt. elt set -> Script_int.n Script_int.num = - fun (module Box) -> - Script_int.(abs (of_int Box.size)) + let boxed = OPS.empty -let map_key_ty - : type a b. (a, b) map -> a comparable_ty - = fun (module Box) -> Box.key_ty + let size = 0 + end ) -let empty_map - : type a b. a comparable_ty -> (a, b) map - = fun ty -> - let module OPS = Map.Make (struct - type t = a - let compare = compare_comparable ty - end) in - (module struct - type key = a - type value = b - let key_ty = ty - module OPS = OPS - let boxed = (OPS.empty, 0) - end) +let set_update : type a. a -> bool -> a set -> a set = + fun v b (module Box) -> + ( module struct + type elt = a -let map_get - : type key value. key -> (key, value) map -> value option - = fun k (module Box) -> - Box.OPS.find_opt k (fst Box.boxed) + let elt_ty = Box.elt_ty -let map_update - : type a b. a -> b option -> (a, b) map -> (a, b) map - = fun k v (module Box) -> - (module struct - type key = a - type value = b - let key_ty = Box.key_ty - module OPS = Box.OPS - let boxed = - let (map, size) = Box.boxed in - let contains = Box.OPS.mem k map in - match v with - | Some v -> (Box.OPS.add k v map, size + if contains then 0 else 1) - | None -> (Box.OPS.remove k map, size - if contains then 1 else 0) - end) + module OPS = Box.OPS -let map_set - : type a b. a -> b -> (a, b) map -> (a, b) map - = fun k v (module Box) -> - (module struct - type key = a - type value = b - let key_ty = Box.key_ty - module OPS = Box.OPS - let boxed = - let (map, size) = Box.boxed in - (Box.OPS.add k v map, if Box.OPS.mem k map then size else size + 1) - end) + let boxed = + if b then Box.OPS.add v Box.boxed else Box.OPS.remove v Box.boxed -let map_mem - : type key value. key -> (key, value) map -> bool - = fun k (module Box) -> - Box.OPS.mem k (fst Box.boxed) + let size = + let mem = Box.OPS.mem v Box.boxed in + if mem then if b then Box.size else Box.size - 1 + else if b then Box.size + 1 + else Box.size + end ) -let map_fold - : type key value acc. (key -> value -> acc -> acc) -> (key, value) map -> acc -> acc - = fun f (module Box) -> - Box.OPS.fold f (fst Box.boxed) +let set_mem : type elt. elt -> elt set -> bool = + fun v (module Box) -> Box.OPS.mem v Box.boxed -let map_size - : type key value. (key, value) map -> Script_int.n Script_int.num = - fun (module Box) -> - Script_int.(abs (of_int (snd Box.boxed))) +let set_fold : type elt acc. (elt -> acc -> acc) -> elt set -> acc -> acc = + fun f (module Box) -> Box.OPS.fold f Box.boxed + +let set_size : type elt. elt set -> Script_int.n Script_int.num = + fun (module Box) -> Script_int.(abs (of_int Box.size)) + +let map_key_ty : type a b. (a, b) map -> a comparable_ty = + fun (module Box) -> Box.key_ty + +let empty_map : type a b. a comparable_ty -> (a, b) map = + fun ty -> + let module OPS = Map.Make (struct + type t = a + + let compare = compare_comparable ty + end) in + ( module struct + type key = a + + type value = b + + let key_ty = ty + + module OPS = OPS + + let boxed = (OPS.empty, 0) + end ) + +let map_get : type key value. key -> (key, value) map -> value option = + fun k (module Box) -> Box.OPS.find_opt k (fst Box.boxed) + +let map_update : type a b. a -> b option -> (a, b) map -> (a, b) map = + fun k v (module Box) -> + ( module struct + type key = a + + type value = b + + let key_ty = Box.key_ty + + module OPS = Box.OPS + + let boxed = + let (map, size) = Box.boxed in + let contains = Box.OPS.mem k map in + match v with + | Some v -> + (Box.OPS.add k v map, size + if contains then 0 else 1) + | None -> + (Box.OPS.remove k map, size - if contains then 1 else 0) + end ) + +let map_set : type a b. a -> b -> (a, b) map -> (a, b) map = + fun k v (module Box) -> + ( module struct + type key = a + + type value = b + + let key_ty = Box.key_ty + + module OPS = Box.OPS + + let boxed = + let (map, size) = Box.boxed in + (Box.OPS.add k v map, if Box.OPS.mem k map then size else size + 1) + end ) + +let map_mem : type key value. key -> (key, value) map -> bool = + fun k (module Box) -> Box.OPS.mem k (fst Box.boxed) + +let map_fold : + type key value acc. + (key -> value -> acc -> acc) -> (key, value) map -> acc -> acc = + fun f (module Box) -> Box.OPS.fold f (fst Box.boxed) + +let map_size : type key value. (key, value) map -> Script_int.n Script_int.num + = + fun (module Box) -> Script_int.(abs (of_int (snd Box.boxed))) (* ---- Unparsing (Typed IR -> Untyped expressions) of types -----------------*) -let rec ty_of_comparable_ty - : type a s. (a, s) comparable_struct -> a ty - = function - | Int_key tname -> Int_t tname - | Nat_key tname -> Nat_t tname - | String_key tname -> String_t tname - | Bytes_key tname -> Bytes_t tname - | Mutez_key tname -> Mutez_t tname - | Bool_key tname -> Bool_t tname - | Key_hash_key tname -> Key_hash_t tname - | Timestamp_key tname -> Timestamp_t tname - | Address_key tname -> Address_t tname - | Pair_key ((l, al), (r, ar), tname) -> - Pair_t ((ty_of_comparable_ty l, al, None), (ty_of_comparable_ty r, ar, None), tname, false) +let rec ty_of_comparable_ty : type a s. (a, s) comparable_struct -> a ty = + function + | Int_key tname -> + Int_t tname + | Nat_key tname -> + Nat_t tname + | String_key tname -> + String_t tname + | Bytes_key tname -> + Bytes_t tname + | Mutez_key tname -> + Mutez_t tname + | Bool_key tname -> + Bool_t tname + | Key_hash_key tname -> + Key_hash_t tname + | Timestamp_key tname -> + Timestamp_t tname + | Address_key tname -> + Address_t tname + | Pair_key ((l, al), (r, ar), tname) -> + Pair_t + ( (ty_of_comparable_ty l, al, None), + (ty_of_comparable_ty r, ar, None), + tname, + false ) -let rec comparable_ty_of_ty - : type a. a ty -> a comparable_ty option - = function - | Int_t tname -> Some (Int_key tname) - | Nat_t tname -> Some (Nat_key tname) - | String_t tname -> Some (String_key tname) - | Bytes_t tname -> Some (Bytes_key tname) - | Mutez_t tname -> Some (Mutez_key tname) - | Bool_t tname -> Some (Bool_key tname) - | Key_hash_t tname -> Some (Key_hash_key tname) - | Timestamp_t tname -> Some (Timestamp_key tname) - | Address_t tname -> Some (Address_key tname) - | Pair_t ((l, al, _), (r, ar, _), pname, _) -> - begin match comparable_ty_of_ty r with - | None -> None - | Some rty -> - match comparable_ty_of_ty l with - | None -> None - | Some (Pair_key _) -> None (* not a comb *) - | Some (Int_key tname) -> Some (Pair_key ((Int_key tname, al), (rty, ar), pname)) - | Some (Nat_key tname) -> Some (Pair_key ((Nat_key tname, al), (rty, ar), pname)) - | Some (String_key tname) -> Some (Pair_key ((String_key tname, al), (rty, ar), pname)) - | Some (Bytes_key tname) -> Some (Pair_key ((Bytes_key tname, al), (rty, ar), pname)) - | Some (Mutez_key tname) -> Some (Pair_key ((Mutez_key tname, al), (rty, ar), pname)) - | Some (Bool_key tname) -> Some (Pair_key ((Bool_key tname, al), (rty, ar), pname)) - | Some (Key_hash_key tname) -> Some (Pair_key ((Key_hash_key tname, al), (rty, ar), pname)) - | Some (Timestamp_key tname) -> Some (Pair_key ((Timestamp_key tname, al), (rty, ar), pname)) - | Some (Address_key tname) -> Some (Pair_key ((Address_key tname, al), (rty, ar), pname)) - end - | _ -> None +let rec comparable_ty_of_ty : type a. a ty -> a comparable_ty option = function + | Int_t tname -> + Some (Int_key tname) + | Nat_t tname -> + Some (Nat_key tname) + | String_t tname -> + Some (String_key tname) + | Bytes_t tname -> + Some (Bytes_key tname) + | Mutez_t tname -> + Some (Mutez_key tname) + | Bool_t tname -> + Some (Bool_key tname) + | Key_hash_t tname -> + Some (Key_hash_key tname) + | Timestamp_t tname -> + Some (Timestamp_key tname) + | Address_t tname -> + Some (Address_key tname) + | Pair_t ((l, al, _), (r, ar, _), pname, _) -> ( + match comparable_ty_of_ty r with + | None -> + None + | Some rty -> ( + match comparable_ty_of_ty l with + | None -> + None + | Some (Pair_key _) -> + None (* not a comb *) + | Some (Int_key tname) -> + Some (Pair_key ((Int_key tname, al), (rty, ar), pname)) + | Some (Nat_key tname) -> + Some (Pair_key ((Nat_key tname, al), (rty, ar), pname)) + | Some (String_key tname) -> + Some (Pair_key ((String_key tname, al), (rty, ar), pname)) + | Some (Bytes_key tname) -> + Some (Pair_key ((Bytes_key tname, al), (rty, ar), pname)) + | Some (Mutez_key tname) -> + Some (Pair_key ((Mutez_key tname, al), (rty, ar), pname)) + | Some (Bool_key tname) -> + Some (Pair_key ((Bool_key tname, al), (rty, ar), pname)) + | Some (Key_hash_key tname) -> + Some (Pair_key ((Key_hash_key tname, al), (rty, ar), pname)) + | Some (Timestamp_key tname) -> + Some (Pair_key ((Timestamp_key tname, al), (rty, ar), pname)) + | Some (Address_key tname) -> + Some (Pair_key ((Address_key tname, al), (rty, ar), pname)) ) ) + | _ -> + None let add_field_annot a var = function | Prim (loc, prim, args, annots) -> - Prim (loc, prim, args, annots @ unparse_field_annot a @ unparse_var_annot var ) - | expr -> expr + Prim + ( loc, + prim, + args, + annots @ unparse_field_annot a @ unparse_var_annot var ) + | expr -> + expr -let rec unparse_comparable_ty - : type a s. (a, s) comparable_struct -> Script.node - = function - | Int_key tname -> Prim (-1, T_int, [], unparse_type_annot tname) - | Nat_key tname -> Prim (-1, T_nat, [], unparse_type_annot tname) - | String_key tname -> Prim (-1, T_string, [], unparse_type_annot tname) - | Bytes_key tname -> Prim (-1, T_bytes, [], unparse_type_annot tname) - | Mutez_key tname -> Prim (-1, T_mutez, [], unparse_type_annot tname) - | Bool_key tname -> Prim (-1, T_bool, [], unparse_type_annot tname) - | Key_hash_key tname -> Prim (-1, T_key_hash, [], unparse_type_annot tname) - | Timestamp_key tname -> Prim (-1, T_timestamp, [], unparse_type_annot tname) - | Address_key tname -> Prim (-1, T_address, [], unparse_type_annot tname) - | Pair_key ((l, al), (r, ar), pname) -> - let tl = add_field_annot al None (unparse_comparable_ty l) in - let tr = add_field_annot ar None (unparse_comparable_ty r) in - Prim (-1, T_pair, [ tl ; tr ], unparse_type_annot pname) +let rec unparse_comparable_ty : + type a s. (a, s) comparable_struct -> Script.node = function + | Int_key tname -> + Prim (-1, T_int, [], unparse_type_annot tname) + | Nat_key tname -> + Prim (-1, T_nat, [], unparse_type_annot tname) + | String_key tname -> + Prim (-1, T_string, [], unparse_type_annot tname) + | Bytes_key tname -> + Prim (-1, T_bytes, [], unparse_type_annot tname) + | Mutez_key tname -> + Prim (-1, T_mutez, [], unparse_type_annot tname) + | Bool_key tname -> + Prim (-1, T_bool, [], unparse_type_annot tname) + | Key_hash_key tname -> + Prim (-1, T_key_hash, [], unparse_type_annot tname) + | Timestamp_key tname -> + Prim (-1, T_timestamp, [], unparse_type_annot tname) + | Address_key tname -> + Prim (-1, T_address, [], unparse_type_annot tname) + | Pair_key ((l, al), (r, ar), pname) -> + let tl = add_field_annot al None (unparse_comparable_ty l) in + let tr = add_field_annot ar None (unparse_comparable_ty r) in + Prim (-1, T_pair, [tl; tr], unparse_type_annot pname) -let rec unparse_ty_no_lwt - : type a. context -> a ty -> (Script.node * context) tzresult - = fun ctxt ty -> - Gas.consume ctxt Unparse_costs.cycle >>? fun ctxt -> - let return ctxt (name, args, annot) = - let result = Prim (-1, name, args, annot) in - Gas.consume ctxt (Unparse_costs.prim_cost (List.length args) annot) >>? fun ctxt -> - ok (result, ctxt) in - match ty with - | Unit_t tname -> return ctxt (T_unit, [], unparse_type_annot tname) - | Int_t tname -> return ctxt (T_int, [], unparse_type_annot tname) - | Nat_t tname -> return ctxt (T_nat, [], unparse_type_annot tname) - | String_t tname -> return ctxt (T_string, [], unparse_type_annot tname) - | Bytes_t tname -> return ctxt (T_bytes, [], unparse_type_annot tname) - | Mutez_t tname -> return ctxt (T_mutez, [], unparse_type_annot tname) - | Bool_t tname -> return ctxt (T_bool, [], unparse_type_annot tname) - | Key_hash_t tname -> return ctxt (T_key_hash, [], unparse_type_annot tname) - | Key_t tname -> return ctxt (T_key, [], unparse_type_annot tname) - | Timestamp_t tname -> return ctxt (T_timestamp, [], unparse_type_annot tname) - | Address_t tname -> return ctxt (T_address, [], unparse_type_annot tname) - | Signature_t tname -> return ctxt (T_signature, [], unparse_type_annot tname) - | Operation_t tname -> return ctxt (T_operation, [], unparse_type_annot tname) - | Chain_id_t tname -> return ctxt (T_chain_id, [], unparse_type_annot tname) - | Contract_t (ut, tname) -> - unparse_ty_no_lwt ctxt ut >>? fun (t, ctxt) -> - return ctxt (T_contract, [ t ], unparse_type_annot tname) - | Pair_t ((utl, l_field, l_var), (utr, r_field, r_var), tname, _) -> - let annot = unparse_type_annot tname in - unparse_ty_no_lwt ctxt utl >>? fun (utl, ctxt) -> - let tl = add_field_annot l_field l_var utl in - unparse_ty_no_lwt ctxt utr >>? fun (utr, ctxt) -> - let tr = add_field_annot r_field r_var utr in - return ctxt (T_pair, [ tl; tr ], annot) - | Union_t ((utl, l_field), (utr, r_field), tname, _) -> - let annot = unparse_type_annot tname in - unparse_ty_no_lwt ctxt utl >>? fun (utl, ctxt) -> - let tl = add_field_annot l_field None utl in - unparse_ty_no_lwt ctxt utr >>? fun (utr, ctxt) -> - let tr = add_field_annot r_field None utr in - return ctxt (T_or, [ tl; tr ], annot) - | Lambda_t (uta, utr, tname) -> - unparse_ty_no_lwt ctxt uta >>? fun (ta, ctxt) -> - unparse_ty_no_lwt ctxt utr >>? fun (tr, ctxt) -> - return ctxt (T_lambda, [ ta; tr ], unparse_type_annot tname) - | Option_t (ut, tname, _) -> - let annot = unparse_type_annot tname in - unparse_ty_no_lwt ctxt ut >>? fun (ut, ctxt) -> - return ctxt (T_option, [ ut ], annot) - | List_t (ut, tname, _) -> - unparse_ty_no_lwt ctxt ut >>? fun (t, ctxt) -> - return ctxt (T_list, [ t ], unparse_type_annot tname) - | Set_t (ut, tname) -> - let t = unparse_comparable_ty ut in - return ctxt (T_set, [ t ], unparse_type_annot tname) - | Map_t (uta, utr, tname, _) -> - let ta = unparse_comparable_ty uta in - unparse_ty_no_lwt ctxt utr >>? fun (tr, ctxt) -> - return ctxt (T_map, [ ta; tr ], unparse_type_annot tname) - | Big_map_t (uta, utr, tname) -> - let ta = unparse_comparable_ty uta in - unparse_ty_no_lwt ctxt utr >>? fun (tr, ctxt) -> - return ctxt (T_big_map, [ ta; tr ], unparse_type_annot tname) +let rec unparse_ty_no_lwt : + type a. context -> a ty -> (Script.node * context) tzresult = + fun ctxt ty -> + Gas.consume ctxt Unparse_costs.cycle + >>? fun ctxt -> + let return ctxt (name, args, annot) = + let result = Prim (-1, name, args, annot) in + Gas.consume ctxt (Unparse_costs.prim_cost (List.length args) annot) + >>? fun ctxt -> ok (result, ctxt) + in + match ty with + | Unit_t tname -> + return ctxt (T_unit, [], unparse_type_annot tname) + | Int_t tname -> + return ctxt (T_int, [], unparse_type_annot tname) + | Nat_t tname -> + return ctxt (T_nat, [], unparse_type_annot tname) + | String_t tname -> + return ctxt (T_string, [], unparse_type_annot tname) + | Bytes_t tname -> + return ctxt (T_bytes, [], unparse_type_annot tname) + | Mutez_t tname -> + return ctxt (T_mutez, [], unparse_type_annot tname) + | Bool_t tname -> + return ctxt (T_bool, [], unparse_type_annot tname) + | Key_hash_t tname -> + return ctxt (T_key_hash, [], unparse_type_annot tname) + | Key_t tname -> + return ctxt (T_key, [], unparse_type_annot tname) + | Timestamp_t tname -> + return ctxt (T_timestamp, [], unparse_type_annot tname) + | Address_t tname -> + return ctxt (T_address, [], unparse_type_annot tname) + | Signature_t tname -> + return ctxt (T_signature, [], unparse_type_annot tname) + | Operation_t tname -> + return ctxt (T_operation, [], unparse_type_annot tname) + | Chain_id_t tname -> + return ctxt (T_chain_id, [], unparse_type_annot tname) + | Contract_t (ut, tname) -> + unparse_ty_no_lwt ctxt ut + >>? fun (t, ctxt) -> + return ctxt (T_contract, [t], unparse_type_annot tname) + | Pair_t ((utl, l_field, l_var), (utr, r_field, r_var), tname, _) -> + let annot = unparse_type_annot tname in + unparse_ty_no_lwt ctxt utl + >>? fun (utl, ctxt) -> + let tl = add_field_annot l_field l_var utl in + unparse_ty_no_lwt ctxt utr + >>? fun (utr, ctxt) -> + let tr = add_field_annot r_field r_var utr in + return ctxt (T_pair, [tl; tr], annot) + | Union_t ((utl, l_field), (utr, r_field), tname, _) -> + let annot = unparse_type_annot tname in + unparse_ty_no_lwt ctxt utl + >>? fun (utl, ctxt) -> + let tl = add_field_annot l_field None utl in + unparse_ty_no_lwt ctxt utr + >>? fun (utr, ctxt) -> + let tr = add_field_annot r_field None utr in + return ctxt (T_or, [tl; tr], annot) + | Lambda_t (uta, utr, tname) -> + unparse_ty_no_lwt ctxt uta + >>? fun (ta, ctxt) -> + unparse_ty_no_lwt ctxt utr + >>? fun (tr, ctxt) -> + return ctxt (T_lambda, [ta; tr], unparse_type_annot tname) + | Option_t (ut, tname, _) -> + let annot = unparse_type_annot tname in + unparse_ty_no_lwt ctxt ut + >>? fun (ut, ctxt) -> return ctxt (T_option, [ut], annot) + | List_t (ut, tname, _) -> + unparse_ty_no_lwt ctxt ut + >>? fun (t, ctxt) -> return ctxt (T_list, [t], unparse_type_annot tname) + | Set_t (ut, tname) -> + let t = unparse_comparable_ty ut in + return ctxt (T_set, [t], unparse_type_annot tname) + | Map_t (uta, utr, tname, _) -> + let ta = unparse_comparable_ty uta in + unparse_ty_no_lwt ctxt utr + >>? fun (tr, ctxt) -> + return ctxt (T_map, [ta; tr], unparse_type_annot tname) + | Big_map_t (uta, utr, tname) -> + let ta = unparse_comparable_ty uta in + unparse_ty_no_lwt ctxt utr + >>? fun (tr, ctxt) -> + return ctxt (T_big_map, [ta; tr], unparse_type_annot tname) let unparse_ty ctxt ty = Lwt.return (unparse_ty_no_lwt ctxt ty) let rec strip_var_annots = function - | Int _ | String _ | Bytes _ as atom -> atom - | Seq (loc, args) -> Seq (loc, List.map strip_var_annots args) + | (Int _ | String _ | Bytes _) as atom -> + atom + | Seq (loc, args) -> + Seq (loc, List.map strip_var_annots args) | Prim (loc, name, args, annots) -> - let not_var_annot s = Compare.Char.(String.get s 0 <> '@') in + let not_var_annot s = Compare.Char.(s.[0] <> '@') in let annots = List.filter not_var_annot annots in Prim (loc, name, List.map strip_var_annots args, annots) let serialize_ty_for_error ctxt ty = - unparse_ty_no_lwt ctxt ty |> - record_trace Cannot_serialize_error >|? fun (ty, ctxt) -> - strip_locations (strip_var_annots ty), ctxt + unparse_ty_no_lwt ctxt ty + |> record_trace Cannot_serialize_error + >|? fun (ty, ctxt) -> (strip_locations (strip_var_annots ty), ctxt) -let rec unparse_stack - : type a. context -> a stack_ty -> ((Script.expr * Script.annot) list * context) tzresult Lwt.t - = fun ctxt -> function - | Empty_t -> return ([], ctxt) - | Item_t (ty, rest, annot) -> - unparse_ty ctxt ty >>=? fun (uty, ctxt) -> - unparse_stack ctxt rest >>=? fun (urest, ctxt) -> - return ((strip_locations uty, unparse_var_annot annot) :: urest, ctxt) +let rec unparse_stack : + type a. + context -> + a stack_ty -> + ((Script.expr * Script.annot) list * context) tzresult Lwt.t = + fun ctxt -> function + | Empty_t -> + return ([], ctxt) + | Item_t (ty, rest, annot) -> + unparse_ty ctxt ty + >>=? fun (uty, ctxt) -> + unparse_stack ctxt rest + >>=? fun (urest, ctxt) -> + return ((strip_locations uty, unparse_var_annot annot) :: urest, ctxt) let serialize_stack_for_error ctxt stack_ty = trace Cannot_serialize_error (unparse_stack ctxt stack_ty) -let name_of_ty - : type a. a ty -> type_annot option - = function - | Unit_t tname -> tname - | Int_t tname -> tname - | Nat_t tname -> tname - | String_t tname -> tname - | Bytes_t tname -> tname - | Mutez_t tname -> tname - | Bool_t tname -> tname - | Key_hash_t tname -> tname - | Key_t tname -> tname - | Timestamp_t tname -> tname - | Address_t tname -> tname - | Signature_t tname -> tname - | Operation_t tname -> tname - | Chain_id_t tname -> tname - | Contract_t (_, tname) -> tname - | Pair_t (_, _, tname, _) -> tname - | Union_t (_, _, tname, _) -> tname - | Lambda_t (_, _, tname) -> tname - | Option_t (_, tname, _) -> tname - | List_t (_, tname, _) -> tname - | Set_t (_, tname) -> tname - | Map_t (_, _, tname, _) -> tname - | Big_map_t (_, _, tname) -> tname +let name_of_ty : type a. a ty -> type_annot option = function + | Unit_t tname -> + tname + | Int_t tname -> + tname + | Nat_t tname -> + tname + | String_t tname -> + tname + | Bytes_t tname -> + tname + | Mutez_t tname -> + tname + | Bool_t tname -> + tname + | Key_hash_t tname -> + tname + | Key_t tname -> + tname + | Timestamp_t tname -> + tname + | Address_t tname -> + tname + | Signature_t tname -> + tname + | Operation_t tname -> + tname + | Chain_id_t tname -> + tname + | Contract_t (_, tname) -> + tname + | Pair_t (_, _, tname, _) -> + tname + | Union_t (_, _, tname, _) -> + tname + | Lambda_t (_, _, tname) -> + tname + | Option_t (_, tname, _) -> + tname + | List_t (_, tname, _) -> + tname + | Set_t (_, tname) -> + tname + | Map_t (_, _, tname, _) -> + tname + | Big_map_t (_, _, tname) -> + tname (* ---- Equality witnesses --------------------------------------------------*) type ('ta, 'tb) eq = Eq : ('same, 'same) eq -let comparable_ty_eq - : type ta tb. +let rec comparable_ty_eq : + type ta tb s. context -> - ta comparable_ty -> tb comparable_ty -> - (ta comparable_ty, tb comparable_ty) eq tzresult - = fun ctxt ta tb -> match ta, tb with - | Int_key _, Int_key _ -> Ok Eq - | Nat_key _, Nat_key _ -> Ok Eq - | String_key _, String_key _ -> Ok Eq - | Bytes_key _, Bytes_key _ -> Ok Eq - | Mutez_key _, Mutez_key _ -> Ok Eq - | Bool_key _, Bool_key _ -> Ok Eq - | Key_hash_key _, Key_hash_key _ -> Ok Eq - | Timestamp_key _, Timestamp_key _ -> Ok Eq - | Address_key _, Address_key _ -> Ok Eq - | _, _ -> - serialize_ty_for_error ctxt (ty_of_comparable_ty ta) >>? fun (ta, ctxt) -> - serialize_ty_for_error ctxt (ty_of_comparable_ty tb) >>? fun (tb, _ctxt) -> - error (Inconsistent_types (ta, tb)) + (ta, s) comparable_struct -> + (tb, s) comparable_struct -> + (((ta, s) comparable_struct, (tb, s) comparable_struct) eq * context) + tzresult = + fun ctxt ta tb -> + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> + match (ta, tb) with + | (Int_key _, Int_key _) -> + Ok + ((Eq : ((ta, s) comparable_struct, (tb, s) comparable_struct) eq), ctxt) + | (Nat_key _, Nat_key _) -> + Ok (Eq, ctxt) + | (String_key _, String_key _) -> + Ok (Eq, ctxt) + | (Bytes_key _, Bytes_key _) -> + Ok (Eq, ctxt) + | (Mutez_key _, Mutez_key _) -> + Ok (Eq, ctxt) + | (Bool_key _, Bool_key _) -> + Ok (Eq, ctxt) + | (Key_hash_key _, Key_hash_key _) -> + Ok (Eq, ctxt) + | (Timestamp_key _, Timestamp_key _) -> + Ok (Eq, ctxt) + | (Address_key _, Address_key _) -> + Ok (Eq, ctxt) + | ( Pair_key ((lefta, _), (righta, _), _), + Pair_key ((leftb, _), (rightb, _), _) ) -> + comparable_ty_eq ctxt lefta leftb + >>? fun (Eq, ctxt) -> + comparable_ty_eq ctxt righta rightb + >>? fun (Eq, ctxt) -> + Ok + ((Eq : ((ta, s) comparable_struct, (tb, s) comparable_struct) eq), ctxt) + | (_, _) -> + serialize_ty_for_error ctxt (ty_of_comparable_ty ta) + >>? fun (ta, ctxt) -> + serialize_ty_for_error ctxt (ty_of_comparable_ty tb) + >>? fun (tb, _ctxt) -> error (Inconsistent_types (ta, tb)) let record_inconsistent ctxt ta tb = record_trace_eval (fun () -> - serialize_ty_for_error ctxt ta >>? fun (ta, ctxt) -> - serialize_ty_for_error ctxt tb >|? fun (tb, _ctxt) -> - Inconsistent_types (ta, tb)) + serialize_ty_for_error ctxt ta + >>? fun (ta, ctxt) -> + serialize_ty_for_error ctxt tb + >|? fun (tb, _ctxt) -> Inconsistent_types (ta, tb)) let record_inconsistent_type_annotations ctxt loc ta tb = record_trace_eval (fun () -> - serialize_ty_for_error ctxt ta >>? fun (ta, ctxt) -> - serialize_ty_for_error ctxt tb >|? fun (tb, _ctxt) -> - Inconsistent_type_annotations (loc, ta, tb)) + serialize_ty_for_error ctxt ta + >>? fun (ta, ctxt) -> + serialize_ty_for_error ctxt tb + >|? fun (tb, _ctxt) -> Inconsistent_type_annotations (loc, ta, tb)) -let rec ty_eq - : type ta tb. context -> ta ty -> tb ty -> ((ta ty, tb ty) eq * context) tzresult - = fun ctxt ta tb -> - let ok (eq : (ta ty, tb ty) eq) ctxt nb_args : +let rec ty_eq : + type ta tb. + context -> ta ty -> tb ty -> ((ta ty, tb ty) eq * context) tzresult = + fun ctxt ta tb -> + let ok (eq : (ta ty, tb ty) eq) ctxt nb_args : ((ta ty, tb ty) eq * context) tzresult = - Gas.consume ctxt (Typecheck_costs.type_ (2 * nb_args)) >>? fun ctxt -> - Ok (eq, ctxt) in - Gas.consume ctxt Typecheck_costs.cycle >>? fun ctxt -> - match ta, tb with - | Unit_t _, Unit_t _ -> ok Eq ctxt 0 - | Int_t _, Int_t _ -> ok Eq ctxt 0 - | Nat_t _, Nat_t _ -> ok Eq ctxt 0 - | Key_t _, Key_t _ -> ok Eq ctxt 0 - | Key_hash_t _, Key_hash_t _ -> ok Eq ctxt 0 - | String_t _, String_t _ -> ok Eq ctxt 0 - | Bytes_t _, Bytes_t _ -> ok Eq ctxt 0 - | Signature_t _, Signature_t _ -> ok Eq ctxt 0 - | Mutez_t _, Mutez_t _ -> ok Eq ctxt 0 - | Timestamp_t _, Timestamp_t _ -> ok Eq ctxt 0 - | Chain_id_t _, Chain_id_t _ -> ok Eq ctxt 0 - | Address_t _, Address_t _ -> ok Eq ctxt 0 - | Bool_t _, Bool_t _ -> ok Eq ctxt 0 - | Operation_t _, Operation_t _ -> ok Eq ctxt 0 - | Map_t (tal, tar, _, _), Map_t (tbl, tbr, _, _) -> - (comparable_ty_eq ctxt tal tbl >>? fun Eq -> - ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> - (ok Eq ctxt 2)) |> - record_inconsistent ctxt ta tb - | Big_map_t (tal, tar, _), Big_map_t (tbl, tbr, _) -> - (comparable_ty_eq ctxt tal tbl >>? fun Eq -> - ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> - (ok Eq ctxt 2)) |> - record_inconsistent ctxt ta tb - | Set_t (ea, _), Set_t (eb, _) -> - (comparable_ty_eq ctxt ea eb >>? fun Eq -> - (ok Eq ctxt 1)) |> - record_inconsistent ctxt ta tb - | Pair_t ((tal, _, _), (tar, _, _), _, _), - Pair_t ((tbl, _, _), (tbr, _, _), _, _) -> - (ty_eq ctxt tal tbl >>? fun (Eq, ctxt) -> - ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> - (ok Eq ctxt 2)) |> - record_inconsistent ctxt ta tb - | Union_t ((tal, _), (tar, _), _, _), - Union_t ((tbl, _), (tbr, _), _, _) -> - (ty_eq ctxt tal tbl >>? fun (Eq, ctxt) -> - ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> - (ok Eq ctxt 2)) |> - record_inconsistent ctxt ta tb - | Lambda_t (tal, tar, _), Lambda_t (tbl, tbr, _) -> - (ty_eq ctxt tal tbl >>? fun (Eq, ctxt) -> - ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> - (ok Eq ctxt 2)) |> - record_inconsistent ctxt ta tb - | Contract_t (tal, _), Contract_t (tbl, _) -> - (ty_eq ctxt tal tbl >>? fun (Eq, ctxt) -> - (ok Eq ctxt 1)) |> - record_inconsistent ctxt ta tb - | Option_t (tva, _, _), Option_t (tvb, _, _) -> - (ty_eq ctxt tva tvb >>? fun (Eq, ctxt) -> - (ok Eq ctxt 1)) |> - record_inconsistent ctxt ta tb - | List_t (tva, _, _), List_t (tvb, _, _) -> - (ty_eq ctxt tva tvb >>? fun (Eq, ctxt) -> - (ok Eq ctxt 1)) |> - record_inconsistent ctxt ta tb - | _, _ -> - serialize_ty_for_error ctxt ta >>? fun (ta, ctxt) -> - serialize_ty_for_error ctxt tb >>? fun (tb, _ctxt) -> - error (Inconsistent_types (ta, tb)) + Gas.consume ctxt (Typecheck_costs.type_ (2 * nb_args)) + >>? fun ctxt -> Ok (eq, ctxt) + in + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> + match (ta, tb) with + | (Unit_t _, Unit_t _) -> + ok Eq ctxt 0 + | (Int_t _, Int_t _) -> + ok Eq ctxt 0 + | (Nat_t _, Nat_t _) -> + ok Eq ctxt 0 + | (Key_t _, Key_t _) -> + ok Eq ctxt 0 + | (Key_hash_t _, Key_hash_t _) -> + ok Eq ctxt 0 + | (String_t _, String_t _) -> + ok Eq ctxt 0 + | (Bytes_t _, Bytes_t _) -> + ok Eq ctxt 0 + | (Signature_t _, Signature_t _) -> + ok Eq ctxt 0 + | (Mutez_t _, Mutez_t _) -> + ok Eq ctxt 0 + | (Timestamp_t _, Timestamp_t _) -> + ok Eq ctxt 0 + | (Chain_id_t _, Chain_id_t _) -> + ok Eq ctxt 0 + | (Address_t _, Address_t _) -> + ok Eq ctxt 0 + | (Bool_t _, Bool_t _) -> + ok Eq ctxt 0 + | (Operation_t _, Operation_t _) -> + ok Eq ctxt 0 + | (Map_t (tal, tar, _, _), Map_t (tbl, tbr, _, _)) -> + comparable_ty_eq ctxt tal tbl + >>? (fun (Eq, ctxt) -> + ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> ok Eq ctxt 2) + |> record_inconsistent ctxt ta tb + | (Big_map_t (tal, tar, _), Big_map_t (tbl, tbr, _)) -> + comparable_ty_eq ctxt tal tbl + >>? (fun (Eq, ctxt) -> + ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> ok Eq ctxt 2) + |> record_inconsistent ctxt ta tb + | (Set_t (ea, _), Set_t (eb, _)) -> + comparable_ty_eq ctxt ea eb + >>? (fun (Eq, ctxt) -> ok Eq ctxt 1) + |> record_inconsistent ctxt ta tb + | ( Pair_t ((tal, _, _), (tar, _, _), _, _), + Pair_t ((tbl, _, _), (tbr, _, _), _, _) ) -> + ty_eq ctxt tal tbl + >>? (fun (Eq, ctxt) -> + ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> ok Eq ctxt 2) + |> record_inconsistent ctxt ta tb + | (Union_t ((tal, _), (tar, _), _, _), Union_t ((tbl, _), (tbr, _), _, _)) -> + ty_eq ctxt tal tbl + >>? (fun (Eq, ctxt) -> + ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> ok Eq ctxt 2) + |> record_inconsistent ctxt ta tb + | (Lambda_t (tal, tar, _), Lambda_t (tbl, tbr, _)) -> + ty_eq ctxt tal tbl + >>? (fun (Eq, ctxt) -> + ty_eq ctxt tar tbr >>? fun (Eq, ctxt) -> ok Eq ctxt 2) + |> record_inconsistent ctxt ta tb + | (Contract_t (tal, _), Contract_t (tbl, _)) -> + ty_eq ctxt tal tbl + >>? (fun (Eq, ctxt) -> ok Eq ctxt 1) + |> record_inconsistent ctxt ta tb + | (Option_t (tva, _, _), Option_t (tvb, _, _)) -> + ty_eq ctxt tva tvb + >>? (fun (Eq, ctxt) -> ok Eq ctxt 1) + |> record_inconsistent ctxt ta tb + | (List_t (tva, _, _), List_t (tvb, _, _)) -> + ty_eq ctxt tva tvb + >>? (fun (Eq, ctxt) -> ok Eq ctxt 1) + |> record_inconsistent ctxt ta tb + | (_, _) -> + serialize_ty_for_error ctxt ta + >>? fun (ta, ctxt) -> + serialize_ty_for_error ctxt tb + >>? fun (tb, _ctxt) -> error (Inconsistent_types (ta, tb)) -let rec stack_ty_eq - : type ta tb. context -> int -> ta stack_ty -> tb stack_ty -> - ((ta stack_ty, tb stack_ty) eq * context) tzresult - = fun ctxt lvl ta tb -> - match ta, tb with - | Item_t (tva, ra, _), Item_t (tvb, rb, _) -> - ty_eq ctxt tva tvb |> - record_trace (Bad_stack_item lvl) >>? fun (Eq, ctxt) -> - stack_ty_eq ctxt (lvl + 1) ra rb >>? fun (Eq, ctxt) -> - (Ok (Eq, ctxt) : ((ta stack_ty, tb stack_ty) eq * context) tzresult) - | Empty_t, Empty_t -> Ok (Eq, ctxt) - | _, _ -> error Bad_stack_length +let rec stack_ty_eq : + type ta tb. + context -> + int -> + ta stack_ty -> + tb stack_ty -> + ((ta stack_ty, tb stack_ty) eq * context) tzresult = + fun ctxt lvl ta tb -> + match (ta, tb) with + | (Item_t (tva, ra, _), Item_t (tvb, rb, _)) -> + ty_eq ctxt tva tvb + |> record_trace (Bad_stack_item lvl) + >>? fun (Eq, ctxt) -> + stack_ty_eq ctxt (lvl + 1) ra rb + >>? fun (Eq, ctxt) -> + (Ok (Eq, ctxt) : ((ta stack_ty, tb stack_ty) eq * context) tzresult) + | (Empty_t, Empty_t) -> + Ok (Eq, ctxt) + | (_, _) -> + error Bad_stack_length -let merge_comparable_types - : type ta. legacy: bool -> ta comparable_ty -> ta comparable_ty -> ta comparable_ty tzresult - = fun ~legacy ta tb -> - match ta, tb with - | Int_key annot_a, Int_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Int_key annot - | Nat_key annot_a, Nat_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Nat_key annot - | String_key annot_a, String_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - String_key annot - | Bytes_key annot_a, Bytes_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Bytes_key annot - | Mutez_key annot_a, Mutez_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Mutez_key annot - | Bool_key annot_a, Bool_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Bool_key annot - | Key_hash_key annot_a, Key_hash_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Key_hash_key annot - | Timestamp_key annot_a, Timestamp_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Timestamp_key annot - | Address_key annot_a, Address_key annot_b -> - merge_type_annot ~legacy annot_a annot_b >|? fun annot -> - Address_key annot - | _, _ -> assert false (* FIXME: fix injectivity of some types *) +let rec merge_comparable_types : + type ta s. + legacy:bool -> + (ta, s) comparable_struct -> + (ta, s) comparable_struct -> + (ta, s) comparable_struct tzresult = + fun ~legacy ta tb -> + match (ta, tb) with + | (Int_key annot_a, Int_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b >|? fun annot -> Int_key annot + | (Nat_key annot_a, Nat_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b >|? fun annot -> Nat_key annot + | (String_key annot_a, String_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b + >|? fun annot -> String_key annot + | (Bytes_key annot_a, Bytes_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b >|? fun annot -> Bytes_key annot + | (Mutez_key annot_a, Mutez_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b >|? fun annot -> Mutez_key annot + | (Bool_key annot_a, Bool_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b >|? fun annot -> Bool_key annot + | (Key_hash_key annot_a, Key_hash_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b + >|? fun annot -> Key_hash_key annot + | (Timestamp_key annot_a, Timestamp_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b + >|? fun annot -> Timestamp_key annot + | (Address_key annot_a, Address_key annot_b) -> + merge_type_annot ~legacy annot_a annot_b + >|? fun annot -> Address_key annot + | ( Pair_key ((left_a, annot_left_a), (right_a, annot_right_a), annot_a), + Pair_key ((left_b, annot_left_b), (right_b, annot_right_b), annot_b) ) -> + merge_type_annot ~legacy annot_a annot_b + >>? fun annot -> + merge_field_annot ~legacy annot_left_a annot_left_b + >>? fun annot_left -> + merge_field_annot ~legacy annot_right_a annot_right_b + >>? fun annot_right -> + merge_comparable_types ~legacy left_a left_b + >>? fun left -> + merge_comparable_types ~legacy right_a right_b + >|? fun right -> + Pair_key ((left, annot_left), (right, annot_right), annot) + | (_, _) -> + assert false + +(* FIXME: fix injectivity of some types *) let merge_types : - type b. legacy: bool -> context -> Script.location -> b ty -> b ty -> (b ty * context) tzresult = fun ~legacy -> - let rec help : type a. context -> a ty -> a ty -> (a ty * context) tzresult - = fun ctxt ty1 ty2 -> - match ty1, ty2 with - | Unit_t tn1, Unit_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Unit_t tname, ctxt - | Int_t tn1, Int_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Int_t tname, ctxt - | Nat_t tn1, Nat_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Nat_t tname, ctxt - | Key_t tn1, Key_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Key_t tname, ctxt - | Key_hash_t tn1, Key_hash_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Key_hash_t tname, ctxt - | String_t tn1, String_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - String_t tname, ctxt - | Bytes_t tn1, Bytes_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Bytes_t tname, ctxt - | Signature_t tn1, Signature_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Signature_t tname, ctxt - | Mutez_t tn1, Mutez_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Mutez_t tname, ctxt - | Timestamp_t tn1, Timestamp_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Timestamp_t tname, ctxt - | Address_t tn1, Address_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Address_t tname, ctxt - | Bool_t tn1, Bool_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Bool_t tname, ctxt - | Chain_id_t tn1, Chain_id_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Chain_id_t tname, ctxt - | Operation_t tn1, Operation_t tn2 -> - merge_type_annot ~legacy tn1 tn2 >|? fun tname -> - Operation_t tname, ctxt - | Map_t (tal, tar, tn1, has_big_map), Map_t (tbl, tbr, tn2, _) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - help ctxt tar tbr >>? fun (value, ctxt) -> - ty_eq ctxt tar value >>? fun (Eq, ctxt) -> - merge_comparable_types ~legacy tal tbl >|? fun tk -> - Map_t (tk, value, tname, has_big_map), ctxt - | Big_map_t (tal, tar, tn1), Big_map_t (tbl, tbr, tn2) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - help ctxt tar tbr >>? fun (value, ctxt) -> - ty_eq ctxt tar value >>? fun (Eq, ctxt) -> - merge_comparable_types ~legacy tal tbl >|? fun tk -> - Big_map_t (tk, value, tname), ctxt - | Set_t (ea, tn1), Set_t (eb, tn2) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - merge_comparable_types ~legacy ea eb >|? fun e -> - Set_t (e, tname), ctxt - | Pair_t ((tal, l_field1, l_var1), (tar, r_field1, r_var1), tn1, has_big_map), - Pair_t ((tbl, l_field2, l_var2), (tbr, r_field2, r_var2), tn2, _) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - merge_field_annot ~legacy l_field1 l_field2 >>? fun l_field -> - merge_field_annot ~legacy r_field1 r_field2 >>? fun r_field -> - let l_var = merge_var_annot l_var1 l_var2 in - let r_var = merge_var_annot r_var1 r_var2 in - help ctxt tal tbl >>? fun (left_ty, ctxt) -> - help ctxt tar tbr >|? fun (right_ty, ctxt) -> - Pair_t ((left_ty, l_field, l_var), (right_ty, r_field, r_var), tname, has_big_map), - ctxt - | Union_t ((tal, tal_annot), (tar, tar_annot), tn1, has_big_map), - Union_t ((tbl, tbl_annot), (tbr, tbr_annot), tn2, _) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - merge_field_annot ~legacy tal_annot tbl_annot >>? fun left_annot -> - merge_field_annot ~legacy tar_annot tbr_annot >>? fun right_annot -> - help ctxt tal tbl >>? fun (left_ty, ctxt) -> - help ctxt tar tbr >|? fun (right_ty, ctxt) -> - Union_t ((left_ty, left_annot), (right_ty, right_annot), tname, has_big_map), - ctxt - | Lambda_t (tal, tar, tn1), Lambda_t (tbl, tbr, tn2) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - help ctxt tal tbl >>? fun (left_ty, ctxt) -> - help ctxt tar tbr >|? fun (right_ty, ctxt) -> - Lambda_t (left_ty, right_ty, tname), ctxt - | Contract_t (tal, tn1), Contract_t (tbl, tn2) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - help ctxt tal tbl >|? fun (arg_ty, ctxt) -> - Contract_t (arg_ty, tname), ctxt - | Option_t (tva, tn1, has_big_map), - Option_t (tvb, tn2, _) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - help ctxt tva tvb >|? fun (ty, ctxt) -> - Option_t (ty, tname, has_big_map), ctxt - | List_t (tva, tn1, has_big_map), List_t (tvb, tn2, _) -> - merge_type_annot ~legacy tn1 tn2 >>? fun tname -> - help ctxt tva tvb >|? fun (ty, ctxt) -> - List_t (ty, tname, has_big_map), ctxt - | _, _ -> assert false - in (fun ctxt loc ty1 ty2 -> - record_inconsistent_type_annotations ctxt loc ty1 ty2 - (help ctxt ty1 ty2)) + type b. + legacy:bool -> + context -> + Script.location -> + b ty -> + b ty -> + (b ty * context) tzresult = + fun ~legacy -> + let rec help : type a. context -> a ty -> a ty -> (a ty * context) tzresult = + fun ctxt ty1 ty2 -> + match (ty1, ty2) with + | (Unit_t tn1, Unit_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (Unit_t tname, ctxt) + | (Int_t tn1, Int_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (Int_t tname, ctxt) + | (Nat_t tn1, Nat_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (Nat_t tname, ctxt) + | (Key_t tn1, Key_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (Key_t tname, ctxt) + | (Key_hash_t tn1, Key_hash_t tn2) -> + merge_type_annot ~legacy tn1 tn2 + >|? fun tname -> (Key_hash_t tname, ctxt) + | (String_t tn1, String_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (String_t tname, ctxt) + | (Bytes_t tn1, Bytes_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (Bytes_t tname, ctxt) + | (Signature_t tn1, Signature_t tn2) -> + merge_type_annot ~legacy tn1 tn2 + >|? fun tname -> (Signature_t tname, ctxt) + | (Mutez_t tn1, Mutez_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (Mutez_t tname, ctxt) + | (Timestamp_t tn1, Timestamp_t tn2) -> + merge_type_annot ~legacy tn1 tn2 + >|? fun tname -> (Timestamp_t tname, ctxt) + | (Address_t tn1, Address_t tn2) -> + merge_type_annot ~legacy tn1 tn2 + >|? fun tname -> (Address_t tname, ctxt) + | (Bool_t tn1, Bool_t tn2) -> + merge_type_annot ~legacy tn1 tn2 >|? fun tname -> (Bool_t tname, ctxt) + | (Chain_id_t tn1, Chain_id_t tn2) -> + merge_type_annot ~legacy tn1 tn2 + >|? fun tname -> (Chain_id_t tname, ctxt) + | (Operation_t tn1, Operation_t tn2) -> + merge_type_annot ~legacy tn1 tn2 + >|? fun tname -> (Operation_t tname, ctxt) + | (Map_t (tal, tar, tn1, has_big_map), Map_t (tbl, tbr, tn2, _)) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + help ctxt tar tbr + >>? fun (value, ctxt) -> + ty_eq ctxt tar value + >>? fun (Eq, ctxt) -> + merge_comparable_types ~legacy tal tbl + >|? fun tk -> (Map_t (tk, value, tname, has_big_map), ctxt) + | (Big_map_t (tal, tar, tn1), Big_map_t (tbl, tbr, tn2)) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + help ctxt tar tbr + >>? fun (value, ctxt) -> + ty_eq ctxt tar value + >>? fun (Eq, ctxt) -> + merge_comparable_types ~legacy tal tbl + >|? fun tk -> (Big_map_t (tk, value, tname), ctxt) + | (Set_t (ea, tn1), Set_t (eb, tn2)) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + merge_comparable_types ~legacy ea eb + >|? fun e -> (Set_t (e, tname), ctxt) + | ( Pair_t + ((tal, l_field1, l_var1), (tar, r_field1, r_var1), tn1, has_big_map), + Pair_t ((tbl, l_field2, l_var2), (tbr, r_field2, r_var2), tn2, _) ) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + merge_field_annot ~legacy l_field1 l_field2 + >>? fun l_field -> + merge_field_annot ~legacy r_field1 r_field2 + >>? fun r_field -> + let l_var = merge_var_annot l_var1 l_var2 in + let r_var = merge_var_annot r_var1 r_var2 in + help ctxt tal tbl + >>? fun (left_ty, ctxt) -> + help ctxt tar tbr + >|? fun (right_ty, ctxt) -> + ( Pair_t + ( (left_ty, l_field, l_var), + (right_ty, r_field, r_var), + tname, + has_big_map ), + ctxt ) + | ( Union_t ((tal, tal_annot), (tar, tar_annot), tn1, has_big_map), + Union_t ((tbl, tbl_annot), (tbr, tbr_annot), tn2, _) ) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + merge_field_annot ~legacy tal_annot tbl_annot + >>? fun left_annot -> + merge_field_annot ~legacy tar_annot tbr_annot + >>? fun right_annot -> + help ctxt tal tbl + >>? fun (left_ty, ctxt) -> + help ctxt tar tbr + >|? fun (right_ty, ctxt) -> + ( Union_t + ((left_ty, left_annot), (right_ty, right_annot), tname, has_big_map), + ctxt ) + | (Lambda_t (tal, tar, tn1), Lambda_t (tbl, tbr, tn2)) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + help ctxt tal tbl + >>? fun (left_ty, ctxt) -> + help ctxt tar tbr + >|? fun (right_ty, ctxt) -> (Lambda_t (left_ty, right_ty, tname), ctxt) + | (Contract_t (tal, tn1), Contract_t (tbl, tn2)) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + help ctxt tal tbl + >|? fun (arg_ty, ctxt) -> (Contract_t (arg_ty, tname), ctxt) + | (Option_t (tva, tn1, has_big_map), Option_t (tvb, tn2, _)) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + help ctxt tva tvb + >|? fun (ty, ctxt) -> (Option_t (ty, tname, has_big_map), ctxt) + | (List_t (tva, tn1, has_big_map), List_t (tvb, tn2, _)) -> + merge_type_annot ~legacy tn1 tn2 + >>? fun tname -> + help ctxt tva tvb + >|? fun (ty, ctxt) -> (List_t (ty, tname, has_big_map), ctxt) + | (_, _) -> + assert false + in + fun ctxt loc ty1 ty2 -> + record_inconsistent_type_annotations ctxt loc ty1 ty2 (help ctxt ty1 ty2) -let merge_stacks - : type ta. legacy: bool -> Script.location -> context -> ta stack_ty -> ta stack_ty -> - (ta stack_ty * context) tzresult - = fun ~legacy loc -> - let rec help : type a. context -> a stack_ty -> a stack_ty -> - (a stack_ty * context) tzresult - = fun ctxt stack1 stack2 -> - match stack1, stack2 with - | Empty_t, Empty_t -> ok (Empty_t, ctxt) - | Item_t (ty1, rest1, annot1), - Item_t (ty2, rest2, annot2) -> - let annot = merge_var_annot annot1 annot2 in - merge_types ~legacy ctxt loc ty1 ty2 >>? fun (ty, ctxt) -> - help ctxt rest1 rest2 >|? fun (rest, ctxt) -> - Item_t (ty, rest, annot), ctxt - in help +let merge_stacks : + type ta. + legacy:bool -> + Script.location -> + context -> + ta stack_ty -> + ta stack_ty -> + (ta stack_ty * context) tzresult = + fun ~legacy loc -> + let rec help : + type a. + context -> a stack_ty -> a stack_ty -> (a stack_ty * context) tzresult = + fun ctxt stack1 stack2 -> + match (stack1, stack2) with + | (Empty_t, Empty_t) -> + ok (Empty_t, ctxt) + | (Item_t (ty1, rest1, annot1), Item_t (ty2, rest2, annot2)) -> + let annot = merge_var_annot annot1 annot2 in + merge_types ~legacy ctxt loc ty1 ty2 + >>? fun (ty, ctxt) -> + help ctxt rest1 rest2 + >|? fun (rest, ctxt) -> (Item_t (ty, rest, annot), ctxt) + in + help -let has_big_map - : type t. t ty -> bool - = function - | Unit_t _ -> false - | Int_t _ -> false - | Nat_t _ -> false - | Signature_t _ -> false - | String_t _ -> false - | Bytes_t _ -> false - | Mutez_t _ -> false - | Key_hash_t _ -> false - | Key_t _ -> false - | Timestamp_t _ -> false - | Address_t _ -> false - | Bool_t _ -> false - | Lambda_t (_, _, _) -> false - | Set_t (_, _) -> false - | Big_map_t (_, _, _) -> true - | Contract_t (_, _) -> false - | Operation_t _ -> false - | Chain_id_t _ -> false - | Pair_t (_, _, _, has_big_map) -> has_big_map - | Union_t (_, _, _, has_big_map) -> has_big_map - | Option_t (_, _, has_big_map) -> has_big_map - | List_t (_, _, has_big_map) -> has_big_map - | Map_t (_, _, _, has_big_map) -> has_big_map +let has_big_map : type t. t ty -> bool = function + | Unit_t _ -> + false + | Int_t _ -> + false + | Nat_t _ -> + false + | Signature_t _ -> + false + | String_t _ -> + false + | Bytes_t _ -> + false + | Mutez_t _ -> + false + | Key_hash_t _ -> + false + | Key_t _ -> + false + | Timestamp_t _ -> + false + | Address_t _ -> + false + | Bool_t _ -> + false + | Lambda_t (_, _, _) -> + false + | Set_t (_, _) -> + false + | Big_map_t (_, _, _) -> + true + | Contract_t (_, _) -> + false + | Operation_t _ -> + false + | Chain_id_t _ -> + false + | Pair_t (_, _, _, has_big_map) -> + has_big_map + | Union_t (_, _, _, has_big_map) -> + has_big_map + | Option_t (_, _, has_big_map) -> + has_big_map + | List_t (_, _, has_big_map) -> + has_big_map + | Map_t (_, _, _, has_big_map) -> + has_big_map (* ---- Type checker results -------------------------------------------------*) type 'bef judgement = | Typed : ('bef, 'aft) descr -> 'bef judgement - | Failed : { descr : 'aft. 'aft stack_ty -> ('bef, 'aft) descr } -> 'bef judgement + | Failed : { + descr : 'aft. 'aft stack_ty -> ('bef, 'aft) descr; + } + -> 'bef judgement (* ---- Type checker (Untyped expressions -> Typed IR) ----------------------*) -type ('t, 'f, 'b) branch = - { branch : 'r. ('t, 'r) descr -> ('f, 'r) descr -> ('b, 'r) descr } [@@unboxed] +type ('t, 'f, 'b) branch = { + branch : 'r. ('t, 'r) descr -> ('f, 'r) descr -> ('b, 'r) descr; +} +[@@unboxed] +let merge_branches : + type bef a b. + legacy:bool -> + context -> + int -> + a judgement -> + b judgement -> + (a, b, bef) branch -> + (bef judgement * context) tzresult Lwt.t = + fun ~legacy ctxt loc btr bfr {branch} -> + match (btr, bfr) with + | (Typed ({aft = aftbt; _} as dbt), Typed ({aft = aftbf; _} as dbf)) -> + let unmatched_branches () = + serialize_stack_for_error ctxt aftbt + >>=? fun (aftbt, ctxt) -> + serialize_stack_for_error ctxt aftbf + >>|? fun (aftbf, _ctxt) -> Unmatched_branches (loc, aftbt, aftbf) + in + trace_eval + unmatched_branches + ( Lwt.return (stack_ty_eq ctxt 1 aftbt aftbf) + >>=? fun (Eq, ctxt) -> + Lwt.return (merge_stacks ~legacy loc ctxt aftbt aftbf) + >>=? fun (merged_stack, ctxt) -> + return + ( Typed + (branch + {dbt with aft = merged_stack} + {dbf with aft = merged_stack}), + ctxt ) ) + | (Failed {descr = descrt}, Failed {descr = descrf}) -> + let descr ret = branch (descrt ret) (descrf ret) in + return (Failed {descr}, ctxt) + | (Typed dbt, Failed {descr = descrf}) -> + return (Typed (branch dbt (descrf dbt.aft)), ctxt) + | (Failed {descr = descrt}, Typed dbf) -> + return (Typed (branch (descrt dbf.aft) dbf), ctxt) -let merge_branches - : type bef a b. legacy: bool -> context -> int -> a judgement -> b judgement -> - (a, b, bef) branch -> - (bef judgement * context) tzresult Lwt.t - = fun ~legacy ctxt loc btr bfr { branch } -> - match btr, bfr with - | Typed ({ aft = aftbt ; _ } as dbt), Typed ({ aft = aftbf ; _ } as dbf) -> - let unmatched_branches () = - serialize_stack_for_error ctxt aftbt >>=? fun (aftbt, ctxt) -> - serialize_stack_for_error ctxt aftbf >>|? fun (aftbf, _ctxt) -> - Unmatched_branches (loc, aftbt, aftbf) in - trace_eval unmatched_branches - (Lwt.return (stack_ty_eq ctxt 1 aftbt aftbf) >>=? fun (Eq, ctxt) -> - Lwt.return (merge_stacks ~legacy loc ctxt aftbt aftbf) >>=? fun (merged_stack, ctxt) -> - return ( - Typed (branch {dbt with aft=merged_stack} {dbf with aft=merged_stack}), - ctxt)) - | Failed { descr = descrt }, Failed { descr = descrf } -> - let descr ret = - branch (descrt ret) (descrf ret) in - return (Failed { descr }, ctxt) - | Typed dbt, Failed { descr = descrf } -> - return (Typed (branch dbt (descrf dbt.aft)), ctxt) - | Failed { descr = descrt }, Typed dbf -> - return (Typed (branch (descrt dbf.aft) dbf), ctxt) - -let rec parse_comparable_ty - : context -> Script.node -> (ex_comparable_ty * context) tzresult - = fun ctxt ty -> - Gas.consume ctxt Typecheck_costs.cycle >>? fun ctxt -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >>? fun ctxt -> - match ty with - | Prim (loc, T_int, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Int_key tname ), ctxt - | Prim (loc, T_nat, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Nat_key tname ), ctxt - | Prim (loc, T_string, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( String_key tname ), ctxt - | Prim (loc, T_bytes, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Bytes_key tname ), ctxt - | Prim (loc, T_mutez, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Mutez_key tname ), ctxt - | Prim (loc, T_bool, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Bool_key tname ), ctxt - | Prim (loc, T_key_hash, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Key_hash_key tname ), ctxt - | Prim (loc, T_timestamp, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Timestamp_key tname ), ctxt - | Prim (loc, T_address, [], annot) -> - parse_type_annot loc annot >|? fun tname -> - Ex_comparable_ty ( Address_key tname ), ctxt - | Prim (loc, (T_int | T_nat - | T_string | T_mutez | T_bool - | T_key | T_address | T_timestamp as prim), l, _) -> - error (Invalid_arity (loc, prim, 0, List.length l)) - | Prim (loc, (T_pair | T_or | T_set | T_map - | T_list | T_option | T_lambda - | T_unit | T_signature | T_contract), _, _) -> - error (Comparable_type_expected (loc, Micheline.strip_locations ty)) - | expr -> - error @@ unexpected expr [] Type_namespace - [ T_int ; T_nat ; - T_string ; T_mutez ; T_bool ; - T_key ; T_key_hash ; T_timestamp ] +let rec parse_comparable_ty : + context -> Script.node -> (ex_comparable_ty * context) tzresult = + fun ctxt ty -> + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >>? fun ctxt -> + match ty with + | Prim (loc, T_int, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Int_key tname), ctxt) + | Prim (loc, T_nat, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Nat_key tname), ctxt) + | Prim (loc, T_string, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (String_key tname), ctxt) + | Prim (loc, T_bytes, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Bytes_key tname), ctxt) + | Prim (loc, T_mutez, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Mutez_key tname), ctxt) + | Prim (loc, T_bool, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Bool_key tname), ctxt) + | Prim (loc, T_key_hash, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Key_hash_key tname), ctxt) + | Prim (loc, T_timestamp, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Timestamp_key tname), ctxt) + | Prim (loc, T_address, [], annot) -> + parse_type_annot loc annot + >|? fun tname -> (Ex_comparable_ty (Address_key tname), ctxt) + | Prim + ( loc, + ( ( T_int + | T_nat + | T_string + | T_mutez + | T_bool + | T_key + | T_address + | T_timestamp ) as prim ), + l, + _ ) -> + error (Invalid_arity (loc, prim, 0, List.length l)) + | Prim (loc, T_pair, [left; right], annot) -> ( + parse_type_annot loc annot + >>? fun pname -> + extract_field_annot left + >>? fun (left, left_annot) -> + extract_field_annot right + >>? fun (right, right_annot) -> + parse_comparable_ty ctxt right + >>? fun (Ex_comparable_ty right, ctxt) -> + parse_comparable_ty ctxt left + >>? fun (Ex_comparable_ty left, ctxt) -> + let right = (right, right_annot) in + match left with + | Pair_key _ -> + error (Comparable_type_expected (loc, Micheline.strip_locations ty)) + | Int_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Int_key tname, left_annot), right, pname)), + ctxt ) + | Nat_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Nat_key tname, left_annot), right, pname)), + ctxt ) + | String_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((String_key tname, left_annot), right, pname)), + ctxt ) + | Bytes_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Bytes_key tname, left_annot), right, pname)), + ctxt ) + | Mutez_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Mutez_key tname, left_annot), right, pname)), + ctxt ) + | Bool_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Bool_key tname, left_annot), right, pname)), + ctxt ) + | Key_hash_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Key_hash_key tname, left_annot), right, pname)), + ctxt ) + | Timestamp_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Timestamp_key tname, left_annot), right, pname)), + ctxt ) + | Address_key tname -> + ok + ( Ex_comparable_ty + (Pair_key ((Address_key tname, left_annot), right, pname)), + ctxt ) ) + | Prim (loc, T_pair, l, _) -> + error (Invalid_arity (loc, T_pair, 2, List.length l)) + | Prim + ( loc, + ( T_or + | T_set + | T_map + | T_list + | T_option + | T_lambda + | T_unit + | T_signature + | T_contract ), + _, + _ ) -> + error (Comparable_type_expected (loc, Micheline.strip_locations ty)) + | expr -> + error + @@ unexpected + expr + [] + Type_namespace + [ T_int; + T_nat; + T_string; + T_mutez; + T_bool; + T_key; + T_key_hash; + T_timestamp ] and parse_packable_ty : - context -> legacy:bool -> - Script.node -> (ex_ty * context) tzresult - = fun ctxt ~legacy -> - parse_ty ctxt ~legacy ~allow_big_map:false ~allow_operation:false ~allow_contract:legacy + context -> legacy:bool -> Script.node -> (ex_ty * context) tzresult = + fun ctxt ~legacy -> + parse_ty + ctxt + ~legacy + ~allow_big_map:false + ~allow_operation:false + ~allow_contract:legacy and parse_parameter_ty : - context -> legacy:bool -> - Script.node -> (ex_ty * context) tzresult - = fun ctxt ~legacy -> - parse_ty ctxt ~legacy ~allow_big_map:true ~allow_operation:false ~allow_contract:true + context -> legacy:bool -> Script.node -> (ex_ty * context) tzresult = + fun ctxt ~legacy -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:true and parse_any_ty : - context -> legacy:bool -> - Script.node -> (ex_ty * context) tzresult - = fun ctxt ~legacy -> - parse_ty ctxt ~legacy ~allow_big_map:true ~allow_operation:true ~allow_contract:true + context -> legacy:bool -> Script.node -> (ex_ty * context) tzresult = + fun ctxt ~legacy -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:true + ~allow_contract:true and parse_ty : - context -> - legacy: bool -> - allow_big_map: bool -> - allow_operation: bool -> - allow_contract: bool -> - Script.node -> (ex_ty * context) tzresult - = fun ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract node -> - Gas.consume ctxt Typecheck_costs.cycle >>? fun ctxt -> - match node with - | Prim (loc, T_unit, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Unit_t ty_name), ctxt - | Prim (loc, T_int, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Int_t ty_name), ctxt - | Prim (loc, T_nat, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Nat_t ty_name), ctxt - | Prim (loc, T_string, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (String_t ty_name), ctxt - | Prim (loc, T_bytes, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Bytes_t ty_name), ctxt - | Prim (loc, T_mutez, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Mutez_t ty_name), ctxt - | Prim (loc, T_bool, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Bool_t ty_name), ctxt - | Prim (loc, T_key, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Key_t ty_name), ctxt - | Prim (loc, T_key_hash, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Key_hash_t ty_name), ctxt - | Prim (loc, T_timestamp, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Timestamp_t ty_name), ctxt - | Prim (loc, T_address, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Address_t ty_name), ctxt - | Prim (loc, T_signature, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Signature_t ty_name), ctxt - | Prim (loc, T_operation, [], annot) -> - if allow_operation then - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Operation_t ty_name), ctxt - else - error (Unexpected_operation loc) - | Prim (loc, T_chain_id, [], annot) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 0) >|? fun ctxt -> - Ex_ty (Chain_id_t ty_name), ctxt - | Prim (loc, T_contract, [ utl ], annot) -> - if allow_contract then - parse_parameter_ty ctxt ~legacy utl >>? fun (Ex_ty tl, ctxt) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 1) >|? fun ctxt -> - Ex_ty (Contract_t (tl, ty_name)), ctxt - else - error (Unexpected_contract loc) - | Prim (loc, T_pair, [ utl; utr ], annot) -> - extract_field_annot utl >>? fun (utl, left_field) -> - extract_field_annot utr >>? fun (utr, right_field) -> - parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utl >>? fun (Ex_ty tl, ctxt) -> - parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utr >>? fun (Ex_ty tr, ctxt) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 2) >|? fun ctxt -> - Ex_ty (Pair_t ((tl, left_field, None), (tr, right_field, None), ty_name, has_big_map tl || has_big_map tr)), ctxt - | Prim (loc, T_or, [ utl; utr ], annot) -> - extract_field_annot utl >>? fun (utl, left_constr) -> - extract_field_annot utr >>? fun (utr, right_constr) -> - parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utl >>? fun (Ex_ty tl, ctxt) -> - parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utr >>? fun (Ex_ty tr, ctxt) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 2) >|? fun ctxt -> - Ex_ty (Union_t ((tl, left_constr), (tr, right_constr), ty_name, has_big_map tl || has_big_map tr)), ctxt - | Prim (loc, T_lambda, [ uta; utr ], annot) -> - parse_any_ty ctxt ~legacy uta >>? fun (Ex_ty ta, ctxt) -> - parse_any_ty ctxt ~legacy utr >>? fun (Ex_ty tr, ctxt) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 2) >|? fun ctxt -> - Ex_ty (Lambda_t (ta, tr, ty_name)), ctxt - | Prim (loc, T_option, [ ut ], annot) -> - begin if legacy then - (* legacy semantics with (broken) field annotations *) - extract_field_annot ut >>? fun (ut, _some_constr) -> - parse_composed_type_annot loc annot >>? fun (ty_name, _none_constr, _) -> - ok (ut, ty_name) - else - parse_type_annot loc annot >>? fun ty_name -> - ok (ut, ty_name) - end >>? fun (ut, ty_name) -> - parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract ut >>? fun (Ex_ty t, ctxt) -> - Gas.consume ctxt (Typecheck_costs.type_ 2) >|? fun ctxt -> - Ex_ty (Option_t (t, ty_name, has_big_map t)), ctxt - | Prim (loc, T_list, [ ut ], annot) -> - parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract ut >>? fun (Ex_ty t, ctxt) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 1) >|? fun ctxt -> - Ex_ty (List_t (t, ty_name, has_big_map t)), ctxt - | Prim (loc, T_set, [ ut ], annot) -> - parse_comparable_ty ctxt ut >>? fun (Ex_comparable_ty t, ctxt) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 1) >|? fun ctxt -> - Ex_ty (Set_t (t, ty_name)), ctxt - | Prim (loc, T_map, [ uta; utr ], annot) -> - parse_comparable_ty ctxt uta >>? fun (Ex_comparable_ty ta, ctxt) -> - parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utr >>? fun (Ex_ty tr, ctxt) -> - parse_type_annot loc annot >>? fun ty_name -> - Gas.consume ctxt (Typecheck_costs.type_ 2) >|? fun ctxt -> - Ex_ty (Map_t (ta, tr, ty_name, has_big_map tr)), ctxt - | Prim (loc, T_big_map, args, annot) - when allow_big_map -> - parse_big_map_ty ctxt ~legacy loc args annot >>? fun (big_map_ty, ctxt) -> - Gas.consume ctxt (Typecheck_costs.type_ 2) >|? fun ctxt -> - big_map_ty, ctxt - | Prim (loc, T_big_map, _, _) -> - error (Unexpected_big_map loc) - | Prim (loc, (T_unit | T_signature - | T_int | T_nat - | T_string | T_bytes | T_mutez | T_bool - | T_key | T_key_hash - | T_timestamp | T_address as prim), l, _) -> - error (Invalid_arity (loc, prim, 0, List.length l)) - | Prim (loc, (T_set | T_list | T_option | T_contract as prim), l, _) -> - error (Invalid_arity (loc, prim, 1, List.length l)) - | Prim (loc, (T_pair | T_or | T_map | T_lambda as prim), l, _) -> - error (Invalid_arity (loc, prim, 2, List.length l)) - | expr -> - error @@ unexpected expr [] Type_namespace - [ T_pair ; T_or ; T_set ; T_map ; - T_list ; T_option ; T_lambda ; - T_unit ; T_signature ; T_contract ; - T_int ; T_nat ; T_operation ; - T_string ; T_bytes ; T_mutez ; T_bool ; - T_key ; T_key_hash ; T_timestamp ; T_chain_id ] + context -> + legacy:bool -> + allow_big_map:bool -> + allow_operation:bool -> + allow_contract:bool -> + Script.node -> + (ex_ty * context) tzresult = + fun ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract node -> + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> + match node with + | Prim (loc, T_unit, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Unit_t ty_name), ctxt) + | Prim (loc, T_int, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Int_t ty_name), ctxt) + | Prim (loc, T_nat, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Nat_t ty_name), ctxt) + | Prim (loc, T_string, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (String_t ty_name), ctxt) + | Prim (loc, T_bytes, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Bytes_t ty_name), ctxt) + | Prim (loc, T_mutez, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Mutez_t ty_name), ctxt) + | Prim (loc, T_bool, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Bool_t ty_name), ctxt) + | Prim (loc, T_key, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Key_t ty_name), ctxt) + | Prim (loc, T_key_hash, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Key_hash_t ty_name), ctxt) + | Prim (loc, T_timestamp, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Timestamp_t ty_name), ctxt) + | Prim (loc, T_address, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Address_t ty_name), ctxt) + | Prim (loc, T_signature, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Signature_t ty_name), ctxt) + | Prim (loc, T_operation, [], annot) -> + if allow_operation then + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Operation_t ty_name), ctxt) + else error (Unexpected_operation loc) + | Prim (loc, T_chain_id, [], annot) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 0) + >|? fun ctxt -> (Ex_ty (Chain_id_t ty_name), ctxt) + | Prim (loc, T_contract, [utl], annot) -> + if allow_contract then + parse_parameter_ty ctxt ~legacy utl + >>? fun (Ex_ty tl, ctxt) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 1) + >|? fun ctxt -> (Ex_ty (Contract_t (tl, ty_name)), ctxt) + else error (Unexpected_contract loc) + | Prim (loc, T_pair, [utl; utr], annot) -> + extract_field_annot utl + >>? fun (utl, left_field) -> + extract_field_annot utr + >>? fun (utr, right_field) -> + parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utl + >>? fun (Ex_ty tl, ctxt) -> + parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utr + >>? fun (Ex_ty tr, ctxt) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 2) + >|? fun ctxt -> + ( Ex_ty + (Pair_t + ( (tl, left_field, None), + (tr, right_field, None), + ty_name, + has_big_map tl || has_big_map tr )), + ctxt ) + | Prim (loc, T_or, [utl; utr], annot) -> + extract_field_annot utl + >>? fun (utl, left_constr) -> + extract_field_annot utr + >>? fun (utr, right_constr) -> + parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utl + >>? fun (Ex_ty tl, ctxt) -> + parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utr + >>? fun (Ex_ty tr, ctxt) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 2) + >|? fun ctxt -> + ( Ex_ty + (Union_t + ( (tl, left_constr), + (tr, right_constr), + ty_name, + has_big_map tl || has_big_map tr )), + ctxt ) + | Prim (loc, T_lambda, [uta; utr], annot) -> + parse_any_ty ctxt ~legacy uta + >>? fun (Ex_ty ta, ctxt) -> + parse_any_ty ctxt ~legacy utr + >>? fun (Ex_ty tr, ctxt) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 2) + >|? fun ctxt -> (Ex_ty (Lambda_t (ta, tr, ty_name)), ctxt) + | Prim (loc, T_option, [ut], annot) -> + ( if legacy then + (* legacy semantics with (broken) field annotations *) + extract_field_annot ut + >>? fun (ut, _some_constr) -> + parse_composed_type_annot loc annot + >>? fun (ty_name, _none_constr, _) -> ok (ut, ty_name) + else parse_type_annot loc annot >>? fun ty_name -> ok (ut, ty_name) ) + >>? fun (ut, ty_name) -> + parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract ut + >>? fun (Ex_ty t, ctxt) -> + Gas.consume ctxt (Typecheck_costs.type_ 2) + >|? fun ctxt -> (Ex_ty (Option_t (t, ty_name, has_big_map t)), ctxt) + | Prim (loc, T_list, [ut], annot) -> + parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract ut + >>? fun (Ex_ty t, ctxt) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 1) + >|? fun ctxt -> (Ex_ty (List_t (t, ty_name, has_big_map t)), ctxt) + | Prim (loc, T_set, [ut], annot) -> + parse_comparable_ty ctxt ut + >>? fun (Ex_comparable_ty t, ctxt) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 1) + >|? fun ctxt -> (Ex_ty (Set_t (t, ty_name)), ctxt) + | Prim (loc, T_map, [uta; utr], annot) -> + parse_comparable_ty ctxt uta + >>? fun (Ex_comparable_ty ta, ctxt) -> + parse_ty ctxt ~legacy ~allow_big_map ~allow_operation ~allow_contract utr + >>? fun (Ex_ty tr, ctxt) -> + parse_type_annot loc annot + >>? fun ty_name -> + Gas.consume ctxt (Typecheck_costs.type_ 2) + >|? fun ctxt -> (Ex_ty (Map_t (ta, tr, ty_name, has_big_map tr)), ctxt) + | Prim (loc, T_big_map, args, annot) when allow_big_map -> + parse_big_map_ty ctxt ~legacy loc args annot + >>? fun (big_map_ty, ctxt) -> + Gas.consume ctxt (Typecheck_costs.type_ 2) + >|? fun ctxt -> (big_map_ty, ctxt) + | Prim (loc, T_big_map, _, _) -> + error (Unexpected_big_map loc) + | Prim + ( loc, + ( ( T_unit + | T_signature + | T_int + | T_nat + | T_string + | T_bytes + | T_mutez + | T_bool + | T_key + | T_key_hash + | T_timestamp + | T_address ) as prim ), + l, + _ ) -> + error (Invalid_arity (loc, prim, 0, List.length l)) + | Prim (loc, ((T_set | T_list | T_option | T_contract) as prim), l, _) -> + error (Invalid_arity (loc, prim, 1, List.length l)) + | Prim (loc, ((T_pair | T_or | T_map | T_lambda) as prim), l, _) -> + error (Invalid_arity (loc, prim, 2, List.length l)) + | expr -> + error + @@ unexpected + expr + [] + Type_namespace + [ T_pair; + T_or; + T_set; + T_map; + T_list; + T_option; + T_lambda; + T_unit; + T_signature; + T_contract; + T_int; + T_nat; + T_operation; + T_string; + T_bytes; + T_mutez; + T_bool; + T_key; + T_key_hash; + T_timestamp; + T_chain_id ] and parse_big_map_ty ctxt ~legacy big_map_loc args map_annot = - Gas.consume ctxt Typecheck_costs.cycle >>? fun ctxt -> - begin match args with - | [ key_ty ; value_ty ] -> - parse_comparable_ty ctxt key_ty >>? fun (Ex_comparable_ty key_ty, ctxt) -> - parse_packable_ty ctxt ~legacy value_ty - >>? fun (Ex_ty value_ty, ctxt) -> - parse_type_annot big_map_loc map_annot >|? fun map_name -> - let big_map_ty = Big_map_t (key_ty, value_ty, map_name) in - Ex_ty big_map_ty, ctxt - | args -> error @@ Invalid_arity (big_map_loc, T_big_map, 2, List.length args) - end + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> + match args with + | [key_ty; value_ty] -> + parse_comparable_ty ctxt key_ty + >>? fun (Ex_comparable_ty key_ty, ctxt) -> + parse_packable_ty ctxt ~legacy value_ty + >>? fun (Ex_ty value_ty, ctxt) -> + parse_type_annot big_map_loc map_annot + >|? fun map_name -> + let big_map_ty = Big_map_t (key_ty, value_ty, map_name) in + (Ex_ty big_map_ty, ctxt) + | args -> + error @@ Invalid_arity (big_map_loc, T_big_map, 2, List.length args) and parse_storage_ty : - context -> legacy:bool -> Script.node -> (ex_ty * context) tzresult - = fun ctxt ~legacy node -> - match node with - | Prim (loc, T_pair, - [ Prim (big_map_loc, T_big_map, args, map_annot) ; remaining_storage ], - storage_annot) when legacy -> - begin match storage_annot with - | [] -> - parse_ty ctxt ~legacy ~allow_big_map:true ~allow_operation:false ~allow_contract:legacy node - | [ single ] when Compare.Int.(String.length single > 0) && Compare.Char.(String.get single 0 = '%') -> - parse_ty ctxt ~legacy ~allow_big_map:true ~allow_operation:false ~allow_contract:legacy node - | _ -> - (* legacy semantics of big maps used the wrong annotation parser *) - Gas.consume ctxt Typecheck_costs.cycle >>? fun ctxt -> - parse_big_map_ty ctxt ~legacy big_map_loc args map_annot >>? fun (Ex_ty big_map_ty, ctxt) -> - parse_ty ctxt ~legacy ~allow_big_map:true ~allow_operation:false ~allow_contract:legacy remaining_storage - >>? fun (Ex_ty remaining_storage, ctxt) -> - parse_composed_type_annot loc storage_annot - >>? fun (ty_name, map_field, storage_field) -> - Gas.consume ctxt (Typecheck_costs.type_ 5) >|? fun ctxt -> - Ex_ty (Pair_t ((big_map_ty, map_field, None), - (remaining_storage, storage_field, None), - ty_name, true)), - ctxt - end + context -> legacy:bool -> Script.node -> (ex_ty * context) tzresult = + fun ctxt ~legacy node -> + match node with + | Prim + ( loc, + T_pair, + [Prim (big_map_loc, T_big_map, args, map_annot); remaining_storage], + storage_annot ) + when legacy -> ( + match storage_annot with + | [] -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:legacy + node + | [single] + when Compare.Int.(String.length single > 0) + && Compare.Char.(single.[0] = '%') -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:legacy + node | _ -> - parse_ty ctxt ~legacy ~allow_big_map:true ~allow_operation:false ~allow_contract:legacy node + (* legacy semantics of big maps used the wrong annotation parser *) + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> + parse_big_map_ty ctxt ~legacy big_map_loc args map_annot + >>? fun (Ex_ty big_map_ty, ctxt) -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:legacy + remaining_storage + >>? fun (Ex_ty remaining_storage, ctxt) -> + parse_composed_type_annot loc storage_annot + >>? fun (ty_name, map_field, storage_field) -> + Gas.consume ctxt (Typecheck_costs.type_ 5) + >|? fun ctxt -> + ( Ex_ty + (Pair_t + ( (big_map_ty, map_field, None), + (remaining_storage, storage_field, None), + ty_name, + true )), + ctxt ) ) + | _ -> + parse_ty + ctxt + ~legacy + ~allow_big_map:true + ~allow_operation:false + ~allow_contract:legacy + node let check_packable ~legacy loc root = let rec check : type t. t ty -> unit tzresult = function - | Big_map_t _ -> error (Unexpected_big_map loc) - | Operation_t _ -> error (Unexpected_operation loc) - | Unit_t _ -> ok () - | Int_t _ -> ok () - | Nat_t _ -> ok () - | Signature_t _ -> ok () - | String_t _ -> ok () - | Bytes_t _ -> ok () - | Mutez_t _ -> ok () - | Key_hash_t _ -> ok () - | Key_t _ -> ok () - | Timestamp_t _ -> ok () - | Address_t _ -> ok () - | Bool_t _ -> ok () - | Chain_id_t _ -> ok () + | Big_map_t _ -> + error (Unexpected_big_map loc) + | Operation_t _ -> + error (Unexpected_operation loc) + | Unit_t _ -> + ok () + | Int_t _ -> + ok () + | Nat_t _ -> + ok () + | Signature_t _ -> + ok () + | String_t _ -> + ok () + | Bytes_t _ -> + ok () + | Mutez_t _ -> + ok () + | Key_hash_t _ -> + ok () + | Key_t _ -> + ok () + | Timestamp_t _ -> + ok () + | Address_t _ -> + ok () + | Bool_t _ -> + ok () + | Chain_id_t _ -> + ok () | Pair_t ((l_ty, _, _), (r_ty, _, _), _, _) -> check l_ty >>? fun () -> check r_ty | Union_t ((l_ty, _), (r_ty, _), _, _) -> check l_ty >>? fun () -> check r_ty - | Option_t (v_ty, _, _) -> check v_ty - | List_t (elt_ty, _, _) -> check elt_ty - | Set_t (_, _) -> ok () - | Map_t (_, elt_ty, _, _) -> check elt_ty - | Lambda_t (_l_ty, _r_ty, _) -> ok () - | Contract_t (_, _) when legacy -> ok () - | Contract_t (_, _) -> error (Unexpected_contract loc) in + | Option_t (v_ty, _, _) -> + check v_ty + | List_t (elt_ty, _, _) -> + check elt_ty + | Set_t (_, _) -> + ok () + | Map_t (_, elt_ty, _, _) -> + check elt_ty + | Lambda_t (_l_ty, _r_ty, _) -> + ok () + | Contract_t (_, _) when legacy -> + ok () + | Contract_t (_, _) -> + error (Unexpected_contract loc) + in check root type ex_script = Ex_script : ('a, 'c) script -> ex_script type _ dig_proof_argument = - Dig_proof_argument - : ((('x * 'rest), 'rest, 'bef, 'aft) stack_prefix_preservation_witness - * ('x ty * var_annot option) - * 'aft stack_ty) - -> 'bef dig_proof_argument + | Dig_proof_argument : + ( ('x * 'rest, 'rest, 'bef, 'aft) stack_prefix_preservation_witness + * ('x ty * var_annot option) + * 'aft stack_ty ) + -> 'bef dig_proof_argument type (_, _) dug_proof_argument = - Dug_proof_argument - : (('rest, ('x * 'rest), 'bef, 'aft) stack_prefix_preservation_witness - * unit - * 'aft stack_ty) - -> ('bef, 'x) dug_proof_argument + | Dug_proof_argument : + ( ('rest, 'x * 'rest, 'bef, 'aft) stack_prefix_preservation_witness + * unit + * 'aft stack_ty ) + -> ('bef, 'x) dug_proof_argument -type (_) dipn_proof_argument = - Dipn_proof_argument - : (('fbef, 'faft, 'bef, 'aft) stack_prefix_preservation_witness - * (context * ('fbef, 'faft) descr) - * 'aft stack_ty) - -> 'bef dipn_proof_argument +type _ dipn_proof_argument = + | Dipn_proof_argument : + ( ('fbef, 'faft, 'bef, 'aft) stack_prefix_preservation_witness + * (context * ('fbef, 'faft) descr) + * 'aft stack_ty ) + -> 'bef dipn_proof_argument -type (_) dropn_proof_argument = - Dropn_proof_argument - : (('rest, 'rest, 'bef, 'aft) stack_prefix_preservation_witness - * 'rest stack_ty - * 'aft stack_ty) - -> 'bef dropn_proof_argument +type _ dropn_proof_argument = + | Dropn_proof_argument : + ( ('rest, 'rest, 'bef, 'aft) stack_prefix_preservation_witness + * 'rest stack_ty + * 'aft stack_ty ) + -> 'bef dropn_proof_argument (* Lwt versions *) let parse_var_annot loc ?default annot = Lwt.return (parse_var_annot loc ?default annot) + let parse_entrypoint_annot loc ?default annot = Lwt.return (parse_entrypoint_annot loc ?default annot) + let parse_constr_annot loc ?if_special_first ?if_special_second annot = - Lwt.return (parse_constr_annot loc ?if_special_first ?if_special_second annot) -let parse_two_var_annot loc annot = - Lwt.return (parse_two_var_annot loc annot) -let parse_destr_annot loc annot ~default_accessor ~field_name ~pair_annot ~value_annot = - Lwt.return (parse_destr_annot loc annot ~default_accessor ~field_name ~pair_annot ~value_annot) + Lwt.return + (parse_constr_annot loc ?if_special_first ?if_special_second annot) + +let parse_two_var_annot loc annot = Lwt.return (parse_two_var_annot loc annot) + +let parse_destr_annot loc annot ~default_accessor ~field_name ~pair_annot + ~value_annot = + Lwt.return + (parse_destr_annot + loc + annot + ~default_accessor + ~field_name + ~pair_annot + ~value_annot) + let parse_var_type_annot loc annot = Lwt.return (parse_var_type_annot loc annot) - let find_entrypoint (type full) (full : full ty) ~root_name entrypoint = - let rec find_entrypoint - : type t. t ty -> string -> ((Script.node -> Script.node) * ex_ty) - = fun t entrypoint -> match t with - | Union_t ((tl, al), (tr, ar), _, _) -> - if match al with None -> false | Some (`Field_annot l) -> Compare.String.(l = entrypoint) then - ((fun e -> Prim (0, D_Left, [ e ], [])), Ex_ty tl) - else if match ar with None -> false | Some (`Field_annot r) -> Compare.String.(r = entrypoint) then - ((fun e -> Prim (0, D_Right, [ e ], [])), Ex_ty tr) - else begin try - let (f, t) = find_entrypoint tl entrypoint in - ((fun e -> Prim (0, D_Left, [ f e ], [])), t) - with Not_found -> - let (f, t) = find_entrypoint tr entrypoint in - ((fun e -> Prim (0, D_Right, [ f e ], [])), t) - end - | _ -> raise Not_found in - let entrypoint = if Compare.String.(entrypoint = "") then "default" else entrypoint in + let rec find_entrypoint : + type t. t ty -> string -> (Script.node -> Script.node) * ex_ty = + fun t entrypoint -> + match t with + | Union_t ((tl, al), (tr, ar), _, _) -> ( + if + match al with + | None -> + false + | Some (`Field_annot l) -> + Compare.String.(l = entrypoint) + then ((fun e -> Prim (0, D_Left, [e], [])), Ex_ty tl) + else if + match ar with + | None -> + false + | Some (`Field_annot r) -> + Compare.String.(r = entrypoint) + then ((fun e -> Prim (0, D_Right, [e], [])), Ex_ty tr) + else + try + let (f, t) = find_entrypoint tl entrypoint in + ((fun e -> Prim (0, D_Left, [f e], [])), t) + with Not_found -> + let (f, t) = find_entrypoint tr entrypoint in + ((fun e -> Prim (0, D_Right, [f e], [])), t) ) + | _ -> + raise Not_found + in + let entrypoint = + if Compare.String.(entrypoint = "") then "default" else entrypoint + in if Compare.Int.(String.length entrypoint > 31) then error (Entrypoint_name_too_long entrypoint) - else match root_name with + else + match root_name with | Some root_name when Compare.String.(entrypoint = root_name) -> ok ((fun e -> e), Ex_ty full) - | _ -> - try ok (find_entrypoint full entrypoint) with Not_found -> + | _ -> ( + try ok (find_entrypoint full entrypoint) + with Not_found -> ( match entrypoint with - | "default" -> ok ((fun e -> e), Ex_ty full) - | _ -> error (No_such_entrypoint entrypoint) + | "default" -> + ok ((fun e -> e), Ex_ty full) + | _ -> + error (No_such_entrypoint entrypoint) ) ) -let find_entrypoint_for_type - (type full) (type exp) ~(full : full ty) ~(expected : exp ty) ~root_name entrypoint ctxt - : (context * string * exp ty) tzresult = - match entrypoint, root_name with - | "default", Some "root" -> - begin match find_entrypoint full ~root_name entrypoint with - | Error _ as err -> err - | Ok (_, Ex_ty ty) -> - match ty_eq ctxt expected ty with - | Ok (Eq, ctxt) -> - ok (ctxt, "default", (ty : exp ty)) - | Error _ -> - ty_eq ctxt expected full >>? fun (Eq, ctxt) -> - ok (ctxt, "root", (full : exp ty)) - end +let find_entrypoint_for_type (type full exp) ~(full : full ty) + ~(expected : exp ty) ~root_name entrypoint ctxt : + (context * string * exp ty) tzresult = + match (entrypoint, root_name) with + | ("default", Some "root") -> ( + match find_entrypoint full ~root_name entrypoint with + | Error _ as err -> + err + | Ok (_, Ex_ty ty) -> ( + match ty_eq ctxt expected ty with + | Ok (Eq, ctxt) -> + ok (ctxt, "default", (ty : exp ty)) + | Error _ -> + ty_eq ctxt expected full + >>? fun (Eq, ctxt) -> ok (ctxt, "root", (full : exp ty)) ) ) | _ -> - find_entrypoint full ~root_name entrypoint >>? fun (_, Ex_ty ty) -> - ty_eq ctxt expected ty >>? fun (Eq, ctxt) -> - ok (ctxt, entrypoint, (ty : exp ty)) - + find_entrypoint full ~root_name entrypoint + >>? fun (_, Ex_ty ty) -> + ty_eq ctxt expected ty + >>? fun (Eq, ctxt) -> ok (ctxt, entrypoint, (ty : exp ty)) module Entrypoints = Set.Make (String) exception Duplicate of string + exception Too_long of string let well_formed_entrypoints (type full) (full : full ty) ~root_name = - let merge path annot (type t) (ty : t ty) reachable ((first_unreachable, all) as acc) = + let merge path annot (type t) (ty : t ty) reachable + ((first_unreachable, all) as acc) = match annot with - | None | Some (`Field_annot "") -> + | None | Some (`Field_annot "") -> ( if reachable then acc - else begin match ty with - | Union_t _ -> acc - | _ -> match first_unreachable with - | None -> (Some (List.rev path), all) - | Some _ -> acc - end + else + match ty with + | Union_t _ -> + acc + | _ -> ( + match first_unreachable with + | None -> + (Some (List.rev path), all) + | Some _ -> + acc ) ) | Some (`Field_annot name) -> if Compare.Int.(String.length name > 31) then raise (Too_long name) else if Entrypoints.mem name all then raise (Duplicate name) - else (first_unreachable, Entrypoints.add name all) in - let rec check - : type t. t ty -> prim list -> bool -> (prim list) option * Entrypoints.t -> (prim list) option * Entrypoints.t - = fun t path reachable acc -> - match t with - | Union_t ((tl, al), (tr, ar), _, _) -> - let acc = merge (D_Left :: path) al tl reachable acc in - let acc = merge (D_Right :: path) ar tr reachable acc in - let acc = check tl (D_Left :: path) (match al with Some _ -> true | None -> reachable) acc in - check tr (D_Right :: path) (match ar with Some _ -> true | None -> reachable) acc - | _ -> acc in + else (first_unreachable, Entrypoints.add name all) + in + let rec check : + type t. + t ty -> + prim list -> + bool -> + prim list option * Entrypoints.t -> + prim list option * Entrypoints.t = + fun t path reachable acc -> + match t with + | Union_t ((tl, al), (tr, ar), _, _) -> + let acc = merge (D_Left :: path) al tl reachable acc in + let acc = merge (D_Right :: path) ar tr reachable acc in + let acc = + check + tl + (D_Left :: path) + (match al with Some _ -> true | None -> reachable) + acc + in + check + tr + (D_Right :: path) + (match ar with Some _ -> true | None -> reachable) + acc + | _ -> + acc + in try - let init, reachable = match root_name with - | None | Some "" -> Entrypoints.empty, false - | Some name -> Entrypoints.singleton name, true in - let first_unreachable, all = check full [] reachable (None, init) in + let (init, reachable) = + match root_name with + | None | Some "" -> + (Entrypoints.empty, false) + | Some name -> + (Entrypoints.singleton name, true) + in + let (first_unreachable, all) = check full [] reachable (None, init) in if not (Entrypoints.mem "default" all) then ok () - else match first_unreachable with - | None -> ok () - | Some path -> error (Unreachable_entrypoint path) + else + match first_unreachable with + | None -> + ok () + | Some path -> + error (Unreachable_entrypoint path) with - | Duplicate name -> error (Duplicate_entrypoint name) - | Too_long name -> error (Entrypoint_name_too_long name) + | Duplicate name -> + error (Duplicate_entrypoint name) + | Too_long name -> + error (Entrypoint_name_too_long name) -let rec parse_data - : type a. - ?type_logger: type_logger -> - context -> legacy: bool -> a ty -> Script.node -> (a * context) tzresult Lwt.t - = fun ?type_logger ctxt ~legacy ty script_data -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - let error () = - Lwt.return (serialize_ty_for_error ctxt ty) >>|? fun (ty, _ctxt) -> - Invalid_constant (location script_data, strip_locations script_data, ty) in - let traced body = - trace_eval error body in - let parse_items ?type_logger loc ctxt expr key_type value_type items item_wrapper = - let length = List.length items in - fold_left_s - (fun (last_value, map, ctxt) item -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.map_element length)) >>=? fun ctxt -> - match item with - | Prim (_, D_Elt, [ k; v ], _) -> - parse_comparable_data ?type_logger ctxt key_type k >>=? fun (k, ctxt) -> - parse_data ?type_logger ctxt ~legacy value_type v >>=? fun (v, ctxt) -> - begin match last_value with - | Some value -> - if Compare.Int.(0 <= (compare_comparable key_type value k)) - then - if Compare.Int.(0 = (compare_comparable key_type value k)) - then fail (Duplicate_map_keys (loc, strip_locations expr)) - else fail (Unordered_map_keys (loc, strip_locations expr)) - else return_unit - | None -> return_unit - end >>=? fun () -> - return (Some k, map_update k (Some (item_wrapper v)) map, ctxt) - | Prim (loc, D_Elt, l, _) -> - fail @@ Invalid_arity (loc, D_Elt, 2, List.length l) - | Prim (loc, name, _, _) -> - fail @@ Invalid_primitive (loc, [ D_Elt ], name) - | Int _ | String _ | Bytes _ | Seq _ -> - error () >>=? fail) - (None, empty_map key_type, ctxt) items |> traced >>|? fun (_, items, ctxt) -> - (items, ctxt) in - match ty, script_data with - (* Unit *) - | Unit_t _, Prim (loc, D_Unit, [], annot) -> - (if legacy then return () else - fail_unexpected_annot loc annot) >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.unit) >>|? fun ctxt -> - ((() : a), ctxt) - | Unit_t _, Prim (loc, D_Unit, l, _) -> - traced (fail (Invalid_arity (loc, D_Unit, 0, List.length l))) - | Unit_t _, expr -> - traced (fail (unexpected expr [] Constant_namespace [ D_Unit ])) - (* Booleans *) - | Bool_t _, Prim (loc, D_True, [], annot) -> - (if legacy then return () else - fail_unexpected_annot loc annot) >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.bool) >>|? fun ctxt -> - (true, ctxt) - | Bool_t _, Prim (loc, D_False, [], annot) -> - (if legacy then return () else - fail_unexpected_annot loc annot) >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.bool) >>|? fun ctxt -> - (false, ctxt) - | Bool_t _, Prim (loc, (D_True | D_False as c), l, _) -> - traced (fail (Invalid_arity (loc, c, 0, List.length l))) - | Bool_t _, expr -> - traced (fail (unexpected expr [] Constant_namespace [ D_True ; D_False ])) - (* Strings *) - | String_t _, String (_, v) -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.string (String.length v))) >>=? fun ctxt -> - let rec check_printable_ascii i = - if Compare.Int.(i < 0) then true - else match String.get v i with - | '\n' | '\x20'..'\x7E' -> check_printable_ascii (i - 1) - | _ -> false in - if check_printable_ascii (String.length v - 1) then - return (v, ctxt) - else - error () >>=? fail - | String_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ], kind expr))) - (* Byte sequences *) - | Bytes_t _, Bytes (_, v) -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.string (MBytes.length v))) >>=? fun ctxt -> - return (v, ctxt) - | Bytes_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Bytes_kind ], kind expr))) - (* Integers *) - | Int_t _, Int (_, v) -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.z v)) >>=? fun ctxt -> - return (Script_int.of_zint v, ctxt) - | Nat_t _, Int (_, v) -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.z v)) >>=? fun ctxt -> - let v = Script_int.of_zint v in - if Compare.Int.(Script_int.compare v Script_int.zero >= 0) then - return (Script_int.abs v, ctxt) - else - error () >>=? fail - | Int_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Int_kind ], kind expr))) - | Nat_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Int_kind ], kind expr))) - (* Tez amounts *) - | Mutez_t _, Int (_, v) -> - Lwt.return ( - Gas.consume ctxt Typecheck_costs.tez >>? fun ctxt -> - Gas.consume ctxt Michelson_v1_gas.Cost_of.Legacy.z_to_int64 - ) >>=? fun ctxt -> - begin try - match Tez.of_mutez (Z.to_int64 v) with - | None -> raise Exit - | Some tez -> return (tez, ctxt) - with _ -> - error () >>=? fail - end - | Mutez_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Int_kind ], kind expr))) - (* Timestamps *) - | Timestamp_t _, (Int (_, v)) (* As unparsed with [Optimized] or out of bounds [Readable]. *) -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.z v)) >>=? fun ctxt -> - return (Script_timestamp.of_zint v, ctxt) - | Timestamp_t _, String (_, s) (* As unparsed with [Redable]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.string_timestamp) >>=? fun ctxt -> - begin match Script_timestamp.of_string s with - | Some v -> return (v, ctxt) - | None -> error () >>=? fail - end - | Timestamp_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ; Int_kind ], kind expr))) - (* IDs *) - | Key_t _, Bytes (_, bytes) -> (* As unparsed with [Optimized]. *) - Lwt.return (Gas.consume ctxt Typecheck_costs.key) >>=? fun ctxt -> - begin match Data_encoding.Binary.of_bytes Signature.Public_key.encoding bytes with - | Some k -> return (k, ctxt) - | None -> error () >>=? fail - end - | Key_t _, String (_, s) -> (* As unparsed with [Readable]. *) - Lwt.return (Gas.consume ctxt Typecheck_costs.key) >>=? fun ctxt -> - begin match Signature.Public_key.of_b58check_opt s with - | Some k -> return (k, ctxt) - | None -> error () >>=? fail - end - | Key_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) - | Key_hash_t _, Bytes (_, bytes) -> (* As unparsed with [Optimized]. *) - Lwt.return (Gas.consume ctxt Typecheck_costs.key_hash) >>=? fun ctxt -> - begin - match Data_encoding.Binary.of_bytes Signature.Public_key_hash.encoding bytes with - | Some k -> return (k, ctxt) - | None -> error () >>=? fail - end - | Key_hash_t _, String (_, s) (* As unparsed with [Readable]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.key_hash) >>=? fun ctxt -> - begin match Signature.Public_key_hash.of_b58check_opt s with - | Some k -> return (k, ctxt) - | None -> error () >>=? fail - end - | Key_hash_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) - (* Signatures *) - | Signature_t _, Bytes (_, bytes) (* As unparsed with [Optimized]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.signature) >>=? fun ctxt -> - begin match Data_encoding.Binary.of_bytes Signature.encoding bytes with - | Some k -> return (k, ctxt) - | None -> error () >>=? fail - end - | Signature_t _, String (_, s) (* As unparsed with [Readable]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.signature) >>=? fun ctxt -> - begin match Signature.of_b58check_opt s with - | Some s -> return (s, ctxt) - | None -> error () >>=? fail - end - | Signature_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) - (* Operations *) - | Operation_t _, _ -> - (* operations cannot appear in parameters or storage, - the protocol should never parse the bytes of an operation *) - assert false - (* Chain_ids *) - | Chain_id_t _, Bytes (_, bytes) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.chain_id) >>=? fun ctxt -> - begin match Data_encoding.Binary.of_bytes Chain_id.encoding bytes with - | Some k -> return (k, ctxt) - | None -> error () >>=? fail - end - | Chain_id_t _, String (_, s) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.chain_id) >>=? fun ctxt -> - begin match Chain_id.of_b58check_opt s with - | Some s -> return (s, ctxt) - | None -> error () >>=? fail - end - | Chain_id_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) - (* Addresses *) - | Address_t _, Bytes (loc, bytes) (* As unparsed with [O[ptimized]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.contract) >>=? fun ctxt -> - begin - match Data_encoding.Binary.of_bytes - Data_encoding.(tup2 Contract.encoding Variable.string) - bytes with - | Some (c, entrypoint) -> - if Compare.Int.(String.length entrypoint > 31) then - fail (Entrypoint_name_too_long entrypoint) - else - begin match entrypoint with - | "" -> return "default" - | "default" -> fail (Unexpected_annotation loc) - | name -> return name end >>=? fun entrypoint -> - return ((c, entrypoint), ctxt) - | None -> error () >>=? fail - end - | Address_t _, String (loc, s) (* As unparsed with [Readable]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.contract) >>=? fun ctxt -> - begin match String.index_opt s '%' with - | None -> return (s, "default") - | Some pos -> - let len = String.length s - pos - 1 in - let name = String.sub s (pos + 1) len in - if Compare.Int.(len > 31) then - fail (Entrypoint_name_too_long name) - else - match String.sub s 0 pos, name with - | _, "default" -> traced (fail (Unexpected_annotation loc)) - | addr_and_name -> return addr_and_name - end >>=? fun (addr, entrypoint) -> - Lwt.return (Contract.of_b58check addr) >>=? fun c -> - return ((c, entrypoint), ctxt) - | Address_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) - (* Contracts *) - | Contract_t (ty, _), Bytes (loc, bytes) (* As unparsed with [Optimized]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.contract) >>=? fun ctxt -> - begin - match Data_encoding.Binary.of_bytes - Data_encoding.(tup2 Contract.encoding Variable.string) - bytes with - | Some (c, entrypoint) -> - if Compare.Int.(String.length entrypoint > 31) then - fail (Entrypoint_name_too_long entrypoint) - else - begin match entrypoint with - | "" -> return "default" - | "default" -> traced (fail (Unexpected_annotation loc)) - | name -> return name end >>=? fun entrypoint -> - traced (parse_contract ~legacy ctxt loc ty c ~entrypoint) >>=? fun (ctxt, _) -> - return ((ty, (c, entrypoint)), ctxt) - | None -> error () >>=? fail - end - | Contract_t (ty, _), String (loc, s) (* As unparsed with [Readable]. *) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.contract) >>=? fun ctxt -> - begin match String.index_opt s '%' with - | None -> return (s, "default") - | Some pos -> - let len = String.length s - pos - 1 in - let name = String.sub s (pos + 1) len in - if Compare.Int.(len > 31) then - fail (Entrypoint_name_too_long name) - else - match String.sub s 0 pos, name with - | _, "default" -> traced (fail (Unexpected_annotation loc)) - | addr_and_name -> return addr_and_name - end >>=? fun (addr, entrypoint) -> - traced (Lwt.return (Contract.of_b58check addr)) >>=? fun c -> - parse_contract ~legacy ctxt loc ty c ~entrypoint >>=? fun (ctxt, _) -> - return ((ty, (c, entrypoint)), ctxt) - | Contract_t _, expr -> - traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) - (* Pairs *) - | Pair_t ((ta, _, _), (tb, _, _), _, _), Prim (loc, D_Pair, [ va; vb ], annot) -> - (if legacy then return () else - fail_unexpected_annot loc annot) >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.pair) >>=? fun ctxt -> - traced @@ - parse_data ?type_logger ctxt ~legacy ta va >>=? fun (va, ctxt) -> - parse_data ?type_logger ctxt ~legacy tb vb >>=? fun (vb, ctxt) -> - return ((va, vb), ctxt) - | Pair_t _, Prim (loc, D_Pair, l, _) -> - fail @@ Invalid_arity (loc, D_Pair, 2, List.length l) - | Pair_t _, expr -> - traced (fail (unexpected expr [] Constant_namespace [ D_Pair ])) - (* Unions *) - | Union_t ((tl, _), _, _, _), Prim (loc, D_Left, [ v ], annot) -> - (if legacy then return () else - fail_unexpected_annot loc annot) >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.union) >>=? fun ctxt -> - traced @@ - parse_data ?type_logger ctxt ~legacy tl v >>=? fun (v, ctxt) -> - return (L v, ctxt) - | Union_t _, Prim (loc, D_Left, l, _) -> - fail @@ Invalid_arity (loc, D_Left, 1, List.length l) - | Union_t (_, (tr, _), _, _), Prim (loc, D_Right, [ v ], annot) -> - fail_unexpected_annot loc annot >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.union) >>=? fun ctxt -> - traced @@ - parse_data ?type_logger ctxt ~legacy tr v >>=? fun (v, ctxt) -> - return (R v, ctxt) - | Union_t _, Prim (loc, D_Right, l, _) -> - fail @@ Invalid_arity (loc, D_Right, 1, List.length l) - | Union_t _, expr -> - traced (fail (unexpected expr [] Constant_namespace [ D_Left ; D_Right ])) - (* Lambdas *) - | Lambda_t (ta, tr, _ty_name), (Seq (_loc, _) as script_instr) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.lambda) >>=? fun ctxt -> - traced @@ - parse_returning Lambda ?type_logger ctxt ~legacy (ta, Some (`Var_annot "@arg")) tr script_instr - | Lambda_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Seq_kind ], kind expr))) - (* Options *) - | Option_t (t, _, _), Prim (loc, D_Some, [ v ], annot) -> - (if legacy then return () else - fail_unexpected_annot loc annot) >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.some) >>=? fun ctxt -> - traced @@ - parse_data ?type_logger ctxt ~legacy t v >>=? fun (v, ctxt) -> - return (Some v, ctxt) - | Option_t _, Prim (loc, D_Some, l, _) -> - fail @@ Invalid_arity (loc, D_Some, 1, List.length l) - | Option_t (_, _, _), Prim (loc, D_None, [], annot) -> - (if legacy then return () else - fail_unexpected_annot loc annot) >>=? fun () -> - Lwt.return (Gas.consume ctxt Typecheck_costs.none) >>=? fun ctxt -> - return (None, ctxt) - | Option_t _, Prim (loc, D_None, l, _) -> - fail @@ Invalid_arity (loc, D_None, 0, List.length l) - | Option_t _, expr -> - traced (fail (unexpected expr [] Constant_namespace [ D_Some ; D_None ])) - (* Lists *) - | List_t (t, _ty_name, _), Seq (_loc, items) -> - traced @@ - fold_right_s - (fun v (rest, ctxt) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.list_element) >>=? fun ctxt -> - parse_data ?type_logger ctxt ~legacy t v >>=? fun (v, ctxt) -> - return ((v :: rest), ctxt)) - items ([], ctxt) - | List_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Seq_kind ], kind expr))) - (* Sets *) - | Set_t (t, _ty_name), (Seq (loc, vs) as expr) -> - let length = List.length vs in - traced @@ - fold_left_s - (fun (last_value, set, ctxt) v -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.set_element length)) >>=? fun ctxt -> - parse_comparable_data ?type_logger ctxt t v >>=? fun (v, ctxt) -> - begin match last_value with - | Some value -> - if Compare.Int.(0 <= (compare_comparable t value v)) - then - if Compare.Int.(0 = (compare_comparable t value v)) - then fail (Duplicate_set_values (loc, strip_locations expr)) - else fail (Unordered_set_values (loc, strip_locations expr)) - else return_unit - | None -> return_unit - end >>=? fun () -> - Lwt.return (Gas.consume ctxt (Michelson_v1_gas.Cost_of.Legacy.set_update v false set)) >>=? fun ctxt -> - return (Some v, set_update v true set, ctxt)) - (None, empty_set t, ctxt) vs >>|? fun (_, set, ctxt) -> - (set, ctxt) - | Set_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Seq_kind ], kind expr))) - (* Maps *) - | Map_t (tk, tv, _ty_name, _), (Seq (loc, vs) as expr) -> - parse_items ?type_logger loc ctxt expr tk tv vs (fun x -> x) - | Map_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Seq_kind ], kind expr))) - | Big_map_t (tk, tv, _ty_name), (Seq (loc, vs) as expr) -> - parse_items ?type_logger loc ctxt expr tk tv vs (fun x -> Some x) >>|? fun (diff, ctxt) -> - ({ id = None ; diff ; key_type = ty_of_comparable_ty tk ; value_type = tv }, ctxt) - | Big_map_t (tk, tv, _ty_name), Int (loc, id) -> - Big_map.exists ctxt id >>=? begin function - | _, None -> - traced (fail (Invalid_big_map (loc, id))) - | ctxt, Some (btk, btv) -> - Lwt.return begin - parse_comparable_ty ctxt (Micheline.root btk) >>? fun (Ex_comparable_ty btk, ctxt) -> - parse_packable_ty ctxt ~legacy (Micheline.root btv) >>? fun (Ex_ty btv, ctxt) -> - comparable_ty_eq ctxt tk btk >>? fun Eq -> - ty_eq ctxt tv btv >>? fun (Eq, ctxt) -> - ok ({ id = Some id ; diff = empty_map tk ; key_type = ty_of_comparable_ty tk ; value_type = tv }, ctxt) - end - end - | Big_map_t (_tk, _tv, _), expr -> - traced (fail (Invalid_kind (location expr, [ Seq_kind ; Int_kind ], kind expr))) - -and parse_comparable_data - : type a. +let rec parse_data : + type a. ?type_logger:type_logger -> - context -> a comparable_ty -> Script.node -> (a * context) tzresult Lwt.t - = fun ?type_logger ctxt ty script_data -> - parse_data ?type_logger ctxt ~legacy: false (ty_of_comparable_ty ty) script_data + context -> + legacy:bool -> + a ty -> + Script.node -> + (a * context) tzresult Lwt.t = + fun ?type_logger ctxt ~legacy ty script_data -> + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + let error () = + Lwt.return (serialize_ty_for_error ctxt ty) + >>|? fun (ty, _ctxt) -> + Invalid_constant (location script_data, strip_locations script_data, ty) + in + let traced body = trace_eval error body in + let parse_items ?type_logger loc ctxt expr key_type value_type items + item_wrapper = + let length = List.length items in + fold_left_s + (fun (last_value, map, ctxt) item -> + Lwt.return (Gas.consume ctxt (Typecheck_costs.map_element length)) + >>=? fun ctxt -> + match item with + | Prim (_, D_Elt, [k; v], _) -> + parse_comparable_data ?type_logger ctxt key_type k + >>=? fun (k, ctxt) -> + parse_data ?type_logger ctxt ~legacy value_type v + >>=? fun (v, ctxt) -> + ( match last_value with + | Some value -> + if Compare.Int.(0 <= compare_comparable key_type value k) then + if Compare.Int.(0 = compare_comparable key_type value k) then + fail (Duplicate_map_keys (loc, strip_locations expr)) + else fail (Unordered_map_keys (loc, strip_locations expr)) + else return_unit + | None -> + return_unit ) + >>=? fun () -> + return (Some k, map_update k (Some (item_wrapper v)) map, ctxt) + | Prim (loc, D_Elt, l, _) -> + fail @@ Invalid_arity (loc, D_Elt, 2, List.length l) + | Prim (loc, name, _, _) -> + fail @@ Invalid_primitive (loc, [D_Elt], name) + | Int _ | String _ | Bytes _ | Seq _ -> + error () >>=? fail) + (None, empty_map key_type, ctxt) + items + |> traced + >>|? fun (_, items, ctxt) -> (items, ctxt) + in + match (ty, script_data) with + (* Unit *) + | (Unit_t _, Prim (loc, D_Unit, [], annot)) -> + (if legacy then return () else fail_unexpected_annot loc annot) + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.unit) + >>|? fun ctxt -> ((() : a), ctxt) + | (Unit_t _, Prim (loc, D_Unit, l, _)) -> + traced (fail (Invalid_arity (loc, D_Unit, 0, List.length l))) + | (Unit_t _, expr) -> + traced (fail (unexpected expr [] Constant_namespace [D_Unit])) + (* Booleans *) + | (Bool_t _, Prim (loc, D_True, [], annot)) -> + (if legacy then return () else fail_unexpected_annot loc annot) + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.bool) + >>|? fun ctxt -> (true, ctxt) + | (Bool_t _, Prim (loc, D_False, [], annot)) -> + (if legacy then return () else fail_unexpected_annot loc annot) + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.bool) + >>|? fun ctxt -> (false, ctxt) + | (Bool_t _, Prim (loc, ((D_True | D_False) as c), l, _)) -> + traced (fail (Invalid_arity (loc, c, 0, List.length l))) + | (Bool_t _, expr) -> + traced (fail (unexpected expr [] Constant_namespace [D_True; D_False])) + (* Strings *) + | (String_t _, String (_, v)) -> + Lwt.return (Gas.consume ctxt (Typecheck_costs.string (String.length v))) + >>=? fun ctxt -> + let rec check_printable_ascii i = + if Compare.Int.(i < 0) then true + else + match v.[i] with + | '\n' | '\x20' .. '\x7E' -> + check_printable_ascii (i - 1) + | _ -> + false + in + if check_printable_ascii (String.length v - 1) then return (v, ctxt) + else error () >>=? fail + | (String_t _, expr) -> + traced (fail (Invalid_kind (location expr, [String_kind], kind expr))) + (* Byte sequences *) + | (Bytes_t _, Bytes (_, v)) -> + Lwt.return (Gas.consume ctxt (Typecheck_costs.string (MBytes.length v))) + >>=? fun ctxt -> return (v, ctxt) + | (Bytes_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Bytes_kind], kind expr))) + (* Integers *) + | (Int_t _, Int (_, v)) -> + Lwt.return (Gas.consume ctxt (Typecheck_costs.z v)) + >>=? fun ctxt -> return (Script_int.of_zint v, ctxt) + | (Nat_t _, Int (_, v)) -> + Lwt.return (Gas.consume ctxt (Typecheck_costs.z v)) + >>=? fun ctxt -> + let v = Script_int.of_zint v in + if Compare.Int.(Script_int.compare v Script_int.zero >= 0) then + return (Script_int.abs v, ctxt) + else error () >>=? fail + | (Int_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Int_kind], kind expr))) + | (Nat_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Int_kind], kind expr))) + (* Tez amounts *) + | (Mutez_t _, Int (_, v)) -> ( + Lwt.return + ( Gas.consume ctxt Typecheck_costs.tez + >>? fun ctxt -> + Gas.consume ctxt Michelson_v1_gas.Cost_of.Legacy.z_to_int64 ) + >>=? fun ctxt -> + try + match Tez.of_mutez (Z.to_int64 v) with + | None -> + raise Exit + | Some tez -> + return (tez, ctxt) + with _ -> error () >>=? fail ) + | (Mutez_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Int_kind], kind expr))) + (* Timestamps *) + | (Timestamp_t _, Int (_, v)) + (* As unparsed with [Optimized] or out of bounds [Readable]. *) -> + Lwt.return (Gas.consume ctxt (Typecheck_costs.z v)) + >>=? fun ctxt -> return (Script_timestamp.of_zint v, ctxt) + | (Timestamp_t _, String (_, s)) (* As unparsed with [Redable]. *) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.string_timestamp) + >>=? fun ctxt -> + match Script_timestamp.of_string s with + | Some v -> + return (v, ctxt) + | None -> + error () >>=? fail ) + | (Timestamp_t _, expr) -> + traced + (fail + (Invalid_kind (location expr, [String_kind; Int_kind], kind expr))) + (* IDs *) + | (Key_t _, Bytes (_, bytes)) -> ( + (* As unparsed with [Optimized]. *) + Lwt.return (Gas.consume ctxt Typecheck_costs.key) + >>=? fun ctxt -> + match + Data_encoding.Binary.of_bytes Signature.Public_key.encoding bytes + with + | Some k -> + return (k, ctxt) + | None -> + error () >>=? fail ) + | (Key_t _, String (_, s)) -> ( + (* As unparsed with [Readable]. *) + Lwt.return (Gas.consume ctxt Typecheck_costs.key) + >>=? fun ctxt -> + match Signature.Public_key.of_b58check_opt s with + | Some k -> + return (k, ctxt) + | None -> + error () >>=? fail ) + | (Key_t _, expr) -> + traced + (fail + (Invalid_kind (location expr, [String_kind; Bytes_kind], kind expr))) + | (Key_hash_t _, Bytes (_, bytes)) -> ( + (* As unparsed with [Optimized]. *) + Lwt.return (Gas.consume ctxt Typecheck_costs.key_hash) + >>=? fun ctxt -> + match + Data_encoding.Binary.of_bytes Signature.Public_key_hash.encoding bytes + with + | Some k -> + return (k, ctxt) + | None -> + error () >>=? fail ) + | (Key_hash_t _, String (_, s)) (* As unparsed with [Readable]. *) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.key_hash) + >>=? fun ctxt -> + match Signature.Public_key_hash.of_b58check_opt s with + | Some k -> + return (k, ctxt) + | None -> + error () >>=? fail ) + | (Key_hash_t _, expr) -> + traced + (fail + (Invalid_kind (location expr, [String_kind; Bytes_kind], kind expr))) + (* Signatures *) + | (Signature_t _, Bytes (_, bytes)) (* As unparsed with [Optimized]. *) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.signature) + >>=? fun ctxt -> + match Data_encoding.Binary.of_bytes Signature.encoding bytes with + | Some k -> + return (k, ctxt) + | None -> + error () >>=? fail ) + | (Signature_t _, String (_, s)) (* As unparsed with [Readable]. *) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.signature) + >>=? fun ctxt -> + match Signature.of_b58check_opt s with + | Some s -> + return (s, ctxt) + | None -> + error () >>=? fail ) + | (Signature_t _, expr) -> + traced + (fail + (Invalid_kind (location expr, [String_kind; Bytes_kind], kind expr))) + (* Operations *) + | (Operation_t _, _) -> + (* operations cannot appear in parameters or storage, + the protocol should never parse the bytes of an operation *) + assert false + (* Chain_ids *) + | (Chain_id_t _, Bytes (_, bytes)) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.chain_id) + >>=? fun ctxt -> + match Data_encoding.Binary.of_bytes Chain_id.encoding bytes with + | Some k -> + return (k, ctxt) + | None -> + error () >>=? fail ) + | (Chain_id_t _, String (_, s)) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.chain_id) + >>=? fun ctxt -> + match Chain_id.of_b58check_opt s with + | Some s -> + return (s, ctxt) + | None -> + error () >>=? fail ) + | (Chain_id_t _, expr) -> + traced + (fail + (Invalid_kind (location expr, [String_kind; Bytes_kind], kind expr))) + (* Addresses *) + | (Address_t _, Bytes (loc, bytes)) (* As unparsed with [O[ptimized]. *) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.contract) + >>=? fun ctxt -> + match + Data_encoding.Binary.of_bytes + Data_encoding.(tup2 Contract.encoding Variable.string) + bytes + with + | Some (c, entrypoint) -> + if Compare.Int.(String.length entrypoint > 31) then + fail (Entrypoint_name_too_long entrypoint) + else + ( match entrypoint with + | "" -> + return "default" + | "default" -> + fail (Unexpected_annotation loc) + | name -> + return name ) + >>=? fun entrypoint -> return ((c, entrypoint), ctxt) + | None -> + error () >>=? fail ) + | (Address_t _, String (loc, s)) (* As unparsed with [Readable]. *) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.contract) + >>=? fun ctxt -> + ( match String.index_opt s '%' with + | None -> + return (s, "default") + | Some pos -> ( + let len = String.length s - pos - 1 in + let name = String.sub s (pos + 1) len in + if Compare.Int.(len > 31) then fail (Entrypoint_name_too_long name) + else + match (String.sub s 0 pos, name) with + | (_, "default") -> + traced (fail (Unexpected_annotation loc)) + | addr_and_name -> + return addr_and_name ) ) + >>=? fun (addr, entrypoint) -> + Lwt.return (Contract.of_b58check addr) + >>=? fun c -> return ((c, entrypoint), ctxt) + | (Address_t _, expr) -> + traced + (fail + (Invalid_kind (location expr, [String_kind; Bytes_kind], kind expr))) + (* Contracts *) + | (Contract_t (ty, _), Bytes (loc, bytes)) + (* As unparsed with [Optimized]. *) -> ( + Lwt.return (Gas.consume ctxt Typecheck_costs.contract) + >>=? fun ctxt -> + match + Data_encoding.Binary.of_bytes + Data_encoding.(tup2 Contract.encoding Variable.string) + bytes + with + | Some (c, entrypoint) -> + if Compare.Int.(String.length entrypoint > 31) then + fail (Entrypoint_name_too_long entrypoint) + else + ( match entrypoint with + | "" -> + return "default" + | "default" -> + traced (fail (Unexpected_annotation loc)) + | name -> + return name ) + >>=? fun entrypoint -> + traced (parse_contract ~legacy ctxt loc ty c ~entrypoint) + >>=? fun (ctxt, _) -> return ((ty, (c, entrypoint)), ctxt) + | None -> + error () >>=? fail ) + | (Contract_t (ty, _), String (loc, s)) (* As unparsed with [Readable]. *) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.contract) + >>=? fun ctxt -> + ( match String.index_opt s '%' with + | None -> + return (s, "default") + | Some pos -> ( + let len = String.length s - pos - 1 in + let name = String.sub s (pos + 1) len in + if Compare.Int.(len > 31) then fail (Entrypoint_name_too_long name) + else + match (String.sub s 0 pos, name) with + | (_, "default") -> + traced (fail (Unexpected_annotation loc)) + | addr_and_name -> + return addr_and_name ) ) + >>=? fun (addr, entrypoint) -> + traced (Lwt.return (Contract.of_b58check addr)) + >>=? fun c -> + parse_contract ~legacy ctxt loc ty c ~entrypoint + >>=? fun (ctxt, _) -> return ((ty, (c, entrypoint)), ctxt) + | (Contract_t _, expr) -> + traced + (fail + (Invalid_kind (location expr, [String_kind; Bytes_kind], kind expr))) + (* Pairs *) + | (Pair_t ((ta, _, _), (tb, _, _), _, _), Prim (loc, D_Pair, [va; vb], annot)) + -> + (if legacy then return () else fail_unexpected_annot loc annot) + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.pair) + >>=? fun ctxt -> + traced @@ parse_data ?type_logger ctxt ~legacy ta va + >>=? fun (va, ctxt) -> + parse_data ?type_logger ctxt ~legacy tb vb + >>=? fun (vb, ctxt) -> return ((va, vb), ctxt) + | (Pair_t _, Prim (loc, D_Pair, l, _)) -> + fail @@ Invalid_arity (loc, D_Pair, 2, List.length l) + | (Pair_t _, expr) -> + traced (fail (unexpected expr [] Constant_namespace [D_Pair])) + (* Unions *) + | (Union_t ((tl, _), _, _, _), Prim (loc, D_Left, [v], annot)) -> + (if legacy then return () else fail_unexpected_annot loc annot) + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.union) + >>=? fun ctxt -> + traced @@ parse_data ?type_logger ctxt ~legacy tl v + >>=? fun (v, ctxt) -> return (L v, ctxt) + | (Union_t _, Prim (loc, D_Left, l, _)) -> + fail @@ Invalid_arity (loc, D_Left, 1, List.length l) + | (Union_t (_, (tr, _), _, _), Prim (loc, D_Right, [v], annot)) -> + fail_unexpected_annot loc annot + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.union) + >>=? fun ctxt -> + traced @@ parse_data ?type_logger ctxt ~legacy tr v + >>=? fun (v, ctxt) -> return (R v, ctxt) + | (Union_t _, Prim (loc, D_Right, l, _)) -> + fail @@ Invalid_arity (loc, D_Right, 1, List.length l) + | (Union_t _, expr) -> + traced (fail (unexpected expr [] Constant_namespace [D_Left; D_Right])) + (* Lambdas *) + | (Lambda_t (ta, tr, _ty_name), (Seq (_loc, _) as script_instr)) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.lambda) + >>=? fun ctxt -> + traced + @@ parse_returning + Lambda + ?type_logger + ctxt + ~legacy + (ta, Some (`Var_annot "@arg")) + tr + script_instr + | (Lambda_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Seq_kind], kind expr))) + (* Options *) + | (Option_t (t, _, _), Prim (loc, D_Some, [v], annot)) -> + (if legacy then return () else fail_unexpected_annot loc annot) + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.some) + >>=? fun ctxt -> + traced @@ parse_data ?type_logger ctxt ~legacy t v + >>=? fun (v, ctxt) -> return (Some v, ctxt) + | (Option_t _, Prim (loc, D_Some, l, _)) -> + fail @@ Invalid_arity (loc, D_Some, 1, List.length l) + | (Option_t (_, _, _), Prim (loc, D_None, [], annot)) -> + (if legacy then return () else fail_unexpected_annot loc annot) + >>=? fun () -> + Lwt.return (Gas.consume ctxt Typecheck_costs.none) + >>=? fun ctxt -> return (None, ctxt) + | (Option_t _, Prim (loc, D_None, l, _)) -> + fail @@ Invalid_arity (loc, D_None, 0, List.length l) + | (Option_t _, expr) -> + traced (fail (unexpected expr [] Constant_namespace [D_Some; D_None])) + (* Lists *) + | (List_t (t, _ty_name, _), Seq (_loc, items)) -> + traced + @@ fold_right_s + (fun v (rest, ctxt) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.list_element) + >>=? fun ctxt -> + parse_data ?type_logger ctxt ~legacy t v + >>=? fun (v, ctxt) -> return (v :: rest, ctxt)) + items + ([], ctxt) + | (List_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Seq_kind], kind expr))) + (* Sets *) + | (Set_t (t, _ty_name), (Seq (loc, vs) as expr)) -> + let length = List.length vs in + traced + @@ fold_left_s + (fun (last_value, set, ctxt) v -> + Lwt.return (Gas.consume ctxt (Typecheck_costs.set_element length)) + >>=? fun ctxt -> + parse_comparable_data ?type_logger ctxt t v + >>=? fun (v, ctxt) -> + ( match last_value with + | Some value -> + if Compare.Int.(0 <= compare_comparable t value v) then + if Compare.Int.(0 = compare_comparable t value v) then + fail (Duplicate_set_values (loc, strip_locations expr)) + else fail (Unordered_set_values (loc, strip_locations expr)) + else return_unit + | None -> + return_unit ) + >>=? fun () -> + Lwt.return + (Gas.consume + ctxt + (Michelson_v1_gas.Cost_of.Legacy.set_update v false set)) + >>=? fun ctxt -> return (Some v, set_update v true set, ctxt)) + (None, empty_set t, ctxt) + vs + >>|? fun (_, set, ctxt) -> (set, ctxt) + | (Set_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Seq_kind], kind expr))) + (* Maps *) + | (Map_t (tk, tv, _ty_name, _), (Seq (loc, vs) as expr)) -> + parse_items ?type_logger loc ctxt expr tk tv vs (fun x -> x) + | (Map_t _, expr) -> + traced (fail (Invalid_kind (location expr, [Seq_kind], kind expr))) + | (Big_map_t (tk, tv, _ty_name), (Seq (loc, vs) as expr)) -> + parse_items ?type_logger loc ctxt expr tk tv vs (fun x -> Some x) + >>|? fun (diff, ctxt) -> + ( {id = None; diff; key_type = ty_of_comparable_ty tk; value_type = tv}, + ctxt ) + | (Big_map_t (tk, tv, _ty_name), Int (loc, id)) -> ( + Big_map.exists ctxt id + >>=? function + | (_, None) -> + traced (fail (Invalid_big_map (loc, id))) + | (ctxt, Some (btk, btv)) -> + Lwt.return + ( parse_comparable_ty ctxt (Micheline.root btk) + >>? fun (Ex_comparable_ty btk, ctxt) -> + parse_packable_ty ctxt ~legacy (Micheline.root btv) + >>? fun (Ex_ty btv, ctxt) -> + comparable_ty_eq ctxt tk btk + >>? fun (Eq, ctxt) -> + ty_eq ctxt tv btv + >>? fun (Eq, ctxt) -> + ok + ( { + id = Some id; + diff = empty_map tk; + key_type = ty_of_comparable_ty tk; + value_type = tv; + }, + ctxt ) ) ) + | (Big_map_t (_tk, _tv, _), expr) -> + traced + (fail (Invalid_kind (location expr, [Seq_kind; Int_kind], kind expr))) -and parse_returning - : type arg ret. - ?type_logger: type_logger -> - tc_context -> context -> legacy:bool -> - arg ty * var_annot option -> ret ty -> Script.node -> - ((arg, ret) lambda * context) tzresult Lwt.t = - fun ?type_logger tc_context ctxt ~legacy (arg, arg_annot) ret script_instr -> - parse_instr ?type_logger tc_context ctxt ~legacy - script_instr (Item_t (arg, Empty_t, arg_annot)) >>=? function - | (Typed ({ loc ; aft = (Item_t (ty, Empty_t, _) as stack_ty) ; _ } as descr), ctxt) -> - trace_eval - (fun () -> - Lwt.return (serialize_ty_for_error ctxt ret) >>=? fun (ret, ctxt) -> - serialize_stack_for_error ctxt stack_ty >>|? fun (stack_ty, _ctxt) -> - Bad_return (loc, stack_ty, ret)) - (Lwt.return (ty_eq ctxt ty ret) >>=? fun (Eq, ctxt) -> - Lwt.return (merge_types ~legacy ctxt loc ty ret) >>=? fun (_ret, ctxt) -> - return ((Lam (descr, script_instr) : (arg, ret) lambda), ctxt)) - | (Typed { loc ; aft = stack_ty ; _ }, ctxt) -> - Lwt.return (serialize_ty_for_error ctxt ret) >>=? fun (ret, ctxt) -> - serialize_stack_for_error ctxt stack_ty >>=? fun (stack_ty, _ctxt) -> - fail (Bad_return (loc, stack_ty, ret)) - | (Failed { descr }, ctxt) -> - return ((Lam (descr (Item_t (ret, Empty_t, None)), script_instr) - : (arg, ret) lambda), ctxt) +and parse_comparable_data : + type a. + ?type_logger:type_logger -> + context -> + a comparable_ty -> + Script.node -> + (a * context) tzresult Lwt.t = + fun ?type_logger ctxt ty script_data -> + parse_data + ?type_logger + ctxt + ~legacy:false + (ty_of_comparable_ty ty) + script_data + +and parse_returning : + type arg ret. + ?type_logger:type_logger -> + tc_context -> + context -> + legacy:bool -> + arg ty * var_annot option -> + ret ty -> + Script.node -> + ((arg, ret) lambda * context) tzresult Lwt.t = + fun ?type_logger tc_context ctxt ~legacy (arg, arg_annot) ret script_instr -> + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + script_instr + (Item_t (arg, Empty_t, arg_annot)) + >>=? function + | (Typed ({loc; aft = Item_t (ty, Empty_t, _) as stack_ty; _} as descr), ctxt) + -> + trace_eval + (fun () -> + Lwt.return (serialize_ty_for_error ctxt ret) + >>=? fun (ret, ctxt) -> + serialize_stack_for_error ctxt stack_ty + >>|? fun (stack_ty, _ctxt) -> Bad_return (loc, stack_ty, ret)) + ( Lwt.return (ty_eq ctxt ty ret) + >>=? fun (Eq, ctxt) -> + Lwt.return (merge_types ~legacy ctxt loc ty ret) + >>=? fun (_ret, ctxt) -> + return ((Lam (descr, script_instr) : (arg, ret) lambda), ctxt) ) + | (Typed {loc; aft = stack_ty; _}, ctxt) -> + Lwt.return (serialize_ty_for_error ctxt ret) + >>=? fun (ret, ctxt) -> + serialize_stack_for_error ctxt stack_ty + >>=? fun (stack_ty, _ctxt) -> fail (Bad_return (loc, stack_ty, ret)) + | (Failed {descr}, ctxt) -> + return + ( ( Lam (descr (Item_t (ret, Empty_t, None)), script_instr) + : (arg, ret) lambda ), + ctxt ) and parse_int32 (n : (location, prim) Micheline.node) : int tzresult = let error' () = - Invalid_syntactic_constant (location n, strip_locations n, - "a positive 32-bit integer (between 0 and " - ^ (Int32.to_string Int32.max_int) ^ ")") in + Invalid_syntactic_constant + ( location n, + strip_locations n, + "a positive 32-bit integer (between 0 and " + ^ Int32.to_string Int32.max_int + ^ ")" ) + in match n with - | Micheline.Int (_, n') -> - begin try - let n'' = Z.to_int n' in - if (Compare.Int.(0 <= n'')) && (Compare.Int.(n'' <= Int32.to_int Int32.max_int)) then - ok n'' - else - error @@ error' () - with _ -> - error @@ error' () - end - | _ -> error @@ error' () + | Micheline.Int (_, n') -> ( + try + let n'' = Z.to_int n' in + if + Compare.Int.(0 <= n'') + && Compare.Int.(n'' <= Int32.to_int Int32.max_int) + then ok n'' + else error @@ error' () + with _ -> error @@ error' () ) + | _ -> + error @@ error' () -and parse_instr - : type bef. - ?type_logger: type_logger -> - tc_context -> context -> legacy: bool -> - Script.node -> bef stack_ty -> (bef judgement * context) tzresult Lwt.t = - fun ?type_logger tc_context ctxt ~legacy script_instr stack_ty -> - let _check_item check loc name n m = - trace_eval (fun () -> - serialize_stack_for_error ctxt stack_ty >>|? fun (stack_ty, _ctxt) -> - Bad_stack (loc, name, m, stack_ty)) @@ - trace (Bad_stack_item n) @@ - Lwt.return check in - let check_item_ty - (type a) (type b) - ctxt (exp : a ty) (got : b ty) loc name n m - : ((a, b) eq * a ty * context) tzresult Lwt.t = - trace_eval (fun () -> - serialize_stack_for_error ctxt stack_ty >>|? fun (stack_ty, _ctxt) -> - Bad_stack (loc, name, m, stack_ty)) @@ - trace (Bad_stack_item n) @@ Lwt.return begin - ty_eq ctxt exp got >>? fun (Eq, ctxt) -> - merge_types ~legacy ctxt loc exp got >>? fun (ty, ctxt) -> - ok ((Eq : (a, b) eq), (ty : a ty), ctxt) - end in - let check_item_comparable_ty - (type a) (type b) - (exp : a comparable_ty) (got : b comparable_ty) loc name n m - : ((a, b) eq * a comparable_ty) tzresult Lwt.t = - trace_eval (fun () -> - serialize_stack_for_error ctxt stack_ty >>|? fun (stack_ty, _ctxt) -> - Bad_stack (loc, name, m, stack_ty)) @@ - trace (Bad_stack_item n) @@ Lwt.return begin - comparable_ty_eq ctxt exp got >>? fun Eq -> - merge_comparable_types ~legacy exp got >>? fun ty -> - ok ((Eq : (a, b) eq), (ty : a comparable_ty)) - end in - let log_stack ctxt loc stack_ty aft = - match type_logger, script_instr with - | None, _ - | Some _, (Seq (-1, _) | Int _ | String _ | Bytes _) -> return_unit - | Some log, (Prim _ | Seq _) -> - (* Unparsing for logging done in an unlimited context as this +and parse_instr : + type bef. + ?type_logger:type_logger -> + tc_context -> + context -> + legacy:bool -> + Script.node -> + bef stack_ty -> + (bef judgement * context) tzresult Lwt.t = + fun ?type_logger tc_context ctxt ~legacy script_instr stack_ty -> + let _check_item check loc name n m = + trace_eval (fun () -> + serialize_stack_for_error ctxt stack_ty + >>|? fun (stack_ty, _ctxt) -> Bad_stack (loc, name, m, stack_ty)) + @@ trace (Bad_stack_item n) @@ Lwt.return check + in + let check_item_ty (type a b) ctxt (exp : a ty) (got : b ty) loc name n m : + ((a, b) eq * a ty * context) tzresult Lwt.t = + trace_eval (fun () -> + serialize_stack_for_error ctxt stack_ty + >>|? fun (stack_ty, _ctxt) -> Bad_stack (loc, name, m, stack_ty)) + @@ trace (Bad_stack_item n) + @@ Lwt.return + ( ty_eq ctxt exp got + >>? fun (Eq, ctxt) -> + merge_types ~legacy ctxt loc exp got + >>? fun (ty, ctxt) -> ok ((Eq : (a, b) eq), (ty : a ty), ctxt) ) + in + let check_item_comparable_ty (type a b) (exp : a comparable_ty) + (got : b comparable_ty) loc name n m : + ((a, b) eq * a comparable_ty * context) tzresult Lwt.t = + trace_eval (fun () -> + serialize_stack_for_error ctxt stack_ty + >>|? fun (stack_ty, _ctxt) -> Bad_stack (loc, name, m, stack_ty)) + @@ trace (Bad_stack_item n) + @@ Lwt.return + ( comparable_ty_eq ctxt exp got + >>? fun (Eq, ctxt) -> + merge_comparable_types ~legacy exp got + >>? fun ty -> ok ((Eq : (a, b) eq), (ty : a comparable_ty), ctxt) ) + in + let log_stack ctxt loc stack_ty aft = + match (type_logger, script_instr) with + | (None, _) | (Some _, (Seq (-1, _) | Int _ | String _ | Bytes _)) -> + return_unit + | (Some log, (Prim _ | Seq _)) -> + (* Unparsing for logging done in an unlimited context as this is used only by the client and not the protocol *) - let ctxt = Gas.set_unlimited ctxt in - unparse_stack ctxt stack_ty >>=? fun (stack_ty, _) -> - unparse_stack ctxt aft >>=? fun (aft, _) -> - log loc stack_ty aft; - return_unit - in - let outer_return = return in - let return : type bef . - context -> bef judgement -> (bef judgement * context) tzresult Lwt.t = fun ctxt judgement -> - match judgement with - | Typed { instr ; loc ; aft ; _ } -> - let maximum_type_size = Constants.michelson_maximum_type_size ctxt in - let type_size = - type_size_of_stack_head aft - ~up_to:(number_of_generated_growing_types instr) in - if Compare.Int.(type_size > maximum_type_size) then - fail (Type_too_large (loc, type_size, maximum_type_size)) - else - return (judgement, ctxt) - | Failed _ -> - return (judgement, ctxt) in - let typed ctxt loc instr aft = - log_stack ctxt loc stack_ty aft >>=? fun () -> - Lwt.return @@ Gas.consume ctxt (Typecheck_costs.instr instr) >>=? fun ctxt -> - return ctxt (Typed { loc ; instr ; bef = stack_ty ; aft }) in - Lwt.return @@ Gas.consume ctxt Typecheck_costs.cycle >>=? fun ctxt -> - match script_instr, stack_ty with - (* stack ops *) - | Prim (loc, I_DROP, [], annot), - Item_t (_, rest, _) -> - (fail_unexpected_annot loc annot >>=? fun () -> - typed ctxt loc Drop rest : (bef judgement * context) tzresult Lwt.t) - | Prim (loc, I_DROP, [n], result_annot), whole_stack -> - Lwt.return (parse_int32 n) >>=? fun whole_n -> - let rec make_proof_argument - : type tstk . int -> (tstk stack_ty) -> (tstk dropn_proof_argument) tzresult Lwt.t = - fun n stk -> - match (Compare.Int.(n = 0)), stk with - true, rest -> - outer_return @@ (Dropn_proof_argument (Rest, rest, rest)) - | false, Item_t (v, rest, annot) -> - make_proof_argument (n - 1) rest - >>=? fun (Dropn_proof_argument (n', stack_after_drops, aft')) -> - outer_return @@ (Dropn_proof_argument (Prefix n', stack_after_drops, Item_t (v, aft', annot))) - | _, _ -> - serialize_stack_for_error ctxt whole_stack >>=? fun (whole_stack, _ctxt) -> - fail (Bad_stack (loc, I_DROP, whole_n, whole_stack)) + let ctxt = Gas.set_unlimited ctxt in + unparse_stack ctxt stack_ty + >>=? fun (stack_ty, _) -> + unparse_stack ctxt aft + >>=? fun (aft, _) -> log loc stack_ty aft ; return_unit + in + let outer_return = return in + let return : + type bef. + context -> bef judgement -> (bef judgement * context) tzresult Lwt.t = + fun ctxt judgement -> + match judgement with + | Typed {instr; loc; aft; _} -> + let maximum_type_size = Constants.michelson_maximum_type_size ctxt in + let type_size = + type_size_of_stack_head + aft + ~up_to:(number_of_generated_growing_types instr) in - fail_unexpected_annot loc result_annot >>=? fun () -> - make_proof_argument whole_n whole_stack >>=? fun (Dropn_proof_argument (n', stack_after_drops, _aft)) -> - typed ctxt loc (Dropn (whole_n, n')) stack_after_drops - | Prim (loc, I_DROP, (_ :: _ :: _ as l), _), _ -> - (* Technically, the arities 0 and 1 are allowed but the error only mentions 1. + if Compare.Int.(type_size > maximum_type_size) then + fail (Type_too_large (loc, type_size, maximum_type_size)) + else return (judgement, ctxt) + | Failed _ -> + return (judgement, ctxt) + in + let typed ctxt loc instr aft = + log_stack ctxt loc stack_ty aft + >>=? fun () -> + Lwt.return @@ Gas.consume ctxt (Typecheck_costs.instr instr) + >>=? fun ctxt -> return ctxt (Typed {loc; instr; bef = stack_ty; aft}) + in + Lwt.return @@ Gas.consume ctxt Typecheck_costs.cycle + >>=? fun ctxt -> + match (script_instr, stack_ty) with + (* stack ops *) + | (Prim (loc, I_DROP, [], annot), Item_t (_, rest, _)) -> + ( fail_unexpected_annot loc annot >>=? fun () -> typed ctxt loc Drop rest + : (bef judgement * context) tzresult Lwt.t ) + | (Prim (loc, I_DROP, [n], result_annot), whole_stack) -> + Lwt.return (parse_int32 n) + >>=? fun whole_n -> + let rec make_proof_argument : + type tstk. + int -> tstk stack_ty -> tstk dropn_proof_argument tzresult Lwt.t = + fun n stk -> + match (Compare.Int.(n = 0), stk) with + | (true, rest) -> + outer_return @@ Dropn_proof_argument (Rest, rest, rest) + | (false, Item_t (v, rest, annot)) -> + make_proof_argument (n - 1) rest + >>=? fun (Dropn_proof_argument (n', stack_after_drops, aft')) -> + outer_return + @@ Dropn_proof_argument + (Prefix n', stack_after_drops, Item_t (v, aft', annot)) + | (_, _) -> + serialize_stack_for_error ctxt whole_stack + >>=? fun (whole_stack, _ctxt) -> + fail (Bad_stack (loc, I_DROP, whole_n, whole_stack)) + in + fail_unexpected_annot loc result_annot + >>=? fun () -> + make_proof_argument whole_n whole_stack + >>=? fun (Dropn_proof_argument (n', stack_after_drops, _aft)) -> + typed ctxt loc (Dropn (whole_n, n')) stack_after_drops + | (Prim (loc, I_DROP, (_ :: _ :: _ as l), _), _) -> + (* Technically, the arities 0 and 1 are allowed but the error only mentions 1. However, DROP is equivalent to DROP 1 so hinting at an arity of 1 makes sense. *) - fail (Invalid_arity (loc, I_DROP, 1, List.length l)) - | Prim (loc, I_DUP, [], annot), - Item_t (v, rest, stack_annot) -> - parse_var_annot loc annot ~default:stack_annot >>=? fun annot -> - typed ctxt loc Dup - (Item_t (v, Item_t (v, rest, stack_annot), annot)) - | Prim (loc, I_DIG, [n], result_annot), stack -> - let rec make_proof_argument - : type tstk . int -> (tstk stack_ty) -> (tstk dig_proof_argument) tzresult Lwt.t = - fun n stk -> - match (Compare.Int.(n = 0)), stk with - true, Item_t (v, rest, annot) -> - outer_return @@ (Dig_proof_argument (Rest, (v, annot), rest)) - | false, Item_t (v, rest, annot) -> - make_proof_argument (n - 1) rest - >>=? fun (Dig_proof_argument (n', (x, xv), aft')) -> - outer_return @@ (Dig_proof_argument (Prefix n', (x, xv), Item_t (v, aft', annot))) - | _, _ -> - serialize_stack_for_error ctxt stack >>=? fun (whole_stack, _ctxt) -> - fail (Bad_stack (loc, I_DIG, 1, whole_stack)) - in - Lwt.return (parse_int32 n) >>=? fun n -> - fail_unexpected_annot loc result_annot >>=? fun () -> - make_proof_argument n stack >>=? fun (Dig_proof_argument (n', (x, stack_annot), aft)) -> - typed ctxt loc (Dig (n, n')) (Item_t (x, aft, stack_annot)) - | Prim (loc, I_DIG, ([] | _ :: _ :: _ as l), _), _ -> - fail (Invalid_arity (loc, I_DIG, 1, List.length l)) - | Prim (loc, I_DUG, [n], result_annot), Item_t (x, whole_stack, stack_annot) -> - Lwt.return (parse_int32 n) >>=? fun whole_n -> - let rec make_proof_argument - : type tstk x . int -> x ty -> var_annot option -> (tstk stack_ty) - -> ((tstk, x) dug_proof_argument) tzresult Lwt.t = - fun n x stack_annot stk -> - match (Compare.Int.(n = 0)), stk with - true, rest -> - outer_return @@ (Dug_proof_argument (Rest, (), Item_t (x, rest, stack_annot))) - | false, Item_t (v, rest, annot) -> - make_proof_argument (n - 1) x stack_annot rest - >>=? fun (Dug_proof_argument (n', (), aft')) -> - outer_return @@ (Dug_proof_argument (Prefix n', (), Item_t (v, aft', annot))) - | _, _ -> - serialize_stack_for_error ctxt whole_stack >>=? fun (whole_stack, _ctxt) -> - fail (Bad_stack (loc, I_DUG, whole_n, whole_stack)) - in - fail_unexpected_annot loc result_annot >>=? fun () -> - make_proof_argument whole_n x stack_annot whole_stack >>=? fun (Dug_proof_argument (n', (), aft)) -> - typed ctxt loc (Dug (whole_n, n')) aft - | Prim (loc, I_DUG, [_], result_annot), (Empty_t as stack) -> - fail_unexpected_annot loc result_annot >>=? fun () -> - serialize_stack_for_error ctxt stack >>=? fun (stack, _ctxt) -> - fail (Bad_stack (loc, I_DUG, 1, stack)) - | Prim (loc, I_DUG, ([] | _ :: _ :: _ as l), _), _ -> - fail (Invalid_arity (loc, I_DUG, 1, List.length l)) - | Prim (loc, I_SWAP, [], annot), - Item_t (v, Item_t (w, rest, stack_annot), cur_top_annot) -> - fail_unexpected_annot loc annot >>=? fun () -> - typed ctxt loc Swap - (Item_t (w, Item_t (v, rest, cur_top_annot), stack_annot)) - | Prim (loc, I_PUSH, [ t ; d ], annot), - stack -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ parse_packable_ty ctxt ~legacy t >>=? fun (Ex_ty t, ctxt) -> - parse_data ?type_logger ctxt ~legacy t d >>=? fun (v, ctxt) -> - typed ctxt loc (Const v) (Item_t (t, stack, annot)) - | Prim (loc, I_UNIT, [], annot), - stack -> - parse_var_type_annot loc annot >>=? fun (annot, ty_name) -> - typed ctxt loc (Const ()) (Item_t (Unit_t ty_name, stack, annot)) - (* options *) - | Prim (loc, I_SOME, [], annot), - Item_t (t, rest, _) -> - parse_var_type_annot loc annot >>=? fun (annot, ty_name) -> - typed ctxt loc Cons_some - (Item_t (Option_t (t, ty_name, has_big_map t), rest, annot)) - | Prim (loc, I_NONE, [ t ], annot), - stack -> - Lwt.return @@ parse_any_ty ctxt ~legacy t >>=? fun (Ex_ty t, ctxt) -> - parse_var_type_annot loc annot >>=? fun (annot, ty_name) -> - typed ctxt loc (Cons_none t) - (Item_t (Option_t (t, ty_name, has_big_map t), stack, annot)) - | Prim (loc, I_IF_NONE, [ bt ; bf ], annot), - (Item_t (Option_t (t, _, _), rest, option_annot) as bef) -> - check_kind [ Seq_kind ] bt >>=? fun () -> - check_kind [ Seq_kind ] bf >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - let annot = gen_access_annot option_annot default_some_annot in - parse_instr ?type_logger tc_context ctxt ~legacy bt rest >>=? fun (btr, ctxt) -> - parse_instr ?type_logger tc_context ctxt ~legacy bf (Item_t (t, rest, annot)) >>=? fun (bfr, ctxt) -> - let branch ibt ibf = - { loc ; instr = If_none (ibt, ibf) ; bef ; aft = ibt.aft } in - merge_branches ~legacy ctxt loc btr bfr { branch } >>=? fun (judgement, ctxt) -> - return ctxt judgement - (* pairs *) - | Prim (loc, I_PAIR, [], annot), - Item_t (a, Item_t (b, rest, snd_annot), fst_annot) -> - parse_constr_annot loc annot - ~if_special_first:(var_to_field_annot fst_annot) - ~if_special_second:(var_to_field_annot snd_annot) - >>=? fun (annot, ty_name, l_field, r_field) -> - typed ctxt loc Cons_pair - (Item_t (Pair_t((a, l_field, fst_annot), (b, r_field, snd_annot), ty_name, has_big_map a || has_big_map b), rest, annot)) - | Prim (loc, I_CAR, [], annot), - Item_t (Pair_t ((a, expected_field_annot, a_annot), _, _, _), rest, pair_annot) -> - parse_destr_annot loc annot - ~pair_annot - ~value_annot:a_annot - ~field_name:expected_field_annot - ~default_accessor:default_car_annot - >>=? fun (annot, field_annot) -> - Lwt.return @@ check_correct_field field_annot expected_field_annot >>=? fun () -> - typed ctxt loc Car (Item_t (a, rest, annot)) - | Prim (loc, I_CDR, [], annot), - Item_t (Pair_t (_, (b, expected_field_annot, b_annot), _, _), rest, pair_annot) -> - parse_destr_annot loc annot - ~pair_annot - ~value_annot:b_annot - ~field_name:expected_field_annot - ~default_accessor:default_cdr_annot - >>=? fun (annot, field_annot) -> - Lwt.return @@ check_correct_field field_annot expected_field_annot >>=? fun () -> - typed ctxt loc Cdr (Item_t (b, rest, annot)) - (* unions *) - | Prim (loc, I_LEFT, [ tr ], annot), - Item_t (tl, rest, stack_annot) -> - Lwt.return @@ parse_any_ty ctxt ~legacy tr >>=? fun (Ex_ty tr, ctxt) -> - parse_constr_annot loc annot - ~if_special_first:(var_to_field_annot stack_annot) - >>=? fun (annot, tname, l_field, r_field) -> - typed ctxt loc Left (Item_t (Union_t ((tl, l_field), (tr, r_field), tname, has_big_map tl || has_big_map tr), rest, annot)) - | Prim (loc, I_RIGHT, [ tl ], annot), - Item_t (tr, rest, stack_annot) -> - Lwt.return @@ parse_any_ty ctxt ~legacy tl >>=? fun (Ex_ty tl, ctxt) -> - parse_constr_annot loc annot - ~if_special_second:(var_to_field_annot stack_annot) - >>=? fun (annot, tname, l_field, r_field) -> - typed ctxt loc Right (Item_t (Union_t ((tl, l_field), (tr, r_field), tname, has_big_map tl || has_big_map tr), rest, annot)) - | Prim (loc, I_IF_LEFT, [ bt ; bf ], annot), - (Item_t (Union_t ((tl, l_field), (tr, r_field), _, _), rest, union_annot) as bef) -> - check_kind [ Seq_kind ] bt >>=? fun () -> - check_kind [ Seq_kind ] bf >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - let left_annot = gen_access_annot union_annot l_field ~default:default_left_annot in - let right_annot = gen_access_annot union_annot r_field ~default:default_right_annot in - parse_instr ?type_logger tc_context ctxt ~legacy bt (Item_t (tl, rest, left_annot)) >>=? fun (btr, ctxt) -> - parse_instr ?type_logger tc_context ctxt ~legacy bf (Item_t (tr, rest, right_annot)) >>=? fun (bfr, ctxt) -> - let branch ibt ibf = - { loc ; instr = If_left (ibt, ibf) ; bef ; aft = ibt.aft } in - merge_branches ~legacy ctxt loc btr bfr { branch } >>=? fun (judgement, ctxt) -> - return ctxt judgement - (* lists *) - | Prim (loc, I_NIL, [ t ], annot), - stack -> - Lwt.return @@ parse_any_ty ctxt ~legacy t >>=? fun (Ex_ty t, ctxt) -> - parse_var_type_annot loc annot >>=? fun (annot, ty_name) -> - typed ctxt loc Nil (Item_t (List_t (t, ty_name, has_big_map t), stack, annot)) - | Prim (loc, I_CONS, [], annot), - Item_t (tv, Item_t (List_t (t, ty_name, has_big_map), rest, _), _) -> - check_item_ty ctxt tv t loc I_CONS 1 2 >>=? fun (Eq, t, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Cons_list (Item_t (List_t (t, ty_name, has_big_map), rest, annot)) - | Prim (loc, I_IF_CONS, [ bt ; bf ], annot), - (Item_t (List_t (t, ty_name, has_big_map), rest, list_annot) as bef) -> - check_kind [ Seq_kind ] bt >>=? fun () -> - check_kind [ Seq_kind ] bf >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - let hd_annot = gen_access_annot list_annot default_hd_annot in - let tl_annot = gen_access_annot list_annot default_tl_annot in - parse_instr ?type_logger tc_context ctxt ~legacy bt - (Item_t (t, Item_t (List_t (t, ty_name, has_big_map), rest, tl_annot), hd_annot)) - >>=? fun (btr, ctxt) -> - parse_instr ?type_logger tc_context ctxt ~legacy bf - rest >>=? fun (bfr, ctxt) -> - let branch ibt ibf = - { loc ; instr = If_cons (ibt, ibf) ; bef ; aft = ibt.aft } in - merge_branches ~legacy ctxt loc btr bfr { branch } >>=? fun (judgement, ctxt) -> - return ctxt judgement - | Prim (loc, I_SIZE, [], annot), - Item_t (List_t _, rest, _) -> - parse_var_type_annot loc annot >>=? fun (annot, tname) -> - typed ctxt loc List_size (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_MAP, [ body ], annot), - (Item_t (List_t (elt, _, _), starting_rest, list_annot)) -> - check_kind [ Seq_kind ] body >>=? fun () -> - parse_var_type_annot loc annot - >>=? fun (ret_annot, list_ty_name) -> - let elt_annot = gen_access_annot list_annot default_elt_annot in - parse_instr ?type_logger tc_context ctxt ~legacy - body (Item_t (elt, starting_rest, elt_annot)) >>=? begin fun (judgement, ctxt) -> + fail (Invalid_arity (loc, I_DROP, 1, List.length l)) + | (Prim (loc, I_DUP, [], annot), Item_t (v, rest, stack_annot)) -> + parse_var_annot loc annot ~default:stack_annot + >>=? fun annot -> + typed ctxt loc Dup (Item_t (v, Item_t (v, rest, stack_annot), annot)) + | (Prim (loc, I_DIG, [n], result_annot), stack) -> + let rec make_proof_argument : + type tstk. + int -> tstk stack_ty -> tstk dig_proof_argument tzresult Lwt.t = + fun n stk -> + match (Compare.Int.(n = 0), stk) with + | (true, Item_t (v, rest, annot)) -> + outer_return @@ Dig_proof_argument (Rest, (v, annot), rest) + | (false, Item_t (v, rest, annot)) -> + make_proof_argument (n - 1) rest + >>=? fun (Dig_proof_argument (n', (x, xv), aft')) -> + outer_return + @@ Dig_proof_argument (Prefix n', (x, xv), Item_t (v, aft', annot)) + | (_, _) -> + serialize_stack_for_error ctxt stack + >>=? fun (whole_stack, _ctxt) -> + fail (Bad_stack (loc, I_DIG, 1, whole_stack)) + in + Lwt.return (parse_int32 n) + >>=? fun n -> + fail_unexpected_annot loc result_annot + >>=? fun () -> + make_proof_argument n stack + >>=? fun (Dig_proof_argument (n', (x, stack_annot), aft)) -> + typed ctxt loc (Dig (n, n')) (Item_t (x, aft, stack_annot)) + | (Prim (loc, I_DIG, (([] | _ :: _ :: _) as l), _), _) -> + fail (Invalid_arity (loc, I_DIG, 1, List.length l)) + | (Prim (loc, I_DUG, [n], result_annot), Item_t (x, whole_stack, stack_annot)) + -> + Lwt.return (parse_int32 n) + >>=? fun whole_n -> + let rec make_proof_argument : + type tstk x. + int -> + x ty -> + var_annot option -> + tstk stack_ty -> + (tstk, x) dug_proof_argument tzresult Lwt.t = + fun n x stack_annot stk -> + match (Compare.Int.(n = 0), stk) with + | (true, rest) -> + outer_return + @@ Dug_proof_argument (Rest, (), Item_t (x, rest, stack_annot)) + | (false, Item_t (v, rest, annot)) -> + make_proof_argument (n - 1) x stack_annot rest + >>=? fun (Dug_proof_argument (n', (), aft')) -> + outer_return + @@ Dug_proof_argument (Prefix n', (), Item_t (v, aft', annot)) + | (_, _) -> + serialize_stack_for_error ctxt whole_stack + >>=? fun (whole_stack, _ctxt) -> + fail (Bad_stack (loc, I_DUG, whole_n, whole_stack)) + in + fail_unexpected_annot loc result_annot + >>=? fun () -> + make_proof_argument whole_n x stack_annot whole_stack + >>=? fun (Dug_proof_argument (n', (), aft)) -> + typed ctxt loc (Dug (whole_n, n')) aft + | (Prim (loc, I_DUG, [_], result_annot), (Empty_t as stack)) -> + fail_unexpected_annot loc result_annot + >>=? fun () -> + serialize_stack_for_error ctxt stack + >>=? fun (stack, _ctxt) -> fail (Bad_stack (loc, I_DUG, 1, stack)) + | (Prim (loc, I_DUG, (([] | _ :: _ :: _) as l), _), _) -> + fail (Invalid_arity (loc, I_DUG, 1, List.length l)) + | ( Prim (loc, I_SWAP, [], annot), + Item_t (v, Item_t (w, rest, stack_annot), cur_top_annot) ) -> + fail_unexpected_annot loc annot + >>=? fun () -> + typed + ctxt + loc + Swap + (Item_t (w, Item_t (v, rest, cur_top_annot), stack_annot)) + | (Prim (loc, I_PUSH, [t; d], annot), stack) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ parse_packable_ty ctxt ~legacy t + >>=? fun (Ex_ty t, ctxt) -> + parse_data ?type_logger ctxt ~legacy t d + >>=? fun (v, ctxt) -> typed ctxt loc (Const v) (Item_t (t, stack, annot)) + | (Prim (loc, I_UNIT, [], annot), stack) -> + parse_var_type_annot loc annot + >>=? fun (annot, ty_name) -> + typed ctxt loc (Const ()) (Item_t (Unit_t ty_name, stack, annot)) + (* options *) + | (Prim (loc, I_SOME, [], annot), Item_t (t, rest, _)) -> + parse_var_type_annot loc annot + >>=? fun (annot, ty_name) -> + typed + ctxt + loc + Cons_some + (Item_t (Option_t (t, ty_name, has_big_map t), rest, annot)) + | (Prim (loc, I_NONE, [t], annot), stack) -> + Lwt.return @@ parse_any_ty ctxt ~legacy t + >>=? fun (Ex_ty t, ctxt) -> + parse_var_type_annot loc annot + >>=? fun (annot, ty_name) -> + typed + ctxt + loc + (Cons_none t) + (Item_t (Option_t (t, ty_name, has_big_map t), stack, annot)) + | ( Prim (loc, I_IF_NONE, [bt; bf], annot), + (Item_t (Option_t (t, _, _), rest, option_annot) as bef) ) -> + check_kind [Seq_kind] bt + >>=? fun () -> + check_kind [Seq_kind] bf + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + let annot = gen_access_annot option_annot default_some_annot in + parse_instr ?type_logger tc_context ctxt ~legacy bt rest + >>=? fun (btr, ctxt) -> + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + bf + (Item_t (t, rest, annot)) + >>=? fun (bfr, ctxt) -> + let branch ibt ibf = + {loc; instr = If_none (ibt, ibf); bef; aft = ibt.aft} + in + merge_branches ~legacy ctxt loc btr bfr {branch} + >>=? fun (judgement, ctxt) -> return ctxt judgement + (* pairs *) + | ( Prim (loc, I_PAIR, [], annot), + Item_t (a, Item_t (b, rest, snd_annot), fst_annot) ) -> + parse_constr_annot + loc + annot + ~if_special_first:(var_to_field_annot fst_annot) + ~if_special_second:(var_to_field_annot snd_annot) + >>=? fun (annot, ty_name, l_field, r_field) -> + typed + ctxt + loc + Cons_pair + (Item_t + ( Pair_t + ( (a, l_field, fst_annot), + (b, r_field, snd_annot), + ty_name, + has_big_map a || has_big_map b ), + rest, + annot )) + | ( Prim (loc, I_CAR, [], annot), + Item_t + (Pair_t ((a, expected_field_annot, a_annot), _, _, _), rest, pair_annot) + ) -> + parse_destr_annot + loc + annot + ~pair_annot + ~value_annot:a_annot + ~field_name:expected_field_annot + ~default_accessor:default_car_annot + >>=? fun (annot, field_annot) -> + Lwt.return @@ check_correct_field field_annot expected_field_annot + >>=? fun () -> typed ctxt loc Car (Item_t (a, rest, annot)) + | ( Prim (loc, I_CDR, [], annot), + Item_t + (Pair_t (_, (b, expected_field_annot, b_annot), _, _), rest, pair_annot) + ) -> + parse_destr_annot + loc + annot + ~pair_annot + ~value_annot:b_annot + ~field_name:expected_field_annot + ~default_accessor:default_cdr_annot + >>=? fun (annot, field_annot) -> + Lwt.return @@ check_correct_field field_annot expected_field_annot + >>=? fun () -> typed ctxt loc Cdr (Item_t (b, rest, annot)) + (* unions *) + | (Prim (loc, I_LEFT, [tr], annot), Item_t (tl, rest, stack_annot)) -> + Lwt.return @@ parse_any_ty ctxt ~legacy tr + >>=? fun (Ex_ty tr, ctxt) -> + parse_constr_annot + loc + annot + ~if_special_first:(var_to_field_annot stack_annot) + >>=? fun (annot, tname, l_field, r_field) -> + typed + ctxt + loc + Left + (Item_t + ( Union_t + ( (tl, l_field), + (tr, r_field), + tname, + has_big_map tl || has_big_map tr ), + rest, + annot )) + | (Prim (loc, I_RIGHT, [tl], annot), Item_t (tr, rest, stack_annot)) -> + Lwt.return @@ parse_any_ty ctxt ~legacy tl + >>=? fun (Ex_ty tl, ctxt) -> + parse_constr_annot + loc + annot + ~if_special_second:(var_to_field_annot stack_annot) + >>=? fun (annot, tname, l_field, r_field) -> + typed + ctxt + loc + Right + (Item_t + ( Union_t + ( (tl, l_field), + (tr, r_field), + tname, + has_big_map tl || has_big_map tr ), + rest, + annot )) + | ( Prim (loc, I_IF_LEFT, [bt; bf], annot), + ( Item_t (Union_t ((tl, l_field), (tr, r_field), _, _), rest, union_annot) + as bef ) ) -> + check_kind [Seq_kind] bt + >>=? fun () -> + check_kind [Seq_kind] bf + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + let left_annot = + gen_access_annot union_annot l_field ~default:default_left_annot + in + let right_annot = + gen_access_annot union_annot r_field ~default:default_right_annot + in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + bt + (Item_t (tl, rest, left_annot)) + >>=? fun (btr, ctxt) -> + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + bf + (Item_t (tr, rest, right_annot)) + >>=? fun (bfr, ctxt) -> + let branch ibt ibf = + {loc; instr = If_left (ibt, ibf); bef; aft = ibt.aft} + in + merge_branches ~legacy ctxt loc btr bfr {branch} + >>=? fun (judgement, ctxt) -> return ctxt judgement + (* lists *) + | (Prim (loc, I_NIL, [t], annot), stack) -> + Lwt.return @@ parse_any_ty ctxt ~legacy t + >>=? fun (Ex_ty t, ctxt) -> + parse_var_type_annot loc annot + >>=? fun (annot, ty_name) -> + typed + ctxt + loc + Nil + (Item_t (List_t (t, ty_name, has_big_map t), stack, annot)) + | ( Prim (loc, I_CONS, [], annot), + Item_t (tv, Item_t (List_t (t, ty_name, has_big_map), rest, _), _) ) -> + check_item_ty ctxt tv t loc I_CONS 1 2 + >>=? fun (Eq, t, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Cons_list + (Item_t (List_t (t, ty_name, has_big_map), rest, annot)) + | ( Prim (loc, I_IF_CONS, [bt; bf], annot), + (Item_t (List_t (t, ty_name, has_big_map), rest, list_annot) as bef) ) -> + check_kind [Seq_kind] bt + >>=? fun () -> + check_kind [Seq_kind] bf + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + let hd_annot = gen_access_annot list_annot default_hd_annot in + let tl_annot = gen_access_annot list_annot default_tl_annot in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + bt + (Item_t + ( t, + Item_t (List_t (t, ty_name, has_big_map), rest, tl_annot), + hd_annot )) + >>=? fun (btr, ctxt) -> + parse_instr ?type_logger tc_context ctxt ~legacy bf rest + >>=? fun (bfr, ctxt) -> + let branch ibt ibf = + {loc; instr = If_cons (ibt, ibf); bef; aft = ibt.aft} + in + merge_branches ~legacy ctxt loc btr bfr {branch} + >>=? fun (judgement, ctxt) -> return ctxt judgement + | (Prim (loc, I_SIZE, [], annot), Item_t (List_t _, rest, _)) -> + parse_var_type_annot loc annot + >>=? fun (annot, tname) -> + typed ctxt loc List_size (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_MAP, [body], annot), + Item_t (List_t (elt, _, _), starting_rest, list_annot) ) -> ( + check_kind [Seq_kind] body + >>=? fun () -> + parse_var_type_annot loc annot + >>=? fun (ret_annot, list_ty_name) -> + let elt_annot = gen_access_annot list_annot default_elt_annot in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + body + (Item_t (elt, starting_rest, elt_annot)) + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ({aft = Item_t (ret, rest, _); _} as ibody) -> + let invalid_map_body () = + serialize_stack_for_error ctxt ibody.aft + >>|? fun (aft, _ctxt) -> Invalid_map_body (loc, aft) + in + trace_eval + invalid_map_body + ( Lwt.return @@ stack_ty_eq ctxt 1 rest starting_rest + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_stacks ~legacy loc ctxt rest starting_rest + >>=? fun (rest, ctxt) -> + typed + ctxt + loc + (List_map ibody) + (Item_t + (List_t (ret, list_ty_name, has_big_map ret), rest, ret_annot)) + ) + | Typed {aft; _} -> + serialize_stack_for_error ctxt aft + >>=? fun (aft, _ctxt) -> fail (Invalid_map_body (loc, aft)) + | Failed _ -> + fail (Invalid_map_block_fail loc) ) + | ( Prim (loc, I_ITER, [body], annot), + Item_t (List_t (elt, _, _), rest, list_annot) ) -> ( + check_kind [Seq_kind] body + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + let elt_annot = gen_access_annot list_annot default_elt_annot in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + body + (Item_t (elt, rest, elt_annot)) + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ({aft; _} as ibody) -> + let invalid_iter_body () = + serialize_stack_for_error ctxt ibody.aft + >>=? fun (aft, ctxt) -> + serialize_stack_for_error ctxt rest + >>|? fun (rest, _ctxt) -> Invalid_iter_body (loc, rest, aft) + in + trace_eval + invalid_iter_body + ( Lwt.return @@ stack_ty_eq ctxt 1 aft rest + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_stacks ~legacy loc ctxt aft rest + >>=? fun (rest, ctxt) -> typed ctxt loc (List_iter ibody) rest ) + | Failed {descr} -> + typed ctxt loc (List_iter (descr rest)) rest ) + (* sets *) + | (Prim (loc, I_EMPTY_SET, [t], annot), rest) -> + Lwt.return @@ parse_comparable_ty ctxt t + >>=? fun (Ex_comparable_ty t, ctxt) -> + parse_var_type_annot loc annot + >>=? fun (annot, tname) -> + typed ctxt loc (Empty_set t) (Item_t (Set_t (t, tname), rest, annot)) + | ( Prim (loc, I_ITER, [body], annot), + Item_t (Set_t (comp_elt, _), rest, set_annot) ) -> ( + check_kind [Seq_kind] body + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + let elt_annot = gen_access_annot set_annot default_elt_annot in + let elt = ty_of_comparable_ty comp_elt in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + body + (Item_t (elt, rest, elt_annot)) + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ({aft; _} as ibody) -> + let invalid_iter_body () = + serialize_stack_for_error ctxt ibody.aft + >>=? fun (aft, ctxt) -> + serialize_stack_for_error ctxt rest + >>|? fun (rest, _ctxt) -> Invalid_iter_body (loc, rest, aft) + in + trace_eval + invalid_iter_body + ( Lwt.return @@ stack_ty_eq ctxt 1 aft rest + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_stacks ~legacy loc ctxt aft rest + >>=? fun (rest, ctxt) -> typed ctxt loc (Set_iter ibody) rest ) + | Failed {descr} -> + typed ctxt loc (Set_iter (descr rest)) rest ) + | ( Prim (loc, I_MEM, [], annot), + Item_t (v, Item_t (Set_t (elt, _), rest, _), _) ) -> + let elt = ty_of_comparable_ty elt in + parse_var_type_annot loc annot + >>=? fun (annot, tname) -> + check_item_ty ctxt elt v loc I_MEM 1 2 + >>=? fun (Eq, _, ctxt) -> + typed ctxt loc Set_mem (Item_t (Bool_t tname, rest, annot)) + | ( Prim (loc, I_UPDATE, [], annot), + Item_t + ( v, + Item_t (Bool_t _, Item_t (Set_t (elt, tname), rest, set_annot), _), + _ ) ) -> ( + match comparable_ty_of_ty v with + | None -> + unparse_ty ctxt v + >>=? fun (v, _ctxt) -> + fail (Comparable_type_expected (loc, Micheline.strip_locations v)) + | Some v -> + parse_var_annot loc annot ~default:set_annot + >>=? fun annot -> + check_item_comparable_ty elt v loc I_UPDATE 1 3 + >>=? fun (Eq, elt, ctxt) -> + typed ctxt loc Set_update (Item_t (Set_t (elt, tname), rest, annot)) ) + | (Prim (loc, I_SIZE, [], annot), Item_t (Set_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Set_size (Item_t (Nat_t None, rest, annot)) + (* maps *) + | (Prim (loc, I_EMPTY_MAP, [tk; tv], annot), stack) -> + Lwt.return @@ parse_comparable_ty ctxt tk + >>=? fun (Ex_comparable_ty tk, ctxt) -> + Lwt.return @@ parse_any_ty ctxt ~legacy tv + >>=? fun (Ex_ty tv, ctxt) -> + parse_var_type_annot loc annot + >>=? fun (annot, ty_name) -> + typed + ctxt + loc + (Empty_map (tk, tv)) + (Item_t (Map_t (tk, tv, ty_name, has_big_map tv), stack, annot)) + | ( Prim (loc, I_MAP, [body], annot), + Item_t (Map_t (ck, elt, _, _), starting_rest, _map_annot) ) -> ( + let k = ty_of_comparable_ty ck in + check_kind [Seq_kind] body + >>=? fun () -> + parse_var_type_annot loc annot + >>=? fun (ret_annot, ty_name) -> + let k_name = field_to_var_annot default_key_annot in + let e_name = field_to_var_annot default_elt_annot in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + body + (Item_t + ( Pair_t + ((k, None, k_name), (elt, None, e_name), None, has_big_map elt), + starting_rest, + None )) + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ({aft = Item_t (ret, rest, _); _} as ibody) -> + let invalid_map_body () = + serialize_stack_for_error ctxt ibody.aft + >>|? fun (aft, _ctxt) -> Invalid_map_body (loc, aft) + in + trace_eval + invalid_map_body + ( Lwt.return @@ stack_ty_eq ctxt 1 rest starting_rest + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_stacks ~legacy loc ctxt rest starting_rest + >>=? fun (rest, ctxt) -> + typed + ctxt + loc + (Map_map ibody) + (Item_t + (Map_t (ck, ret, ty_name, has_big_map ret), rest, ret_annot)) + ) + | Typed {aft; _} -> + serialize_stack_for_error ctxt aft + >>=? fun (aft, _ctxt) -> fail (Invalid_map_body (loc, aft)) + | Failed _ -> + fail (Invalid_map_block_fail loc) ) + | ( Prim (loc, I_ITER, [body], annot), + Item_t (Map_t (comp_elt, element_ty, _, _), rest, _map_annot) ) -> ( + check_kind [Seq_kind] body + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + let k_name = field_to_var_annot default_key_annot in + let e_name = field_to_var_annot default_elt_annot in + let key = ty_of_comparable_ty comp_elt in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + body + (Item_t + ( Pair_t + ( (key, None, k_name), + (element_ty, None, e_name), + None, + has_big_map element_ty ), + rest, + None )) + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ({aft; _} as ibody) -> + let invalid_iter_body () = + serialize_stack_for_error ctxt ibody.aft + >>=? fun (aft, ctxt) -> + serialize_stack_for_error ctxt rest + >>|? fun (rest, _ctxt) -> Invalid_iter_body (loc, rest, aft) + in + trace_eval + invalid_iter_body + ( Lwt.return @@ stack_ty_eq ctxt 1 aft rest + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_stacks ~legacy loc ctxt aft rest + >>=? fun (rest, ctxt) -> typed ctxt loc (Map_iter ibody) rest ) + | Failed {descr} -> + typed ctxt loc (Map_iter (descr rest)) rest ) + | ( Prim (loc, I_MEM, [], annot), + Item_t (vk, Item_t (Map_t (ck, _, _, _), rest, _), _) ) -> + let k = ty_of_comparable_ty ck in + check_item_ty ctxt vk k loc I_MEM 1 2 + >>=? fun (Eq, _, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Map_mem (Item_t (Bool_t None, rest, annot)) + | ( Prim (loc, I_GET, [], annot), + Item_t (vk, Item_t (Map_t (ck, elt, _, has_big_map), rest, _), _) ) -> + let k = ty_of_comparable_ty ck in + check_item_ty ctxt vk k loc I_GET 1 2 + >>=? fun (Eq, _, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Map_get + (Item_t (Option_t (elt, None, has_big_map), rest, annot)) + | ( Prim (loc, I_UPDATE, [], annot), + Item_t + ( vk, + Item_t + ( Option_t (vv, _, _), + Item_t (Map_t (ck, v, map_name, has_big_map), rest, map_annot), + _ ), + _ ) ) -> + let k = ty_of_comparable_ty ck in + check_item_ty ctxt vk k loc I_UPDATE 1 3 + >>=? fun (Eq, _, ctxt) -> + check_item_ty ctxt vv v loc I_UPDATE 2 3 + >>=? fun (Eq, v, ctxt) -> + parse_var_annot loc annot ~default:map_annot + >>=? fun annot -> + typed + ctxt + loc + Map_update + (Item_t (Map_t (ck, v, map_name, has_big_map), rest, annot)) + | (Prim (loc, I_SIZE, [], annot), Item_t (Map_t (_, _, _, _), rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Map_size (Item_t (Nat_t None, rest, annot)) + (* big_map *) + | (Prim (loc, I_EMPTY_BIG_MAP, [tk; tv], annot), stack) -> + Lwt.return @@ parse_comparable_ty ctxt tk + >>=? fun (Ex_comparable_ty tk, ctxt) -> + Lwt.return @@ parse_packable_ty ctxt ~legacy tv + >>=? fun (Ex_ty tv, ctxt) -> + parse_var_type_annot loc annot + >>=? fun (annot, ty_name) -> + typed + ctxt + loc + (Empty_big_map (tk, tv)) + (Item_t (Big_map_t (tk, tv, ty_name), stack, annot)) + | ( Prim (loc, I_MEM, [], annot), + Item_t (set_key, Item_t (Big_map_t (map_key, _, _), rest, _), _) ) -> + let k = ty_of_comparable_ty map_key in + check_item_ty ctxt set_key k loc I_MEM 1 2 + >>=? fun (Eq, _, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Big_map_mem (Item_t (Bool_t None, rest, annot)) + | ( Prim (loc, I_GET, [], annot), + Item_t (vk, Item_t (Big_map_t (ck, elt, _), rest, _), _) ) -> + let k = ty_of_comparable_ty ck in + check_item_ty ctxt vk k loc I_GET 1 2 + >>=? fun (Eq, _, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Big_map_get + (Item_t (Option_t (elt, None, has_big_map elt), rest, annot)) + | ( Prim (loc, I_UPDATE, [], annot), + Item_t + ( set_key, + Item_t + ( Option_t (set_value, _, _), + Item_t (Big_map_t (map_key, map_value, map_name), rest, map_annot), + _ ), + _ ) ) -> + let k = ty_of_comparable_ty map_key in + check_item_ty ctxt set_key k loc I_UPDATE 1 3 + >>=? fun (Eq, _, ctxt) -> + check_item_ty ctxt set_value map_value loc I_UPDATE 2 3 + >>=? fun (Eq, map_value, ctxt) -> + parse_var_annot loc annot ~default:map_annot + >>=? fun annot -> + typed + ctxt + loc + Big_map_update + (Item_t (Big_map_t (map_key, map_value, map_name), rest, annot)) + (* control *) + | (Seq (loc, []), stack) -> + typed ctxt loc Nop stack + | (Seq (loc, [single]), stack) -> ( + parse_instr ?type_logger tc_context ctxt ~legacy single stack + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ({aft; _} as instr) -> + let nop = {bef = aft; loc; aft; instr = Nop} in + typed ctxt loc (Seq (instr, nop)) aft + | Failed {descr; _} -> + let descr aft = + let nop = {bef = aft; loc; aft; instr = Nop} in + let descr = descr aft in + {descr with instr = Seq (descr, nop)} + in + return ctxt (Failed {descr}) ) + | (Seq (loc, hd :: tl), stack) -> ( + parse_instr ?type_logger tc_context ctxt ~legacy hd stack + >>=? fun (judgement, ctxt) -> + match judgement with + | Failed _ -> + fail (Fail_not_in_tail_position (Micheline.location hd)) + | Typed ({aft = middle; _} as ihd) -> ( + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + (Seq (-1, tl)) + middle + >>=? fun (judgement, ctxt) -> match judgement with - | Typed ({ aft = Item_t (ret, rest, _) ; _ } as ibody) -> - let invalid_map_body () = - serialize_stack_for_error ctxt ibody.aft >>|? fun (aft, _ctxt) -> - Invalid_map_body (loc, aft) in - trace_eval invalid_map_body - (Lwt.return @@ stack_ty_eq ctxt 1 rest starting_rest >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_stacks ~legacy loc ctxt rest starting_rest >>=? fun (rest, ctxt) -> - typed ctxt loc (List_map ibody) - (Item_t (List_t (ret, list_ty_name, has_big_map ret), rest, ret_annot))) - | Typed { aft ; _ } -> - serialize_stack_for_error ctxt aft >>=? fun (aft, _ctxt) -> - fail (Invalid_map_body (loc, aft)) - | Failed _ -> fail (Invalid_map_block_fail loc) - end - | Prim (loc, I_ITER, [ body ], annot), - Item_t (List_t (elt, _, _), rest, list_annot) -> - check_kind [ Seq_kind ] body >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - let elt_annot = gen_access_annot list_annot default_elt_annot in - parse_instr ?type_logger tc_context ctxt ~legacy - body (Item_t (elt, rest, elt_annot)) >>=? begin fun (judgement, ctxt) -> - match judgement with - | Typed ({ aft ; _ } as ibody) -> - let invalid_iter_body () = - serialize_stack_for_error ctxt ibody.aft >>=? fun (aft, ctxt) -> - serialize_stack_for_error ctxt rest >>|? fun (rest, _ctxt) -> - Invalid_iter_body (loc, rest, aft) in - trace_eval invalid_iter_body - (Lwt.return @@ stack_ty_eq ctxt 1 aft rest >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_stacks ~legacy loc ctxt aft rest >>=? fun (rest, ctxt) -> - typed ctxt loc (List_iter ibody) rest) - | Failed { descr } -> - typed ctxt loc (List_iter (descr rest)) rest - end - (* sets *) - | Prim (loc, I_EMPTY_SET, [ t ], annot), - rest -> - Lwt.return @@ parse_comparable_ty ctxt t >>=? fun (Ex_comparable_ty t, ctxt) -> - parse_var_type_annot loc annot >>=? fun (annot, tname) -> - typed ctxt loc (Empty_set t) (Item_t (Set_t (t, tname), rest, annot)) - | Prim (loc, I_ITER, [ body ], annot), - Item_t (Set_t (comp_elt, _), rest, set_annot) -> - check_kind [ Seq_kind ] body >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - let elt_annot = gen_access_annot set_annot default_elt_annot in - let elt = ty_of_comparable_ty comp_elt in - parse_instr ?type_logger tc_context ctxt ~legacy - body (Item_t (elt, rest, elt_annot)) >>=? begin fun (judgement, ctxt) -> - match judgement with - | Typed ({ aft ; _ } as ibody) -> - let invalid_iter_body () = - serialize_stack_for_error ctxt ibody.aft >>=? fun (aft, ctxt) -> - serialize_stack_for_error ctxt rest >>|? fun (rest, _ctxt) -> - Invalid_iter_body (loc, rest, aft) in - trace_eval invalid_iter_body - (Lwt.return @@ stack_ty_eq ctxt 1 aft rest >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_stacks ~legacy loc ctxt aft rest >>=? fun (rest, ctxt) -> - typed ctxt loc (Set_iter ibody) rest) - | Failed { descr } -> - typed ctxt loc (Set_iter (descr rest)) rest - end - | Prim (loc, I_MEM, [], annot), - Item_t (v, Item_t (Set_t (elt, _), rest, _), _) -> - let elt = ty_of_comparable_ty elt in - parse_var_type_annot loc annot >>=? fun (annot, tname) -> - check_item_ty ctxt elt v loc I_MEM 1 2 >>=? fun (Eq, _, ctxt) -> - typed ctxt loc Set_mem (Item_t (Bool_t tname, rest, annot)) - | Prim (loc, I_UPDATE, [], annot), - Item_t (v, Item_t (Bool_t _, Item_t (Set_t (elt, tname), rest, set_annot), _), _) -> - begin match comparable_ty_of_ty v with - | None -> - unparse_ty ctxt v >>=? fun (v, _ctxt) -> - fail (Comparable_type_expected (loc, Micheline.strip_locations v)) - | Some v -> - parse_var_annot loc annot ~default:set_annot >>=? fun annot -> - check_item_comparable_ty elt v loc I_UPDATE 1 3 >>=? fun (Eq, elt) -> - typed ctxt loc Set_update (Item_t (Set_t (elt, tname), rest, annot)) - end - | Prim (loc, I_SIZE, [], annot), - Item_t (Set_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Set_size (Item_t (Nat_t None, rest, annot)) - (* maps *) - | Prim (loc, I_EMPTY_MAP, [ tk ; tv ], annot), - stack -> - Lwt.return @@ parse_comparable_ty ctxt tk >>=? fun (Ex_comparable_ty tk, ctxt) -> - Lwt.return @@ parse_any_ty ctxt ~legacy tv >>=? fun (Ex_ty tv, ctxt) -> - parse_var_type_annot loc annot >>=? fun (annot, ty_name) -> - typed ctxt loc (Empty_map (tk, tv)) (Item_t (Map_t (tk, tv, ty_name, has_big_map tv), stack, annot)) - | Prim (loc, I_MAP, [ body ], annot), - Item_t (Map_t (ck, elt, _, _), starting_rest, _map_annot) -> - let k = ty_of_comparable_ty ck in - check_kind [ Seq_kind ] body >>=? fun () -> - parse_var_type_annot loc annot >>=? fun (ret_annot, ty_name) -> - let k_name = field_to_var_annot default_key_annot in - let e_name = field_to_var_annot default_elt_annot in - parse_instr ?type_logger tc_context ctxt ~legacy - body (Item_t (Pair_t ((k, None, k_name), (elt, None, e_name), None, has_big_map elt), - starting_rest, None)) >>=? begin fun (judgement, ctxt) -> - match judgement with - | Typed ({ aft = Item_t (ret, rest, _) ; _ } as ibody) -> - let invalid_map_body () = - serialize_stack_for_error ctxt ibody.aft >>|? fun (aft, _ctxt) -> - Invalid_map_body (loc, aft) in - trace_eval invalid_map_body - (Lwt.return @@ stack_ty_eq ctxt 1 rest starting_rest >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_stacks ~legacy loc ctxt rest starting_rest >>=? fun (rest, ctxt) -> - typed ctxt loc (Map_map ibody) - (Item_t (Map_t (ck, ret, ty_name, has_big_map ret), rest, ret_annot))) - | Typed { aft ; _ } -> - serialize_stack_for_error ctxt aft >>=? fun (aft, _ctxt) -> - fail (Invalid_map_body (loc, aft)) - | Failed _ -> fail (Invalid_map_block_fail loc) - end - | Prim (loc, I_ITER, [ body ], annot), - Item_t (Map_t (comp_elt, element_ty, _, _), rest, _map_annot) -> - check_kind [ Seq_kind ] body >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - let k_name = field_to_var_annot default_key_annot in - let e_name = field_to_var_annot default_elt_annot in - let key = ty_of_comparable_ty comp_elt in - parse_instr ?type_logger tc_context ctxt ~legacy body - (Item_t (Pair_t ((key, None, k_name), (element_ty, None, e_name), None, has_big_map element_ty), - rest, None)) - >>=? begin fun (judgement, ctxt) -> match judgement with - | Typed ({ aft ; _ } as ibody) -> - let invalid_iter_body () = - serialize_stack_for_error ctxt ibody.aft >>=? fun (aft, ctxt) -> - serialize_stack_for_error ctxt rest >>|? fun (rest, _ctxt) -> - Invalid_iter_body (loc, rest, aft) in - trace_eval invalid_iter_body - (Lwt.return @@ stack_ty_eq ctxt 1 aft rest >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_stacks ~legacy loc ctxt aft rest >>=? fun (rest, ctxt) -> - typed ctxt loc (Map_iter ibody) rest) - | Failed { descr } -> - typed ctxt loc (Map_iter (descr rest)) rest - end - | Prim (loc, I_MEM, [], annot), - Item_t (vk, Item_t (Map_t (ck, _, _, _), rest, _), _) -> - let k = ty_of_comparable_ty ck in - check_item_ty ctxt vk k loc I_MEM 1 2 >>=? fun (Eq, _, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Map_mem (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_GET, [], annot), - Item_t (vk, Item_t (Map_t (ck, elt, _, has_big_map), rest, _), _) -> - let k = ty_of_comparable_ty ck in - check_item_ty ctxt vk k loc I_GET 1 2 >>=? fun (Eq, _, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Map_get (Item_t (Option_t (elt, None, has_big_map), rest, annot)) - | Prim (loc, I_UPDATE, [], annot), - Item_t (vk, Item_t (Option_t (vv, _, _), - Item_t (Map_t (ck, v, map_name, has_big_map), rest, map_annot), _), _) -> - let k = ty_of_comparable_ty ck in - check_item_ty ctxt vk k loc I_UPDATE 1 3 >>=? fun (Eq, _, ctxt) -> - check_item_ty ctxt vv v loc I_UPDATE 2 3 >>=? fun (Eq, v, ctxt) -> - parse_var_annot loc annot ~default:map_annot >>=? fun annot -> - typed ctxt loc Map_update (Item_t (Map_t (ck, v, map_name, has_big_map), rest, annot)) - | Prim (loc, I_SIZE, [], annot), - Item_t (Map_t (_, _, _, _), rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Map_size (Item_t (Nat_t None, rest, annot)) - (* big_map *) - | Prim (loc, I_EMPTY_BIG_MAP, [ tk ; tv ], annot), - stack -> - Lwt.return @@ parse_comparable_ty ctxt tk >>=? fun (Ex_comparable_ty tk, ctxt) -> - Lwt.return @@ parse_packable_ty ctxt ~legacy tv >>=? fun (Ex_ty tv, ctxt) -> - parse_var_type_annot loc annot >>=? fun (annot, ty_name) -> - typed ctxt loc (Empty_big_map (tk, tv)) (Item_t (Big_map_t (tk, tv, ty_name), stack, annot)) - | Prim (loc, I_MEM, [], annot), - Item_t (set_key, Item_t (Big_map_t (map_key, _, _), rest, _), _) -> - let k = ty_of_comparable_ty map_key in - check_item_ty ctxt set_key k loc I_MEM 1 2 >>=? fun (Eq, _, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Big_map_mem (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_GET, [], annot), - Item_t (vk, Item_t (Big_map_t (ck, elt, _), rest, _), _) -> - let k = ty_of_comparable_ty ck in - check_item_ty ctxt vk k loc I_GET 1 2 >>=? fun (Eq, _, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Big_map_get (Item_t (Option_t (elt, None, has_big_map elt), rest, annot)) - | Prim (loc, I_UPDATE, [], annot), - Item_t (set_key, - Item_t (Option_t (set_value, _, _), - Item_t (Big_map_t (map_key, map_value, map_name), rest, map_annot), _), _) -> - let k = ty_of_comparable_ty map_key in - check_item_ty ctxt set_key k loc I_UPDATE 1 3 >>=? fun (Eq, _, ctxt) -> - check_item_ty ctxt set_value map_value loc I_UPDATE 2 3 >>=? fun (Eq, map_value, ctxt) -> - parse_var_annot loc annot ~default:map_annot >>=? fun annot -> - typed ctxt loc Big_map_update (Item_t (Big_map_t (map_key, map_value, map_name), rest, annot)) - (* control *) - | Seq (loc, []), - stack -> - typed ctxt loc Nop stack - | Seq (loc, [ single ]), - stack -> - parse_instr ?type_logger tc_context ctxt ~legacy single - stack >>=? begin fun (judgement, ctxt) -> - match judgement with - | Typed ({ aft ; _ } as instr) -> - let nop = { bef = aft ; loc = loc ; aft ; instr = Nop } in - typed ctxt loc (Seq (instr, nop)) aft - | Failed { descr ; _ } -> - let descr aft = - let nop = { bef = aft ; loc = loc ; aft ; instr = Nop } in - let descr = descr aft in - { descr with instr = Seq (descr, nop) } in - return ctxt (Failed { descr }) - end - | Seq (loc, hd :: tl), - stack -> - parse_instr ?type_logger tc_context ctxt ~legacy hd - stack >>=? begin fun (judgement, ctxt) -> - match judgement with - | Failed _ -> - fail (Fail_not_in_tail_position (Micheline.location hd)) - | Typed ({ aft = middle ; _ } as ihd) -> - parse_instr ?type_logger tc_context ctxt ~legacy (Seq (-1, tl)) - middle >>=? fun (judgement, ctxt) -> - match judgement with - | Failed { descr } -> - let descr ret = - { loc ; instr = Seq (ihd, descr ret) ; - bef = stack ; aft = ret } in - return ctxt (Failed { descr }) - | Typed itl -> - typed ctxt loc (Seq (ihd, itl)) itl.aft - end - | Prim (loc, I_IF, [ bt ; bf ], annot), - (Item_t (Bool_t _, rest, _) as bef) -> - check_kind [ Seq_kind ] bt >>=? fun () -> - check_kind [ Seq_kind ] bf >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - parse_instr ?type_logger tc_context ctxt ~legacy bt rest >>=? fun (btr, ctxt) -> - parse_instr ?type_logger tc_context ctxt ~legacy bf rest >>=? fun (bfr, ctxt) -> - let branch ibt ibf = - { loc ; instr = If (ibt, ibf) ; bef ; aft = ibt.aft } in - merge_branches ~legacy ctxt loc btr bfr { branch } >>=? fun (judgement, ctxt) -> - return ctxt judgement - | Prim (loc, I_LOOP, [ body ], annot), - (Item_t (Bool_t _, rest, _stack_annot) as stack) -> - check_kind [ Seq_kind ] body >>=? fun () -> - fail_unexpected_annot loc annot >>=? fun () -> - parse_instr ?type_logger tc_context ctxt ~legacy body - rest >>=? begin fun (judgement, ctxt) -> - match judgement with - | Typed ibody -> - let unmatched_branches () = - serialize_stack_for_error ctxt ibody.aft >>=? fun (aft, ctxt) -> - serialize_stack_for_error ctxt stack >>|? fun (stack, _ctxt) -> - Unmatched_branches (loc, aft, stack) in - trace_eval unmatched_branches - (Lwt.return @@ stack_ty_eq ctxt 1 ibody.aft stack >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_stacks ~legacy loc ctxt ibody.aft stack >>=? fun (_stack, ctxt) -> - typed ctxt loc (Loop ibody) rest) - | Failed { descr } -> - let ibody = descr stack in - typed ctxt loc (Loop ibody) rest - end - | Prim (loc, I_LOOP_LEFT, [ body ], annot), - (Item_t (Union_t ((tl, l_field), (tr, _), _, _), rest, union_annot) as stack) -> - check_kind [ Seq_kind ] body >>=? fun () -> - parse_var_annot loc annot >>=? fun annot -> - let l_annot = gen_access_annot union_annot l_field ~default:default_left_annot in - parse_instr ?type_logger tc_context ctxt ~legacy body - (Item_t (tl, rest, l_annot)) >>=? begin fun (judgement, ctxt) -> match judgement with - | Typed ibody -> - let unmatched_branches () = - serialize_stack_for_error ctxt ibody.aft >>=? fun (aft, ctxt) -> - serialize_stack_for_error ctxt stack >>|? fun (stack, _ctxt) -> - Unmatched_branches (loc, aft, stack) in - trace_eval unmatched_branches - (Lwt.return @@ stack_ty_eq ctxt 1 ibody.aft stack >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_stacks ~legacy loc ctxt ibody.aft stack >>=? fun (_stack, ctxt) -> - typed ctxt loc (Loop_left ibody) (Item_t (tr, rest, annot))) - | Failed { descr } -> - let ibody = descr stack in - typed ctxt loc (Loop_left ibody) (Item_t (tr, rest, annot)) - end - | Prim (loc, I_LAMBDA, [ arg ; ret ; code ], annot), - stack -> - Lwt.return @@ parse_any_ty ctxt ~legacy arg - >>=? fun (Ex_ty arg, ctxt) -> - Lwt.return @@ parse_any_ty ctxt ~legacy ret - >>=? fun (Ex_ty ret, ctxt) -> - check_kind [ Seq_kind ] code >>=? fun () -> - parse_var_annot loc annot >>=? fun annot -> - parse_returning Lambda ?type_logger ctxt ~legacy - (arg, default_arg_annot) ret code >>=? fun (lambda, ctxt) -> - typed ctxt loc (Lambda lambda) (Item_t (Lambda_t (arg, ret, None), stack, annot)) - | Prim (loc, I_EXEC, [], annot), - Item_t (arg, Item_t (Lambda_t (param, ret, _), rest, _), _) -> - check_item_ty ctxt arg param loc I_EXEC 1 2 >>=? fun (Eq, _, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Exec (Item_t (ret, rest, annot)) - | Prim (loc, I_APPLY, [], annot), - Item_t (capture, Item_t (Lambda_t (Pair_t ((capture_ty, _, _), (arg_ty, _, _), lam_annot, _), ret, _), rest, _), _) -> - Lwt.return @@ check_packable ~legacy:false loc capture_ty >>=? fun () -> - check_item_ty ctxt capture capture_ty loc I_APPLY 1 2 >>=? fun (Eq, capture_ty, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc (Apply capture_ty) (Item_t (Lambda_t (arg_ty, ret, lam_annot), rest, annot)) - | Prim (loc, I_DIP, [ code ], annot), - Item_t (v, rest, stack_annot) -> - fail_unexpected_annot loc annot >>=? fun () -> - check_kind [ Seq_kind ] code >>=? fun () -> - parse_instr ?type_logger (add_dip v stack_annot tc_context) ctxt ~legacy code - rest >>=? begin fun (judgement, ctxt) -> match judgement with - | Typed descr -> - typed ctxt loc (Dip descr) (Item_t (v, descr.aft, stack_annot)) - | Failed _ -> - fail (Fail_not_in_tail_position loc) - end - | Prim (loc, I_DIP, [n; code], result_annot), stack - when (match parse_int32 n with Ok _ -> true | Error _ -> false) -> - let rec make_proof_argument - : type tstk . int - (* -> (fbef stack_ty -> (fbef judgement * context) tzresult Lwt.t) *) - -> tc_context - -> (tstk stack_ty) - -> (tstk dipn_proof_argument) tzresult Lwt.t = - fun n inner_tc_context stk -> - match (Compare.Int.(n = 0)), stk with - true, rest -> - (parse_instr ?type_logger inner_tc_context ctxt ~legacy code - rest) >>=? begin fun (judgement, ctxt) -> match judgement with - | Typed descr -> - outer_return @@ (Dipn_proof_argument (Rest, (ctxt, descr), descr.aft)) - | Failed _ -> - fail (Fail_not_in_tail_position loc) - end - | false, Item_t (v, rest, annot) -> - make_proof_argument (n - 1) (add_dip v annot tc_context) rest - >>=? fun (Dipn_proof_argument (n', descr, aft')) -> - outer_return @@ (Dipn_proof_argument (Prefix n', descr, Item_t (v, aft', annot))) - | _, _ -> - serialize_stack_for_error ctxt stack >>=? fun (whole_stack, _ctxt) -> - fail (Bad_stack (loc, I_DIP, 1, whole_stack)) - in - Lwt.return (parse_int32 n) >>=? fun n -> - fail_unexpected_annot loc result_annot >>=? fun () -> - make_proof_argument n tc_context stack >>=? fun (Dipn_proof_argument (n', (new_ctxt, descr), aft)) -> - (* TODO: which context should be used in the next line? new_ctxt or the old ctxt? *) - typed new_ctxt loc (Dipn (n, n', descr)) aft - | Prim (loc, I_DIP, ([] | _ :: _ :: _ :: _ as l), _), _ -> - (* Technically, the arities 1 and 2 are allowed but the error only mentions 2. + | Failed {descr} -> + let descr ret = + {loc; instr = Seq (ihd, descr ret); bef = stack; aft = ret} + in + return ctxt (Failed {descr}) + | Typed itl -> + typed ctxt loc (Seq (ihd, itl)) itl.aft ) ) + | (Prim (loc, I_IF, [bt; bf], annot), (Item_t (Bool_t _, rest, _) as bef)) -> + check_kind [Seq_kind] bt + >>=? fun () -> + check_kind [Seq_kind] bf + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + parse_instr ?type_logger tc_context ctxt ~legacy bt rest + >>=? fun (btr, ctxt) -> + parse_instr ?type_logger tc_context ctxt ~legacy bf rest + >>=? fun (bfr, ctxt) -> + let branch ibt ibf = {loc; instr = If (ibt, ibf); bef; aft = ibt.aft} in + merge_branches ~legacy ctxt loc btr bfr {branch} + >>=? fun (judgement, ctxt) -> return ctxt judgement + | ( Prim (loc, I_LOOP, [body], annot), + (Item_t (Bool_t _, rest, _stack_annot) as stack) ) -> ( + check_kind [Seq_kind] body + >>=? fun () -> + fail_unexpected_annot loc annot + >>=? fun () -> + parse_instr ?type_logger tc_context ctxt ~legacy body rest + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ibody -> + let unmatched_branches () = + serialize_stack_for_error ctxt ibody.aft + >>=? fun (aft, ctxt) -> + serialize_stack_for_error ctxt stack + >>|? fun (stack, _ctxt) -> Unmatched_branches (loc, aft, stack) + in + trace_eval + unmatched_branches + ( Lwt.return @@ stack_ty_eq ctxt 1 ibody.aft stack + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_stacks ~legacy loc ctxt ibody.aft stack + >>=? fun (_stack, ctxt) -> typed ctxt loc (Loop ibody) rest ) + | Failed {descr} -> + let ibody = descr stack in + typed ctxt loc (Loop ibody) rest ) + | ( Prim (loc, I_LOOP_LEFT, [body], annot), + ( Item_t (Union_t ((tl, l_field), (tr, _), _, _), rest, union_annot) as + stack ) ) -> ( + check_kind [Seq_kind] body + >>=? fun () -> + parse_var_annot loc annot + >>=? fun annot -> + let l_annot = + gen_access_annot union_annot l_field ~default:default_left_annot + in + parse_instr + ?type_logger + tc_context + ctxt + ~legacy + body + (Item_t (tl, rest, l_annot)) + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed ibody -> + let unmatched_branches () = + serialize_stack_for_error ctxt ibody.aft + >>=? fun (aft, ctxt) -> + serialize_stack_for_error ctxt stack + >>|? fun (stack, _ctxt) -> Unmatched_branches (loc, aft, stack) + in + trace_eval + unmatched_branches + ( Lwt.return @@ stack_ty_eq ctxt 1 ibody.aft stack + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_stacks ~legacy loc ctxt ibody.aft stack + >>=? fun (_stack, ctxt) -> + typed ctxt loc (Loop_left ibody) (Item_t (tr, rest, annot)) ) + | Failed {descr} -> + let ibody = descr stack in + typed ctxt loc (Loop_left ibody) (Item_t (tr, rest, annot)) ) + | (Prim (loc, I_LAMBDA, [arg; ret; code], annot), stack) -> + Lwt.return @@ parse_any_ty ctxt ~legacy arg + >>=? fun (Ex_ty arg, ctxt) -> + Lwt.return @@ parse_any_ty ctxt ~legacy ret + >>=? fun (Ex_ty ret, ctxt) -> + check_kind [Seq_kind] code + >>=? fun () -> + parse_var_annot loc annot + >>=? fun annot -> + parse_returning + Lambda + ?type_logger + ctxt + ~legacy + (arg, default_arg_annot) + ret + code + >>=? fun (lambda, ctxt) -> + typed + ctxt + loc + (Lambda lambda) + (Item_t (Lambda_t (arg, ret, None), stack, annot)) + | ( Prim (loc, I_EXEC, [], annot), + Item_t (arg, Item_t (Lambda_t (param, ret, _), rest, _), _) ) -> + check_item_ty ctxt arg param loc I_EXEC 1 2 + >>=? fun (Eq, _, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Exec (Item_t (ret, rest, annot)) + | ( Prim (loc, I_APPLY, [], annot), + Item_t + ( capture, + Item_t + ( Lambda_t + ( Pair_t ((capture_ty, _, _), (arg_ty, _, _), lam_annot, _), + ret, + _ ), + rest, + _ ), + _ ) ) -> + Lwt.return @@ check_packable ~legacy:false loc capture_ty + >>=? fun () -> + check_item_ty ctxt capture capture_ty loc I_APPLY 1 2 + >>=? fun (Eq, capture_ty, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + (Apply capture_ty) + (Item_t (Lambda_t (arg_ty, ret, lam_annot), rest, annot)) + | (Prim (loc, I_DIP, [code], annot), Item_t (v, rest, stack_annot)) -> ( + fail_unexpected_annot loc annot + >>=? fun () -> + check_kind [Seq_kind] code + >>=? fun () -> + parse_instr + ?type_logger + (add_dip v stack_annot tc_context) + ctxt + ~legacy + code + rest + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed descr -> + typed ctxt loc (Dip descr) (Item_t (v, descr.aft, stack_annot)) + | Failed _ -> + fail (Fail_not_in_tail_position loc) ) + | (Prim (loc, I_DIP, [n; code], result_annot), stack) + when match parse_int32 n with Ok _ -> true | Error _ -> false -> + let rec make_proof_argument : + type tstk. + int + (* -> (fbef stack_ty -> (fbef judgement * context) tzresult Lwt.t) *) -> + tc_context -> + tstk stack_ty -> + tstk dipn_proof_argument tzresult Lwt.t = + fun n inner_tc_context stk -> + match (Compare.Int.(n = 0), stk) with + | (true, rest) -> ( + parse_instr ?type_logger inner_tc_context ctxt ~legacy code rest + >>=? fun (judgement, ctxt) -> + match judgement with + | Typed descr -> + outer_return + @@ Dipn_proof_argument (Rest, (ctxt, descr), descr.aft) + | Failed _ -> + fail (Fail_not_in_tail_position loc) ) + | (false, Item_t (v, rest, annot)) -> + make_proof_argument (n - 1) (add_dip v annot tc_context) rest + >>=? fun (Dipn_proof_argument (n', descr, aft')) -> + outer_return + @@ Dipn_proof_argument (Prefix n', descr, Item_t (v, aft', annot)) + | (_, _) -> + serialize_stack_for_error ctxt stack + >>=? fun (whole_stack, _ctxt) -> + fail (Bad_stack (loc, I_DIP, 1, whole_stack)) + in + Lwt.return (parse_int32 n) + >>=? fun n -> + fail_unexpected_annot loc result_annot + >>=? fun () -> + make_proof_argument n tc_context stack + >>=? fun (Dipn_proof_argument (n', (new_ctxt, descr), aft)) -> + (* TODO: which context should be used in the next line? new_ctxt or the old ctxt? *) + typed new_ctxt loc (Dipn (n, n', descr)) aft + | (Prim (loc, I_DIP, (([] | _ :: _ :: _ :: _) as l), _), _) -> + (* Technically, the arities 1 and 2 are allowed but the error only mentions 2. However, DIP {code} is equivalent to DIP 1 {code} so hinting at an arity of 2 makes sense. *) - fail (Invalid_arity (loc, I_DIP, 2, List.length l)) - | Prim (loc, I_FAILWITH, [], annot), - Item_t (v, _rest, _) -> - fail_unexpected_annot loc annot >>=? fun () -> - let descr aft = { loc ; instr = Failwith v ; bef = stack_ty ; aft } in - log_stack ctxt loc stack_ty Empty_t >>=? fun () -> - return ctxt (Failed { descr }) - (* timestamp operations *) - | Prim (loc, I_ADD, [], annot), - Item_t (Timestamp_t tname, Item_t (Int_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Add_timestamp_to_seconds - (Item_t (Timestamp_t tname, rest, annot)) - | Prim (loc, I_ADD, [], annot), - Item_t (Int_t _, Item_t (Timestamp_t tname, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Add_seconds_to_timestamp - (Item_t (Timestamp_t tname, rest, annot)) - | Prim (loc, I_SUB, [], annot), - Item_t (Timestamp_t tname, Item_t (Int_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Sub_timestamp_seconds - (Item_t (Timestamp_t tname, rest, annot)) - | Prim (loc, I_SUB, [], annot), - Item_t (Timestamp_t tn1, Item_t (Timestamp_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Diff_timestamps - (Item_t (Int_t tname, rest, annot)) - (* string operations *) - | Prim (loc, I_CONCAT, [], annot), - Item_t (String_t tn1, Item_t (String_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Concat_string_pair - (Item_t (String_t tname, rest, annot)) - | Prim (loc, I_CONCAT, [], annot), - Item_t (List_t (String_t tname, _, _), rest, list_annot) -> - parse_var_annot ~default:list_annot loc annot >>=? fun annot -> - typed ctxt loc Concat_string - (Item_t (String_t tname, rest, annot)) - | Prim (loc, I_SLICE, [], annot), - Item_t (Nat_t _, Item_t (Nat_t _, Item_t (String_t tname, rest, string_annot), _), _) -> - parse_var_annot - ~default:(gen_access_annot string_annot default_slice_annot) - loc annot >>=? fun annot -> - typed ctxt loc Slice_string - (Item_t (Option_t (String_t tname, None, false), rest, annot)) - | Prim (loc, I_SIZE, [], annot), - Item_t (String_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc String_size (Item_t (Nat_t None, rest, annot)) - (* bytes operations *) - | Prim (loc, I_CONCAT, [], annot), - Item_t (Bytes_t tn1, Item_t (Bytes_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Concat_bytes_pair - (Item_t (Bytes_t tname, rest, annot)) - | Prim (loc, I_CONCAT, [], annot), - Item_t (List_t (Bytes_t tname, _, _), rest, list_annot) -> - parse_var_annot ~default:list_annot loc annot >>=? fun annot -> - typed ctxt loc Concat_bytes - (Item_t (Bytes_t tname, rest, annot)) - | Prim (loc, I_SLICE, [], annot), - Item_t (Nat_t _, Item_t (Nat_t _, Item_t (Bytes_t tname, rest, bytes_annot), _), _) -> - parse_var_annot - ~default:(gen_access_annot bytes_annot default_slice_annot) - loc annot >>=? fun annot -> - typed ctxt loc Slice_bytes - (Item_t (Option_t (Bytes_t tname, None, false), rest, annot)) - | Prim (loc, I_SIZE, [], annot), - Item_t (Bytes_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Bytes_size (Item_t (Nat_t None, rest, annot)) - (* currency operations *) - | Prim (loc, I_ADD, [], annot), - Item_t (Mutez_t tn1, Item_t (Mutez_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Add_tez - (Item_t (Mutez_t tname, rest, annot)) - | Prim (loc, I_SUB, [], annot), - Item_t (Mutez_t tn1, Item_t (Mutez_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Sub_tez - (Item_t (Mutez_t tname, rest, annot)) - | Prim (loc, I_MUL, [], annot), - Item_t (Mutez_t tname, Item_t (Nat_t _, rest, _), _) -> (* no type name check *) - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Mul_teznat - (Item_t (Mutez_t tname, rest, annot)) - | Prim (loc, I_MUL, [], annot), - Item_t (Nat_t _, Item_t (Mutez_t tname, rest, _), _) -> (* no type name check *) - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Mul_nattez - (Item_t (Mutez_t tname, rest, annot)) - (* boolean operations *) - | Prim (loc, I_OR, [], annot), - Item_t (Bool_t tn1, Item_t (Bool_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Or - (Item_t (Bool_t tname, rest, annot)) - | Prim (loc, I_AND, [], annot), - Item_t (Bool_t tn1, Item_t (Bool_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc And - (Item_t (Bool_t tname, rest, annot)) - | Prim (loc, I_XOR, [], annot), - Item_t (Bool_t tn1, Item_t (Bool_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Xor - (Item_t (Bool_t tname, rest, annot)) - | Prim (loc, I_NOT, [], annot), - Item_t (Bool_t tname, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Not - (Item_t (Bool_t tname, rest, annot)) - (* integer operations *) - | Prim (loc, I_ABS, [], annot), - Item_t (Int_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Abs_int - (Item_t (Nat_t None, rest, annot)) - | Prim (loc, I_ISNAT, [], annot), - Item_t (Int_t _, rest, int_annot) -> - parse_var_annot loc annot ~default:int_annot >>=? fun annot -> - typed ctxt loc Is_nat - (Item_t (Option_t (Nat_t None, None, false), rest, annot)) - | Prim (loc, I_INT, [], annot), - Item_t (Nat_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Int_nat - (Item_t (Int_t None, rest, annot)) - | Prim (loc, I_NEG, [], annot), - Item_t (Int_t tname, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Neg_int - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_NEG, [], annot), - Item_t (Nat_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Neg_nat - (Item_t (Int_t None, rest, annot)) - | Prim (loc, I_ADD, [], annot), - Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Add_intint - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_ADD, [], annot), - Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Add_intnat - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_ADD, [], annot), - Item_t (Nat_t _, Item_t (Int_t tname, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Add_natint - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_ADD, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Add_natnat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_SUB, [], annot), - Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Sub_int - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_SUB, [], annot), - Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Sub_int - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_SUB, [], annot), - Item_t (Nat_t _, Item_t (Int_t tname, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Sub_int - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_SUB, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun _tname -> - typed ctxt loc Sub_int - (Item_t (Int_t None, rest, annot)) - | Prim (loc, I_MUL, [], annot), - Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Mul_intint - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_MUL, [], annot), - Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Mul_intnat - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_MUL, [], annot), - Item_t (Nat_t _, Item_t (Int_t tname, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Mul_natint - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_MUL, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Mul_natnat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_EDIV, [], annot), - Item_t (Mutez_t tname, Item_t (Nat_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Ediv_teznat - (Item_t (Option_t - (Pair_t ((Mutez_t tname, None, None), - (Mutez_t tname, None, None), None, false), - None, false), rest, annot)) - | Prim (loc, I_EDIV, [], annot), - Item_t (Mutez_t tn1, Item_t (Mutez_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Ediv_tez - (Item_t (Option_t (Pair_t ((Nat_t None, None, None), - (Mutez_t tname, None, None), None, false), - None, false), rest, annot)) - | Prim (loc, I_EDIV, [], annot), - Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Ediv_intint - (Item_t (Option_t - (Pair_t ((Int_t tname, None, None), - (Nat_t None, None, None), None, false), - None, false), rest, annot)) - | Prim (loc, I_EDIV, [], annot), - Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Ediv_intnat - (Item_t (Option_t - (Pair_t ((Int_t tname, None, None), - (Nat_t None, None, None), None, false), - None, false), rest, annot)) - | Prim (loc, I_EDIV, [], annot), - Item_t (Nat_t tname, Item_t (Int_t _, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Ediv_natint - (Item_t (Option_t (Pair_t ((Int_t None, None, None), - (Nat_t tname, None, None), None, false), - None, false), rest, annot)) - | Prim (loc, I_EDIV, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Ediv_natnat - (Item_t (Option_t (Pair_t ((Nat_t tname, None, None), - (Nat_t tname, None, None), None, false), - None, false), rest, annot)) - | Prim (loc, I_LSL, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Lsl_nat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_LSR, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Lsr_nat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_OR, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Or_nat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_AND, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc And_nat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_AND, [], annot), - Item_t (Int_t _, Item_t (Nat_t tname, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc And_int_nat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_XOR, [], annot), - Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - Lwt.return @@ merge_type_annot ~legacy tn1 tn2 >>=? fun tname -> - typed ctxt loc Xor_nat - (Item_t (Nat_t tname, rest, annot)) - | Prim (loc, I_NOT, [], annot), - Item_t (Int_t tname, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Not_int - (Item_t (Int_t tname, rest, annot)) - | Prim (loc, I_NOT, [], annot), - Item_t (Nat_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Not_nat - (Item_t (Int_t None, rest, annot)) - (* comparison *) - | Prim (loc, I_COMPARE, [], annot), - Item_t (t1, Item_t (t2, rest, _), _) -> - parse_var_annot loc annot >>=? fun annot -> - check_item_ty ctxt t1 t2 loc I_COMPARE 1 2 >>=? fun (Eq, t, ctxt) -> - begin match comparable_ty_of_ty t with - | None -> - Lwt.return (serialize_ty_for_error ctxt t) >>=? fun (t, _ctxt) -> - fail (Comparable_type_expected (loc, t)) - | Some key -> - typed ctxt loc (Compare key) - (Item_t (Int_t None, rest, annot)) - end - (* comparators *) - | Prim (loc, I_EQ, [], annot), - Item_t (Int_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Eq - (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_NEQ, [], annot), - Item_t (Int_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Neq - (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_LT, [], annot), - Item_t (Int_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Lt - (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_GT, [], annot), - Item_t (Int_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Gt - (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_LE, [], annot), - Item_t (Int_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Le - (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_GE, [], annot), - Item_t (Int_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Ge - (Item_t (Bool_t None, rest, annot)) - (* annotations *) - | Prim (loc, I_CAST, [ cast_t ], annot), - Item_t (t, stack, item_annot) -> - parse_var_annot loc annot ~default:item_annot >>=? fun annot -> - (Lwt.return @@ parse_any_ty ctxt ~legacy cast_t) - >>=? fun (Ex_ty cast_t, ctxt) -> - Lwt.return @@ ty_eq ctxt cast_t t >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_types ~legacy ctxt loc cast_t t >>=? fun (_, ctxt) -> - typed ctxt loc Nop (Item_t (cast_t, stack, annot)) - | Prim (loc, I_RENAME, [], annot), - Item_t (t, stack, _) -> - parse_var_annot loc annot >>=? fun annot -> (* can erase annot *) - typed ctxt loc Nop (Item_t (t, stack, annot)) - (* packing *) - | Prim (loc, I_PACK, [], annot), - Item_t (t, rest, unpacked_annot) -> - Lwt.return (check_packable ~legacy:true (* allow to pack contracts for hash/signature checks *) loc t) >>=? fun () -> - parse_var_annot loc annot ~default:(gen_access_annot unpacked_annot default_pack_annot) - >>=? fun annot -> - typed ctxt loc (Pack t) - (Item_t (Bytes_t None, rest, annot)) - | Prim (loc, I_UNPACK, [ ty ], annot), - Item_t (Bytes_t _, rest, packed_annot) -> - Lwt.return @@ parse_packable_ty ctxt ~legacy ty >>=? fun (Ex_ty t, ctxt) -> - parse_var_type_annot loc annot >>=? fun (annot, ty_name) -> - let annot = default_annot annot ~default:(gen_access_annot packed_annot default_unpack_annot) in - typed ctxt loc (Unpack t) (Item_t (Option_t (t, ty_name, false (* cannot unpack big_maps *)), rest, annot)) - (* protocol *) - | Prim (loc, I_ADDRESS, [], annot), - Item_t (Contract_t _, rest, contract_annot) -> - parse_var_annot loc annot ~default:(gen_access_annot contract_annot default_addr_annot) - >>=? fun annot -> - typed ctxt loc Address - (Item_t (Address_t None, rest, annot)) - | Prim (loc, I_CONTRACT, [ ty ], annot), - Item_t (Address_t _, rest, addr_annot) -> - Lwt.return @@ parse_parameter_ty ctxt ~legacy ty >>=? fun (Ex_ty t, ctxt) -> - parse_entrypoint_annot loc annot ~default:(gen_access_annot addr_annot default_contract_annot) - >>=? fun (annot, entrypoint) -> - Lwt.return @@ begin match entrypoint with - | None -> Ok "default" - | Some (`Field_annot "default") -> error (Unexpected_annotation loc) - | Some (`Field_annot entrypoint) -> - if Compare.Int.(String.length entrypoint > 31) then - error (Entrypoint_name_too_long entrypoint) - else Ok entrypoint - end >>=? fun entrypoint -> - typed ctxt loc (Contract (t, entrypoint)) - (Item_t (Option_t (Contract_t (t, None), None, false), rest, annot)) - | Prim (loc, I_TRANSFER_TOKENS, [], annot), - Item_t (p, Item_t - (Mutez_t _, Item_t - (Contract_t (cp, _), rest, _), _), _) -> - check_item_ty ctxt p cp loc I_TRANSFER_TOKENS 1 4 >>=? fun (Eq, _, ctxt) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Transfer_tokens (Item_t (Operation_t None, rest, annot)) - | Prim (loc, I_SET_DELEGATE, [], annot), - Item_t (Option_t (Key_hash_t _, _, _), rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Set_delegate (Item_t (Operation_t None, rest, annot)) - | Prim (loc, I_CREATE_ACCOUNT, [], annot), + fail (Invalid_arity (loc, I_DIP, 2, List.length l)) + | (Prim (loc, I_FAILWITH, [], annot), Item_t (v, _rest, _)) -> + fail_unexpected_annot loc annot + >>=? fun () -> + let descr aft = {loc; instr = Failwith v; bef = stack_ty; aft} in + log_stack ctxt loc stack_ty Empty_t + >>=? fun () -> return ctxt (Failed {descr}) + (* timestamp operations *) + | ( Prim (loc, I_ADD, [], annot), + Item_t (Timestamp_t tname, Item_t (Int_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Add_timestamp_to_seconds + (Item_t (Timestamp_t tname, rest, annot)) + | ( Prim (loc, I_ADD, [], annot), + Item_t (Int_t _, Item_t (Timestamp_t tname, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Add_seconds_to_timestamp + (Item_t (Timestamp_t tname, rest, annot)) + | ( Prim (loc, I_SUB, [], annot), + Item_t (Timestamp_t tname, Item_t (Int_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Sub_timestamp_seconds + (Item_t (Timestamp_t tname, rest, annot)) + | ( Prim (loc, I_SUB, [], annot), + Item_t (Timestamp_t tn1, Item_t (Timestamp_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Diff_timestamps (Item_t (Int_t tname, rest, annot)) + (* string operations *) + | ( Prim (loc, I_CONCAT, [], annot), + Item_t (String_t tn1, Item_t (String_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Concat_string_pair (Item_t (String_t tname, rest, annot)) + | ( Prim (loc, I_CONCAT, [], annot), + Item_t (List_t (String_t tname, _, _), rest, list_annot) ) -> + parse_var_annot ~default:list_annot loc annot + >>=? fun annot -> + typed ctxt loc Concat_string (Item_t (String_t tname, rest, annot)) + | ( Prim (loc, I_SLICE, [], annot), Item_t - (Key_hash_t _, Item_t - (Option_t (Key_hash_t _, _, _), Item_t - (Bool_t _, Item_t - (Mutez_t _, rest, _), _), _), _) -> - if legacy - then begin - (* For existing contracts, this instruction is still allowed *) - parse_two_var_annot loc annot >>=? fun (op_annot, addr_annot) -> - typed ctxt loc Create_account - (Item_t (Operation_t None, Item_t (Address_t None, rest, addr_annot), op_annot)) - end - else - (* For new contracts this instruction is not allowed anymore *) - fail (Deprecated_instruction I_CREATE_ACCOUNT) - | Prim (loc, I_IMPLICIT_ACCOUNT, [], annot), - Item_t (Key_hash_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Implicit_account - (Item_t (Contract_t (Unit_t None, None), rest, annot)) - | Prim (loc, I_CREATE_CONTRACT, [ (Seq _ as code)], annot), + ( Nat_t _, + Item_t (Nat_t _, Item_t (String_t tname, rest, string_annot), _), + _ ) ) -> + parse_var_annot + ~default:(gen_access_annot string_annot default_slice_annot) + loc + annot + >>=? fun annot -> + typed + ctxt + loc + Slice_string + (Item_t (Option_t (String_t tname, None, false), rest, annot)) + | (Prim (loc, I_SIZE, [], annot), Item_t (String_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc String_size (Item_t (Nat_t None, rest, annot)) + (* bytes operations *) + | ( Prim (loc, I_CONCAT, [], annot), + Item_t (Bytes_t tn1, Item_t (Bytes_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Concat_bytes_pair (Item_t (Bytes_t tname, rest, annot)) + | ( Prim (loc, I_CONCAT, [], annot), + Item_t (List_t (Bytes_t tname, _, _), rest, list_annot) ) -> + parse_var_annot ~default:list_annot loc annot + >>=? fun annot -> + typed ctxt loc Concat_bytes (Item_t (Bytes_t tname, rest, annot)) + | ( Prim (loc, I_SLICE, [], annot), Item_t - (Key_hash_t _, Item_t - (Option_t (Key_hash_t _, _, _), Item_t - (Bool_t _, Item_t - (Bool_t _, Item_t - (Mutez_t _, Item_t - (ginit, rest, _), _), _), _), _), _) -> - if legacy then begin - (* For existing contracts, this instruction is still allowed *) - parse_two_var_annot loc annot >>=? fun (op_annot, addr_annot) -> - let cannonical_code = fst @@ Micheline.extract_locations code in - Lwt.return @@ parse_toplevel ~legacy cannonical_code >>=? fun (arg_type, storage_type, code_field, root_name) -> - trace - (Ill_formed_type (Some "parameter", cannonical_code, location arg_type)) - (Lwt.return @@ parse_parameter_ty ctxt ~legacy arg_type) - >>=? fun (Ex_ty arg_type, ctxt) -> - begin - if legacy then Error_monad.return () else - Lwt.return (well_formed_entrypoints ~root_name arg_type) - end >>=? fun () -> - trace - (Ill_formed_type (Some "storage", cannonical_code, location storage_type)) - (Lwt.return @@ parse_storage_ty ctxt ~legacy storage_type) - >>=? fun (Ex_ty storage_type, ctxt) -> - let arg_annot = default_annot (type_to_var_annot (name_of_ty arg_type)) - ~default:default_param_annot in - let storage_annot = default_annot (type_to_var_annot (name_of_ty storage_type)) - ~default:default_storage_annot in - let arg_type_full = Pair_t ((arg_type, None, arg_annot), - (storage_type, None, storage_annot), None, - has_big_map arg_type || has_big_map storage_type) in - let ret_type_full = - Pair_t ((List_t (Operation_t None, None, false), None, None), - (storage_type, None, None), None, - has_big_map storage_type) in - trace - (Ill_typed_contract (cannonical_code, [])) - (parse_returning (Toplevel { storage_type ; param_type = arg_type ; root_name ; - legacy_create_contract_literal = true }) - ctxt ~legacy ?type_logger (arg_type_full, None) ret_type_full code_field) >>=? - fun (Lam ({ bef = Item_t (arg, Empty_t, _) ; - aft = Item_t (ret, Empty_t, _) ; _ }, _) as lambda, ctxt) -> - Lwt.return @@ ty_eq ctxt arg arg_type_full >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_types ~legacy ctxt loc arg arg_type_full >>=? fun (_, ctxt) -> - Lwt.return @@ ty_eq ctxt ret ret_type_full >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_types ~legacy ctxt loc ret ret_type_full >>=? fun (_, ctxt) -> - Lwt.return @@ ty_eq ctxt storage_type ginit >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_types ~legacy ctxt loc storage_type ginit >>=? fun (_, ctxt) -> - typed ctxt loc (Create_contract (storage_type, arg_type, lambda, root_name)) - (Item_t (Operation_t None, Item_t (Address_t None, rest, addr_annot), op_annot)) - end - else - (* For new contracts this instruction is not allowed anymore *) - fail (Deprecated_instruction I_CREATE_CONTRACT) - | Prim (loc, I_CREATE_CONTRACT, [ (Seq _ as code)], annot), - (* Removed the instruction's arguments manager, spendable and delegatable *) + ( Nat_t _, + Item_t (Nat_t _, Item_t (Bytes_t tname, rest, bytes_annot), _), + _ ) ) -> + parse_var_annot + ~default:(gen_access_annot bytes_annot default_slice_annot) + loc + annot + >>=? fun annot -> + typed + ctxt + loc + Slice_bytes + (Item_t (Option_t (Bytes_t tname, None, false), rest, annot)) + | (Prim (loc, I_SIZE, [], annot), Item_t (Bytes_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Bytes_size (Item_t (Nat_t None, rest, annot)) + (* currency operations *) + | ( Prim (loc, I_ADD, [], annot), + Item_t (Mutez_t tn1, Item_t (Mutez_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Add_tez (Item_t (Mutez_t tname, rest, annot)) + | ( Prim (loc, I_SUB, [], annot), + Item_t (Mutez_t tn1, Item_t (Mutez_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Sub_tez (Item_t (Mutez_t tname, rest, annot)) + | ( Prim (loc, I_MUL, [], annot), + Item_t (Mutez_t tname, Item_t (Nat_t _, rest, _), _) ) -> + (* no type name check *) + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Mul_teznat (Item_t (Mutez_t tname, rest, annot)) + | ( Prim (loc, I_MUL, [], annot), + Item_t (Nat_t _, Item_t (Mutez_t tname, rest, _), _) ) -> + (* no type name check *) + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Mul_nattez (Item_t (Mutez_t tname, rest, annot)) + (* boolean operations *) + | ( Prim (loc, I_OR, [], annot), + Item_t (Bool_t tn1, Item_t (Bool_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> typed ctxt loc Or (Item_t (Bool_t tname, rest, annot)) + | ( Prim (loc, I_AND, [], annot), + Item_t (Bool_t tn1, Item_t (Bool_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> typed ctxt loc And (Item_t (Bool_t tname, rest, annot)) + | ( Prim (loc, I_XOR, [], annot), + Item_t (Bool_t tn1, Item_t (Bool_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> typed ctxt loc Xor (Item_t (Bool_t tname, rest, annot)) + | (Prim (loc, I_NOT, [], annot), Item_t (Bool_t tname, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Not (Item_t (Bool_t tname, rest, annot)) + (* integer operations *) + | (Prim (loc, I_ABS, [], annot), Item_t (Int_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Abs_int (Item_t (Nat_t None, rest, annot)) + | (Prim (loc, I_ISNAT, [], annot), Item_t (Int_t _, rest, int_annot)) -> + parse_var_annot loc annot ~default:int_annot + >>=? fun annot -> + typed + ctxt + loc + Is_nat + (Item_t (Option_t (Nat_t None, None, false), rest, annot)) + | (Prim (loc, I_INT, [], annot), Item_t (Nat_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Int_nat (Item_t (Int_t None, rest, annot)) + | (Prim (loc, I_NEG, [], annot), Item_t (Int_t tname, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Neg_int (Item_t (Int_t tname, rest, annot)) + | (Prim (loc, I_NEG, [], annot), Item_t (Nat_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Neg_nat (Item_t (Int_t None, rest, annot)) + | ( Prim (loc, I_ADD, [], annot), + Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Add_intint (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_ADD, [], annot), + Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Add_intnat (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_ADD, [], annot), + Item_t (Nat_t _, Item_t (Int_t tname, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Add_natint (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_ADD, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Add_natnat (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_SUB, [], annot), + Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Sub_int (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_SUB, [], annot), + Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Sub_int (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_SUB, [], annot), + Item_t (Nat_t _, Item_t (Int_t tname, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Sub_int (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_SUB, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun _tname -> + typed ctxt loc Sub_int (Item_t (Int_t None, rest, annot)) + | ( Prim (loc, I_MUL, [], annot), + Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Mul_intint (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_MUL, [], annot), + Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Mul_intnat (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_MUL, [], annot), + Item_t (Nat_t _, Item_t (Int_t tname, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Mul_natint (Item_t (Int_t tname, rest, annot)) + | ( Prim (loc, I_MUL, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Mul_natnat (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_EDIV, [], annot), + Item_t (Mutez_t tname, Item_t (Nat_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Ediv_teznat + (Item_t + ( Option_t + ( Pair_t + ( (Mutez_t tname, None, None), + (Mutez_t tname, None, None), + None, + false ), + None, + false ), + rest, + annot )) + | ( Prim (loc, I_EDIV, [], annot), + Item_t (Mutez_t tn1, Item_t (Mutez_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed + ctxt + loc + Ediv_tez + (Item_t + ( Option_t + ( Pair_t + ( (Nat_t None, None, None), + (Mutez_t tname, None, None), + None, + false ), + None, + false ), + rest, + annot )) + | ( Prim (loc, I_EDIV, [], annot), + Item_t (Int_t tn1, Item_t (Int_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed + ctxt + loc + Ediv_intint + (Item_t + ( Option_t + ( Pair_t + ( (Int_t tname, None, None), + (Nat_t None, None, None), + None, + false ), + None, + false ), + rest, + annot )) + | ( Prim (loc, I_EDIV, [], annot), + Item_t (Int_t tname, Item_t (Nat_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Ediv_intnat + (Item_t + ( Option_t + ( Pair_t + ( (Int_t tname, None, None), + (Nat_t None, None, None), + None, + false ), + None, + false ), + rest, + annot )) + | ( Prim (loc, I_EDIV, [], annot), + Item_t (Nat_t tname, Item_t (Int_t _, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Ediv_natint + (Item_t + ( Option_t + ( Pair_t + ( (Int_t None, None, None), + (Nat_t tname, None, None), + None, + false ), + None, + false ), + rest, + annot )) + | ( Prim (loc, I_EDIV, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed + ctxt + loc + Ediv_natnat + (Item_t + ( Option_t + ( Pair_t + ( (Nat_t tname, None, None), + (Nat_t tname, None, None), + None, + false ), + None, + false ), + rest, + annot )) + | ( Prim (loc, I_LSL, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Lsl_nat (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_LSR, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Lsr_nat (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_OR, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Or_nat (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_AND, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc And_nat (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_AND, [], annot), + Item_t (Int_t _, Item_t (Nat_t tname, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc And_int_nat (Item_t (Nat_t tname, rest, annot)) + | ( Prim (loc, I_XOR, [], annot), + Item_t (Nat_t tn1, Item_t (Nat_t tn2, rest, _), _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + Lwt.return @@ merge_type_annot ~legacy tn1 tn2 + >>=? fun tname -> + typed ctxt loc Xor_nat (Item_t (Nat_t tname, rest, annot)) + | (Prim (loc, I_NOT, [], annot), Item_t (Int_t tname, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Not_int (Item_t (Int_t tname, rest, annot)) + | (Prim (loc, I_NOT, [], annot), Item_t (Nat_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Not_nat (Item_t (Int_t None, rest, annot)) + (* comparison *) + | (Prim (loc, I_COMPARE, [], annot), Item_t (t1, Item_t (t2, rest, _), _)) + -> ( + parse_var_annot loc annot + >>=? fun annot -> + check_item_ty ctxt t1 t2 loc I_COMPARE 1 2 + >>=? fun (Eq, t, ctxt) -> + match comparable_ty_of_ty t with + | None -> + Lwt.return (serialize_ty_for_error ctxt t) + >>=? fun (t, _ctxt) -> fail (Comparable_type_expected (loc, t)) + | Some key -> + typed ctxt loc (Compare key) (Item_t (Int_t None, rest, annot)) ) + (* comparators *) + | (Prim (loc, I_EQ, [], annot), Item_t (Int_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Eq (Item_t (Bool_t None, rest, annot)) + | (Prim (loc, I_NEQ, [], annot), Item_t (Int_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Neq (Item_t (Bool_t None, rest, annot)) + | (Prim (loc, I_LT, [], annot), Item_t (Int_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Lt (Item_t (Bool_t None, rest, annot)) + | (Prim (loc, I_GT, [], annot), Item_t (Int_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Gt (Item_t (Bool_t None, rest, annot)) + | (Prim (loc, I_LE, [], annot), Item_t (Int_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Le (Item_t (Bool_t None, rest, annot)) + | (Prim (loc, I_GE, [], annot), Item_t (Int_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> typed ctxt loc Ge (Item_t (Bool_t None, rest, annot)) + (* annotations *) + | (Prim (loc, I_CAST, [cast_t], annot), Item_t (t, stack, item_annot)) -> + parse_var_annot loc annot ~default:item_annot + >>=? fun annot -> + Lwt.return @@ parse_any_ty ctxt ~legacy cast_t + >>=? fun (Ex_ty cast_t, ctxt) -> + Lwt.return @@ ty_eq ctxt cast_t t + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_types ~legacy ctxt loc cast_t t + >>=? fun (_, ctxt) -> typed ctxt loc Nop (Item_t (cast_t, stack, annot)) + | (Prim (loc, I_RENAME, [], annot), Item_t (t, stack, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + (* can erase annot *) + typed ctxt loc Nop (Item_t (t, stack, annot)) + (* packing *) + | (Prim (loc, I_PACK, [], annot), Item_t (t, rest, unpacked_annot)) -> + Lwt.return + (check_packable + ~legacy:true + (* allow to pack contracts for hash/signature checks *) loc + t) + >>=? fun () -> + parse_var_annot + loc + annot + ~default:(gen_access_annot unpacked_annot default_pack_annot) + >>=? fun annot -> + typed ctxt loc (Pack t) (Item_t (Bytes_t None, rest, annot)) + | (Prim (loc, I_UNPACK, [ty], annot), Item_t (Bytes_t _, rest, packed_annot)) + -> + Lwt.return @@ parse_packable_ty ctxt ~legacy ty + >>=? fun (Ex_ty t, ctxt) -> + parse_var_type_annot loc annot + >>=? fun (annot, ty_name) -> + let annot = + default_annot + annot + ~default:(gen_access_annot packed_annot default_unpack_annot) + in + typed + ctxt + loc + (Unpack t) + (Item_t + ( Option_t (t, ty_name, false (* cannot unpack big_maps *)), + rest, + annot )) + (* protocol *) + | ( Prim (loc, I_ADDRESS, [], annot), + Item_t (Contract_t _, rest, contract_annot) ) -> + parse_var_annot + loc + annot + ~default:(gen_access_annot contract_annot default_addr_annot) + >>=? fun annot -> + typed ctxt loc Address (Item_t (Address_t None, rest, annot)) + | ( Prim (loc, I_CONTRACT, [ty], annot), + Item_t (Address_t _, rest, addr_annot) ) -> + Lwt.return @@ parse_parameter_ty ctxt ~legacy ty + >>=? fun (Ex_ty t, ctxt) -> + parse_entrypoint_annot + loc + annot + ~default:(gen_access_annot addr_annot default_contract_annot) + >>=? fun (annot, entrypoint) -> + ( Lwt.return + @@ + match entrypoint with + | None -> + Ok "default" + | Some (`Field_annot "default") -> + error (Unexpected_annotation loc) + | Some (`Field_annot entrypoint) -> + if Compare.Int.(String.length entrypoint > 31) then + error (Entrypoint_name_too_long entrypoint) + else Ok entrypoint ) + >>=? fun entrypoint -> + typed + ctxt + loc + (Contract (t, entrypoint)) + (Item_t (Option_t (Contract_t (t, None), None, false), rest, annot)) + | ( Prim (loc, I_TRANSFER_TOKENS, [], annot), + Item_t (p, Item_t (Mutez_t _, Item_t (Contract_t (cp, _), rest, _), _), _) + ) -> + check_item_ty ctxt p cp loc I_TRANSFER_TOKENS 1 4 + >>=? fun (Eq, _, ctxt) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Transfer_tokens (Item_t (Operation_t None, rest, annot)) + | ( Prim (loc, I_SET_DELEGATE, [], annot), + Item_t (Option_t (Key_hash_t _, _, _), rest, _) ) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Set_delegate (Item_t (Operation_t None, rest, annot)) + | ( Prim (loc, I_CREATE_ACCOUNT, [], annot), Item_t - (Option_t (Key_hash_t _, _, _), Item_t - (Mutez_t _, Item_t - (ginit, rest, _), _), _) -> - parse_two_var_annot loc annot >>=? fun (op_annot, addr_annot) -> + ( Key_hash_t _, + Item_t + ( Option_t (Key_hash_t _, _, _), + Item_t (Bool_t _, Item_t (Mutez_t _, rest, _), _), + _ ), + _ ) ) -> + if legacy then + (* For existing contracts, this instruction is still allowed *) + parse_two_var_annot loc annot + >>=? fun (op_annot, addr_annot) -> + typed + ctxt + loc + Create_account + (Item_t + ( Operation_t None, + Item_t (Address_t None, rest, addr_annot), + op_annot )) + else + (* For new contracts this instruction is not allowed anymore *) + fail (Deprecated_instruction I_CREATE_ACCOUNT) + | (Prim (loc, I_IMPLICIT_ACCOUNT, [], annot), Item_t (Key_hash_t _, rest, _)) + -> + parse_var_annot loc annot + >>=? fun annot -> + typed + ctxt + loc + Implicit_account + (Item_t (Contract_t (Unit_t None, None), rest, annot)) + | ( Prim (loc, I_CREATE_CONTRACT, [(Seq _ as code)], annot), + Item_t + ( Key_hash_t _, + Item_t + ( Option_t (Key_hash_t _, _, _), + Item_t + ( Bool_t _, + Item_t + ( Bool_t _, + Item_t (Mutez_t _, Item_t (ginit, rest, _), _), + _ ), + _ ), + _ ), + _ ) ) -> + if legacy then + (* For existing contracts, this instruction is still allowed *) + parse_two_var_annot loc annot + >>=? fun (op_annot, addr_annot) -> let cannonical_code = fst @@ Micheline.extract_locations code in - Lwt.return @@ parse_toplevel ~legacy cannonical_code >>=? fun (arg_type, storage_type, code_field, root_name) -> + Lwt.return @@ parse_toplevel ~legacy cannonical_code + >>=? fun (arg_type, storage_type, code_field, root_name) -> trace - (Ill_formed_type (Some "parameter", cannonical_code, location arg_type)) + (Ill_formed_type + (Some "parameter", cannonical_code, location arg_type)) (Lwt.return @@ parse_parameter_ty ctxt ~legacy arg_type) >>=? fun (Ex_ty arg_type, ctxt) -> - begin - if legacy then Error_monad.return () else - Lwt.return (well_formed_entrypoints ~root_name arg_type) - end >>=? fun () -> + ( if legacy then Error_monad.return () + else Lwt.return (well_formed_entrypoints ~root_name arg_type) ) + >>=? fun () -> trace - (Ill_formed_type (Some "storage", cannonical_code, location storage_type)) + (Ill_formed_type + (Some "storage", cannonical_code, location storage_type)) (Lwt.return @@ parse_storage_ty ctxt ~legacy storage_type) >>=? fun (Ex_ty storage_type, ctxt) -> - let arg_annot = default_annot (type_to_var_annot (name_of_ty arg_type)) - ~default:default_param_annot in - let storage_annot = default_annot (type_to_var_annot (name_of_ty storage_type)) - ~default:default_storage_annot in - let arg_type_full = Pair_t ((arg_type, None, arg_annot), - (storage_type, None, storage_annot), None, - has_big_map arg_type || has_big_map storage_type) in + let arg_annot = + default_annot + (type_to_var_annot (name_of_ty arg_type)) + ~default:default_param_annot + in + let storage_annot = + default_annot + (type_to_var_annot (name_of_ty storage_type)) + ~default:default_storage_annot + in + let arg_type_full = + Pair_t + ( (arg_type, None, arg_annot), + (storage_type, None, storage_annot), + None, + has_big_map arg_type || has_big_map storage_type ) + in let ret_type_full = - Pair_t ((List_t (Operation_t None, None, false), None, None), - (storage_type, None, None), None, has_big_map storage_type) in + Pair_t + ( (List_t (Operation_t None, None, false), None, None), + (storage_type, None, None), + None, + has_big_map storage_type ) + in trace (Ill_typed_contract (cannonical_code, [])) - (parse_returning (Toplevel { storage_type ; param_type = arg_type ; root_name ; - legacy_create_contract_literal = false }) - ctxt ~legacy ?type_logger (arg_type_full, None) ret_type_full code_field) >>=? - fun (Lam ({ bef = Item_t (arg, Empty_t, _) ; - aft = Item_t (ret, Empty_t, _) ; _ }, _) as lambda, ctxt) -> - Lwt.return @@ ty_eq ctxt arg arg_type_full >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_types ~legacy ctxt loc arg arg_type_full >>=? fun (_, ctxt) -> - Lwt.return @@ ty_eq ctxt ret ret_type_full >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_types ~legacy ctxt loc ret ret_type_full >>=? fun (_, ctxt) -> - Lwt.return @@ ty_eq ctxt storage_type ginit >>=? fun (Eq, ctxt) -> - Lwt.return @@ merge_types ~legacy ctxt loc storage_type ginit >>=? fun (_, ctxt) -> - typed ctxt loc (Create_contract_2 (storage_type, arg_type, lambda, root_name)) - (Item_t (Operation_t None, Item_t (Address_t None, rest, addr_annot), op_annot)) - | Prim (loc, I_NOW, [], annot), - stack -> - parse_var_annot loc annot ~default:default_now_annot >>=? fun annot -> - typed ctxt loc Now (Item_t (Timestamp_t None, stack, annot)) - | Prim (loc, I_AMOUNT, [], annot), - stack -> - parse_var_annot loc annot ~default:default_amount_annot >>=? fun annot -> - typed ctxt loc Amount - (Item_t (Mutez_t None, stack, annot)) - | Prim (loc, I_CHAIN_ID, [], annot), - stack -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc ChainId - (Item_t (Chain_id_t None, stack, annot)) - | Prim (loc, I_BALANCE, [], annot), - stack -> - parse_var_annot loc annot ~default:default_balance_annot >>=? fun annot -> - typed ctxt loc Balance - (Item_t (Mutez_t None, stack, annot)) - | Prim (loc, I_HASH_KEY, [], annot), - Item_t (Key_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Hash_key - (Item_t (Key_hash_t None, rest, annot)) - | Prim (loc, I_CHECK_SIGNATURE, [], annot), - Item_t (Key_t _, Item_t (Signature_t _, Item_t (Bytes_t _, rest, _), _), _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Check_signature - (Item_t (Bool_t None, rest, annot)) - | Prim (loc, I_BLAKE2B, [], annot), - Item_t (Bytes_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Blake2b - (Item_t (Bytes_t None, rest, annot)) - | Prim (loc, I_SHA256, [], annot), - Item_t (Bytes_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Sha256 - (Item_t (Bytes_t None, rest, annot)) - | Prim (loc, I_SHA512, [], annot), - Item_t (Bytes_t _, rest, _) -> - parse_var_annot loc annot >>=? fun annot -> - typed ctxt loc Sha512 - (Item_t (Bytes_t None, rest, annot)) - | Prim (loc, I_STEPS_TO_QUOTA, [], annot), - stack -> - if legacy - then begin - (* For existing contracts, this instruction is still allowed *) - parse_var_annot loc annot ~default:default_steps_annot >>=? fun annot -> - typed ctxt loc Steps_to_quota - (Item_t (Nat_t None, stack, annot)) - end - else - (* For new contracts this instruction is not allowed anymore *) - fail (Deprecated_instruction I_STEPS_TO_QUOTA) - | Prim (loc, I_SOURCE, [], annot), - stack -> - parse_var_annot loc annot ~default:default_source_annot >>=? fun annot -> - typed ctxt loc Source - (Item_t (Address_t None, stack, annot)) - | Prim (loc, I_SENDER, [], annot), - stack -> - parse_var_annot loc annot ~default:default_sender_annot >>=? fun annot -> - typed ctxt loc Sender - (Item_t (Address_t None, stack, annot)) - | Prim (loc, I_SELF, [], annot), - stack -> - parse_entrypoint_annot loc annot ~default:default_self_annot - >>=? fun (annot, entrypoint) -> - let entrypoint = Option.unopt_map ~f:(fun (`Field_annot annot) -> annot) ~default:"default" entrypoint in - let rec get_toplevel_type : tc_context -> (bef judgement * context) tzresult Lwt.t = function - | Lambda -> fail (Self_in_lambda loc) - | Dip (_, prev) -> get_toplevel_type prev - | Toplevel { param_type ; root_name ; legacy_create_contract_literal = false} -> - Lwt.return (find_entrypoint param_type ~root_name entrypoint) >>=? fun (_, Ex_ty param_type) -> - typed ctxt loc (Self (param_type, entrypoint)) - (Item_t (Contract_t (param_type, None), stack, annot)) - | Toplevel { param_type ; root_name = _ ; legacy_create_contract_literal = true} -> - typed ctxt loc (Self (param_type, "default")) - (Item_t (Contract_t (param_type, None), stack, annot)) in - get_toplevel_type tc_context - (* Primitive parsing errors *) - | Prim (loc, (I_DUP | I_SWAP | I_SOME | I_UNIT - | I_PAIR | I_CAR | I_CDR | I_CONS | I_CONCAT | I_SLICE - | I_MEM | I_UPDATE | I_MAP - | I_GET | I_EXEC | I_FAILWITH | I_SIZE - | I_ADD | I_SUB - | I_MUL | I_EDIV | I_OR | I_AND | I_XOR - | I_NOT - | I_ABS | I_NEG | I_LSL | I_LSR - | I_COMPARE | I_EQ | I_NEQ - | I_LT | I_GT | I_LE | I_GE - | I_TRANSFER_TOKENS | I_CREATE_ACCOUNT - | I_SET_DELEGATE | I_NOW - | I_IMPLICIT_ACCOUNT | I_AMOUNT | I_BALANCE - | I_CHECK_SIGNATURE | I_HASH_KEY | I_SOURCE | I_SENDER - | I_BLAKE2B | I_SHA256 | I_SHA512 | I_STEPS_TO_QUOTA | I_ADDRESS - as name), (_ :: _ as l), _), _ -> - fail (Invalid_arity (loc, name, 0, List.length l)) - | Prim (loc, (I_NONE | I_LEFT | I_RIGHT | I_NIL | I_MAP | I_ITER - | I_EMPTY_SET | I_DIP | I_LOOP | I_LOOP_LEFT | I_CONTRACT - as name), ([] - | _ :: _ :: _ as l), _), _ -> - fail (Invalid_arity (loc, name, 1, List.length l)) - | Prim (loc, (I_PUSH | I_IF_NONE | I_IF_LEFT | I_IF_CONS - | I_EMPTY_MAP | I_IF - as name), ([] | [ _ ] - | _ :: _ :: _ :: _ as l), _), _ -> - fail (Invalid_arity (loc, name, 2, List.length l)) - | Prim (loc, I_LAMBDA, ([] | [ _ ] - | _ :: _ :: _ :: _ :: _ as l), _), _ -> - fail (Invalid_arity (loc, I_LAMBDA, 3, List.length l)) - (* Stack errors *) - | Prim (loc, (I_ADD | I_SUB | I_MUL | I_EDIV - | I_AND | I_OR | I_XOR | I_LSL | I_LSR as name), [], _), - Item_t (ta, Item_t (tb, _, _), _) -> - Lwt.return @@ serialize_ty_for_error ctxt ta >>=? fun (ta, ctxt) -> - Lwt.return @@ serialize_ty_for_error ctxt tb >>=? fun (tb, _ctxt) -> - fail (Undefined_binop (loc, name, ta, tb)) - | Prim (loc, (I_NEG | I_ABS | I_NOT | I_CONCAT | I_SIZE - | I_EQ | I_NEQ | I_LT | I_GT | I_LE | I_GE as name), - [], _), - Item_t (t, _, _) -> - Lwt.return @@ serialize_ty_for_error ctxt t >>=? fun (t, _ctxt) -> - fail (Undefined_unop (loc, name, t)) - | Prim (loc, (I_UPDATE | I_SLICE as name), [], _), - stack -> - serialize_stack_for_error ctxt stack >>=? fun (stack, _ctxt) -> - fail (Bad_stack (loc, name, 3, stack)) - | Prim (loc, I_CREATE_CONTRACT, _, _), - stack -> - serialize_stack_for_error ctxt stack >>=? fun (stack, _ctxt) -> - fail (Bad_stack (loc, I_CREATE_CONTRACT, 7, stack)) - | Prim (loc, I_CREATE_ACCOUNT, [], _), - stack -> - serialize_stack_for_error ctxt stack >>=? fun (stack, _ctxt) -> - fail (Bad_stack (loc, I_CREATE_ACCOUNT, 4, stack)) - | Prim (loc, I_TRANSFER_TOKENS, [], _), - stack -> - serialize_stack_for_error ctxt stack >>=? fun (stack, _ctxt) -> - fail (Bad_stack (loc, I_TRANSFER_TOKENS, 4, stack)) - | Prim (loc, (I_DROP | I_DUP | I_CAR | I_CDR | I_SOME - | I_BLAKE2B | I_SHA256 | I_SHA512 | I_DIP - | I_IF_NONE | I_LEFT | I_RIGHT | I_IF_LEFT | I_IF - | I_LOOP | I_IF_CONS | I_IMPLICIT_ACCOUNT - | I_NEG | I_ABS | I_INT | I_NOT | I_HASH_KEY - | I_EQ | I_NEQ | I_LT | I_GT | I_LE | I_GE as name), _, _), - stack -> - serialize_stack_for_error ctxt stack >>=? fun (stack, _ctxt) -> - fail (Bad_stack (loc, name, 1, stack)) - | Prim (loc, (I_SWAP | I_PAIR | I_CONS - | I_GET | I_MEM | I_EXEC - | I_CHECK_SIGNATURE | I_ADD | I_SUB | I_MUL - | I_EDIV | I_AND | I_OR | I_XOR - | I_LSL | I_LSR as name), _, _), - stack -> - serialize_stack_for_error ctxt stack >>=? fun (stack, _ctxt) -> - fail (Bad_stack (loc, name, 2, stack)) - (* Generic parsing errors *) - | expr, _ -> - fail @@ unexpected expr [ Seq_kind ] Instr_namespace - [ I_DROP ; I_DUP; I_DIG; I_DUG; - I_SWAP ; I_SOME ; I_UNIT ; - I_PAIR ; I_CAR ; I_CDR ; I_CONS ; - I_MEM ; I_UPDATE ; I_MAP ; I_ITER ; - I_GET ; I_EXEC ; I_FAILWITH ; I_SIZE ; - I_CONCAT ; I_ADD ; I_SUB ; - I_MUL ; I_EDIV ; I_OR ; I_AND ; I_XOR ; - I_NOT ; - I_ABS ; I_INT; I_NEG ; I_LSL ; I_LSR ; - I_COMPARE ; I_EQ ; I_NEQ ; - I_LT ; I_GT ; I_LE ; I_GE ; - I_TRANSFER_TOKENS ; I_CREATE_ACCOUNT ; - I_CREATE_CONTRACT ; I_NOW ; I_AMOUNT ; I_BALANCE ; - I_IMPLICIT_ACCOUNT ; I_CHECK_SIGNATURE ; - I_BLAKE2B ; I_SHA256 ; I_SHA512 ; I_HASH_KEY ; - I_STEPS_TO_QUOTA ; - I_PUSH ; I_NONE ; I_LEFT ; I_RIGHT ; I_NIL ; - I_EMPTY_SET ; I_DIP ; I_LOOP ; - I_IF_NONE ; I_IF_LEFT ; I_IF_CONS ; - I_EMPTY_MAP ; I_IF ; I_SOURCE ; I_SENDER ; I_SELF ; I_LAMBDA ] + (parse_returning + (Toplevel + { + storage_type; + param_type = arg_type; + root_name; + legacy_create_contract_literal = true; + }) + ctxt + ~legacy + ?type_logger + (arg_type_full, None) + ret_type_full + code_field) + >>=? fun ( ( Lam + ( { bef = Item_t (arg, Empty_t, _); + aft = Item_t (ret, Empty_t, _); + _ }, + _ ) as lambda ), + ctxt ) -> + Lwt.return @@ ty_eq ctxt arg arg_type_full + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_types ~legacy ctxt loc arg arg_type_full + >>=? fun (_, ctxt) -> + Lwt.return @@ ty_eq ctxt ret ret_type_full + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_types ~legacy ctxt loc ret ret_type_full + >>=? fun (_, ctxt) -> + Lwt.return @@ ty_eq ctxt storage_type ginit + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_types ~legacy ctxt loc storage_type ginit + >>=? fun (_, ctxt) -> + typed + ctxt + loc + (Create_contract (storage_type, arg_type, lambda, root_name)) + (Item_t + ( Operation_t None, + Item_t (Address_t None, rest, addr_annot), + op_annot )) + else + (* For new contracts this instruction is not allowed anymore *) + fail (Deprecated_instruction I_CREATE_CONTRACT) + | ( Prim (loc, I_CREATE_CONTRACT, [(Seq _ as code)], annot), + (* Removed the instruction's arguments manager, spendable and delegatable *) + Item_t + ( Option_t (Key_hash_t _, _, _), + Item_t (Mutez_t _, Item_t (ginit, rest, _), _), + _ ) ) -> + parse_two_var_annot loc annot + >>=? fun (op_annot, addr_annot) -> + let cannonical_code = fst @@ Micheline.extract_locations code in + Lwt.return @@ parse_toplevel ~legacy cannonical_code + >>=? fun (arg_type, storage_type, code_field, root_name) -> + trace + (Ill_formed_type (Some "parameter", cannonical_code, location arg_type)) + (Lwt.return @@ parse_parameter_ty ctxt ~legacy arg_type) + >>=? fun (Ex_ty arg_type, ctxt) -> + ( if legacy then Error_monad.return () + else Lwt.return (well_formed_entrypoints ~root_name arg_type) ) + >>=? fun () -> + trace + (Ill_formed_type + (Some "storage", cannonical_code, location storage_type)) + (Lwt.return @@ parse_storage_ty ctxt ~legacy storage_type) + >>=? fun (Ex_ty storage_type, ctxt) -> + let arg_annot = + default_annot + (type_to_var_annot (name_of_ty arg_type)) + ~default:default_param_annot + in + let storage_annot = + default_annot + (type_to_var_annot (name_of_ty storage_type)) + ~default:default_storage_annot + in + let arg_type_full = + Pair_t + ( (arg_type, None, arg_annot), + (storage_type, None, storage_annot), + None, + has_big_map arg_type || has_big_map storage_type ) + in + let ret_type_full = + Pair_t + ( (List_t (Operation_t None, None, false), None, None), + (storage_type, None, None), + None, + has_big_map storage_type ) + in + trace + (Ill_typed_contract (cannonical_code, [])) + (parse_returning + (Toplevel + { + storage_type; + param_type = arg_type; + root_name; + legacy_create_contract_literal = false; + }) + ctxt + ~legacy + ?type_logger + (arg_type_full, None) + ret_type_full + code_field) + >>=? fun ( ( Lam + ( { bef = Item_t (arg, Empty_t, _); + aft = Item_t (ret, Empty_t, _); + _ }, + _ ) as lambda ), + ctxt ) -> + Lwt.return @@ ty_eq ctxt arg arg_type_full + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_types ~legacy ctxt loc arg arg_type_full + >>=? fun (_, ctxt) -> + Lwt.return @@ ty_eq ctxt ret ret_type_full + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_types ~legacy ctxt loc ret ret_type_full + >>=? fun (_, ctxt) -> + Lwt.return @@ ty_eq ctxt storage_type ginit + >>=? fun (Eq, ctxt) -> + Lwt.return @@ merge_types ~legacy ctxt loc storage_type ginit + >>=? fun (_, ctxt) -> + typed + ctxt + loc + (Create_contract_2 (storage_type, arg_type, lambda, root_name)) + (Item_t + ( Operation_t None, + Item_t (Address_t None, rest, addr_annot), + op_annot )) + | (Prim (loc, I_NOW, [], annot), stack) -> + parse_var_annot loc annot ~default:default_now_annot + >>=? fun annot -> + typed ctxt loc Now (Item_t (Timestamp_t None, stack, annot)) + | (Prim (loc, I_AMOUNT, [], annot), stack) -> + parse_var_annot loc annot ~default:default_amount_annot + >>=? fun annot -> + typed ctxt loc Amount (Item_t (Mutez_t None, stack, annot)) + | (Prim (loc, I_CHAIN_ID, [], annot), stack) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc ChainId (Item_t (Chain_id_t None, stack, annot)) + | (Prim (loc, I_BALANCE, [], annot), stack) -> + parse_var_annot loc annot ~default:default_balance_annot + >>=? fun annot -> + typed ctxt loc Balance (Item_t (Mutez_t None, stack, annot)) + | (Prim (loc, I_HASH_KEY, [], annot), Item_t (Key_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Hash_key (Item_t (Key_hash_t None, rest, annot)) + | ( Prim (loc, I_CHECK_SIGNATURE, [], annot), + Item_t + (Key_t _, Item_t (Signature_t _, Item_t (Bytes_t _, rest, _), _), _) ) + -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Check_signature (Item_t (Bool_t None, rest, annot)) + | (Prim (loc, I_BLAKE2B, [], annot), Item_t (Bytes_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Blake2b (Item_t (Bytes_t None, rest, annot)) + | (Prim (loc, I_SHA256, [], annot), Item_t (Bytes_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Sha256 (Item_t (Bytes_t None, rest, annot)) + | (Prim (loc, I_SHA512, [], annot), Item_t (Bytes_t _, rest, _)) -> + parse_var_annot loc annot + >>=? fun annot -> + typed ctxt loc Sha512 (Item_t (Bytes_t None, rest, annot)) + | (Prim (loc, I_STEPS_TO_QUOTA, [], annot), stack) -> + if legacy then + (* For existing contracts, this instruction is still allowed *) + parse_var_annot loc annot ~default:default_steps_annot + >>=? fun annot -> + typed ctxt loc Steps_to_quota (Item_t (Nat_t None, stack, annot)) + else + (* For new contracts this instruction is not allowed anymore *) + fail (Deprecated_instruction I_STEPS_TO_QUOTA) + | (Prim (loc, I_SOURCE, [], annot), stack) -> + parse_var_annot loc annot ~default:default_source_annot + >>=? fun annot -> + typed ctxt loc Source (Item_t (Address_t None, stack, annot)) + | (Prim (loc, I_SENDER, [], annot), stack) -> + parse_var_annot loc annot ~default:default_sender_annot + >>=? fun annot -> + typed ctxt loc Sender (Item_t (Address_t None, stack, annot)) + | (Prim (loc, I_SELF, [], annot), stack) -> + parse_entrypoint_annot loc annot ~default:default_self_annot + >>=? fun (annot, entrypoint) -> + let entrypoint = + Option.unopt_map + ~f:(fun (`Field_annot annot) -> annot) + ~default:"default" + entrypoint + in + let rec get_toplevel_type : + tc_context -> (bef judgement * context) tzresult Lwt.t = function + | Lambda -> + fail (Self_in_lambda loc) + | Dip (_, prev) -> + get_toplevel_type prev + | Toplevel + {param_type; root_name; legacy_create_contract_literal = false} -> + Lwt.return (find_entrypoint param_type ~root_name entrypoint) + >>=? fun (_, Ex_ty param_type) -> + typed + ctxt + loc + (Self (param_type, entrypoint)) + (Item_t (Contract_t (param_type, None), stack, annot)) + | Toplevel + {param_type; root_name = _; legacy_create_contract_literal = true} + -> + typed + ctxt + loc + (Self (param_type, "default")) + (Item_t (Contract_t (param_type, None), stack, annot)) + in + get_toplevel_type tc_context + (* Primitive parsing errors *) + | ( Prim + ( loc, + ( ( I_DUP + | I_SWAP + | I_SOME + | I_UNIT + | I_PAIR + | I_CAR + | I_CDR + | I_CONS + | I_CONCAT + | I_SLICE + | I_MEM + | I_UPDATE + | I_MAP + | I_GET + | I_EXEC + | I_FAILWITH + | I_SIZE + | I_ADD + | I_SUB + | I_MUL + | I_EDIV + | I_OR + | I_AND + | I_XOR + | I_NOT + | I_ABS + | I_NEG + | I_LSL + | I_LSR + | I_COMPARE + | I_EQ + | I_NEQ + | I_LT + | I_GT + | I_LE + | I_GE + | I_TRANSFER_TOKENS + | I_CREATE_ACCOUNT + | I_SET_DELEGATE + | I_NOW + | I_IMPLICIT_ACCOUNT + | I_AMOUNT + | I_BALANCE + | I_CHECK_SIGNATURE + | I_HASH_KEY + | I_SOURCE + | I_SENDER + | I_BLAKE2B + | I_SHA256 + | I_SHA512 + | I_STEPS_TO_QUOTA + | I_ADDRESS ) as name ), + (_ :: _ as l), + _ ), + _ ) -> + fail (Invalid_arity (loc, name, 0, List.length l)) + | ( Prim + ( loc, + ( ( I_NONE + | I_LEFT + | I_RIGHT + | I_NIL + | I_MAP + | I_ITER + | I_EMPTY_SET + | I_DIP + | I_LOOP + | I_LOOP_LEFT + | I_CONTRACT ) as name ), + (([] | _ :: _ :: _) as l), + _ ), + _ ) -> + fail (Invalid_arity (loc, name, 1, List.length l)) + | ( Prim + ( loc, + ( ( I_PUSH + | I_IF_NONE + | I_IF_LEFT + | I_IF_CONS + | I_EMPTY_MAP + | I_EMPTY_BIG_MAP + | I_IF ) as name ), + (([] | [_] | _ :: _ :: _ :: _) as l), + _ ), + _ ) -> + fail (Invalid_arity (loc, name, 2, List.length l)) + | (Prim (loc, I_LAMBDA, (([] | [_] | _ :: _ :: _ :: _ :: _) as l), _), _) -> + fail (Invalid_arity (loc, I_LAMBDA, 3, List.length l)) + (* Stack errors *) + | ( Prim + ( loc, + ( ( I_ADD + | I_SUB + | I_MUL + | I_EDIV + | I_AND + | I_OR + | I_XOR + | I_LSL + | I_LSR ) as name ), + [], + _ ), + Item_t (ta, Item_t (tb, _, _), _) ) -> + Lwt.return @@ serialize_ty_for_error ctxt ta + >>=? fun (ta, ctxt) -> + Lwt.return @@ serialize_ty_for_error ctxt tb + >>=? fun (tb, _ctxt) -> fail (Undefined_binop (loc, name, ta, tb)) + | ( Prim + ( loc, + ( ( I_NEG + | I_ABS + | I_NOT + | I_CONCAT + | I_SIZE + | I_EQ + | I_NEQ + | I_LT + | I_GT + | I_LE + | I_GE ) as name ), + [], + _ ), + Item_t (t, _, _) ) -> + Lwt.return @@ serialize_ty_for_error ctxt t + >>=? fun (t, _ctxt) -> fail (Undefined_unop (loc, name, t)) + | (Prim (loc, ((I_UPDATE | I_SLICE) as name), [], _), stack) -> + serialize_stack_for_error ctxt stack + >>=? fun (stack, _ctxt) -> fail (Bad_stack (loc, name, 3, stack)) + | (Prim (loc, I_CREATE_CONTRACT, _, _), stack) -> + serialize_stack_for_error ctxt stack + >>=? fun (stack, _ctxt) -> + fail (Bad_stack (loc, I_CREATE_CONTRACT, 7, stack)) + | (Prim (loc, I_CREATE_ACCOUNT, [], _), stack) -> + serialize_stack_for_error ctxt stack + >>=? fun (stack, _ctxt) -> + fail (Bad_stack (loc, I_CREATE_ACCOUNT, 4, stack)) + | (Prim (loc, I_TRANSFER_TOKENS, [], _), stack) -> + serialize_stack_for_error ctxt stack + >>=? fun (stack, _ctxt) -> + fail (Bad_stack (loc, I_TRANSFER_TOKENS, 4, stack)) + | ( Prim + ( loc, + ( ( I_DROP + | I_DUP + | I_CAR + | I_CDR + | I_SOME + | I_BLAKE2B + | I_SHA256 + | I_SHA512 + | I_DIP + | I_IF_NONE + | I_LEFT + | I_RIGHT + | I_IF_LEFT + | I_IF + | I_LOOP + | I_IF_CONS + | I_IMPLICIT_ACCOUNT + | I_NEG + | I_ABS + | I_INT + | I_NOT + | I_HASH_KEY + | I_EQ + | I_NEQ + | I_LT + | I_GT + | I_LE + | I_GE ) as name ), + _, + _ ), + stack ) -> + serialize_stack_for_error ctxt stack + >>=? fun (stack, _ctxt) -> fail (Bad_stack (loc, name, 1, stack)) + | ( Prim + ( loc, + ( ( I_SWAP + | I_PAIR + | I_CONS + | I_GET + | I_MEM + | I_EXEC + | I_CHECK_SIGNATURE + | I_ADD + | I_SUB + | I_MUL + | I_EDIV + | I_AND + | I_OR + | I_XOR + | I_LSL + | I_LSR ) as name ), + _, + _ ), + stack ) -> + serialize_stack_for_error ctxt stack + >>=? fun (stack, _ctxt) -> fail (Bad_stack (loc, name, 2, stack)) + (* Generic parsing errors *) + | (expr, _) -> + fail + @@ unexpected + expr + [Seq_kind] + Instr_namespace + [ I_DROP; + I_DUP; + I_DIG; + I_DUG; + I_SWAP; + I_SOME; + I_UNIT; + I_PAIR; + I_CAR; + I_CDR; + I_CONS; + I_MEM; + I_UPDATE; + I_MAP; + I_ITER; + I_GET; + I_EXEC; + I_FAILWITH; + I_SIZE; + I_CONCAT; + I_ADD; + I_SUB; + I_MUL; + I_EDIV; + I_OR; + I_AND; + I_XOR; + I_NOT; + I_ABS; + I_INT; + I_NEG; + I_LSL; + I_LSR; + I_COMPARE; + I_EQ; + I_NEQ; + I_LT; + I_GT; + I_LE; + I_GE; + I_TRANSFER_TOKENS; + I_CREATE_ACCOUNT; + I_CREATE_CONTRACT; + I_NOW; + I_AMOUNT; + I_BALANCE; + I_IMPLICIT_ACCOUNT; + I_CHECK_SIGNATURE; + I_BLAKE2B; + I_SHA256; + I_SHA512; + I_HASH_KEY; + I_STEPS_TO_QUOTA; + I_PUSH; + I_NONE; + I_LEFT; + I_RIGHT; + I_NIL; + I_EMPTY_SET; + I_DIP; + I_LOOP; + I_IF_NONE; + I_IF_LEFT; + I_IF_CONS; + I_EMPTY_MAP; + I_EMPTY_BIG_MAP; + I_IF; + I_SOURCE; + I_SENDER; + I_SELF; + I_LAMBDA ] -and parse_contract - : type arg. legacy: bool -> context -> Script.location -> arg ty -> Contract.t -> entrypoint:string -> - (context * arg typed_contract) tzresult Lwt.t - = fun ~legacy ctxt loc arg contract ~entrypoint -> - Lwt.return @@ Gas.consume ctxt Typecheck_costs.contract_exists >>=? fun ctxt -> - Contract.exists ctxt contract >>=? function - | false -> fail (Invalid_contract (loc, contract)) - | true -> - Lwt.return @@ Gas.consume ctxt Typecheck_costs.get_script >>=? fun ctxt -> - trace - (Invalid_contract (loc, contract)) @@ - Contract.get_script_code ctxt contract >>=? fun (ctxt, code) -> match code with - | None -> - Lwt.return - (ty_eq ctxt arg (Unit_t None) >>? fun (Eq, ctxt) -> - match entrypoint with - | "default" -> - let contract : arg typed_contract = (arg, (contract, entrypoint)) in - ok (ctxt, contract) - | entrypoint -> error (No_such_entrypoint entrypoint)) - | Some code -> - Script.force_decode ctxt code >>=? fun (code, ctxt) -> - Lwt.return - (parse_toplevel ~legacy:true code >>? fun (arg_type, _, _, root_name) -> - parse_parameter_ty ctxt ~legacy:true arg_type >>? fun (Ex_ty targ, ctxt) -> - let return ctxt targ entrypoint = - merge_types ~legacy ctxt loc targ arg >>? fun (arg, ctxt) -> - let contract : arg typed_contract = (arg, (contract, entrypoint)) in - ok (ctxt, contract) in - find_entrypoint_for_type ~full:targ ~expected:arg ~root_name entrypoint ctxt >>? fun (ctxt, entrypoint, targ) -> - merge_types ~legacy ctxt loc targ arg >>? fun (targ, ctxt) -> - return ctxt targ entrypoint) +and parse_contract : + type arg. + legacy:bool -> + context -> + Script.location -> + arg ty -> + Contract.t -> + entrypoint:string -> + (context * arg typed_contract) tzresult Lwt.t = + fun ~legacy ctxt loc arg contract ~entrypoint -> + Lwt.return @@ Gas.consume ctxt Typecheck_costs.contract_exists + >>=? fun ctxt -> + Contract.exists ctxt contract + >>=? function + | false -> + fail (Invalid_contract (loc, contract)) + | true -> ( + Lwt.return @@ Gas.consume ctxt Typecheck_costs.get_script + >>=? fun ctxt -> + trace (Invalid_contract (loc, contract)) + @@ Contract.get_script_code ctxt contract + >>=? fun (ctxt, code) -> + match code with + | None -> + Lwt.return + ( ty_eq ctxt arg (Unit_t None) + >>? fun (Eq, ctxt) -> + match entrypoint with + | "default" -> + let contract : arg typed_contract = + (arg, (contract, entrypoint)) + in + ok (ctxt, contract) + | entrypoint -> + error (No_such_entrypoint entrypoint) ) + | Some code -> + Script.force_decode ctxt code + >>=? fun (code, ctxt) -> + Lwt.return + ( parse_toplevel ~legacy:true code + >>? fun (arg_type, _, _, root_name) -> + parse_parameter_ty ctxt ~legacy:true arg_type + >>? fun (Ex_ty targ, ctxt) -> + let return ctxt targ entrypoint = + merge_types ~legacy ctxt loc targ arg + >>? fun (arg, ctxt) -> + let contract : arg typed_contract = + (arg, (contract, entrypoint)) + in + ok (ctxt, contract) + in + find_entrypoint_for_type + ~full:targ + ~expected:arg + ~root_name + entrypoint + ctxt + >>? fun (ctxt, entrypoint, targ) -> + merge_types ~legacy ctxt loc targ arg + >>? fun (targ, ctxt) -> return ctxt targ entrypoint ) ) (* Same as the one above, but does not fail when the contact is missing or if the expected type doesn't match the actual one. In that case None is returned and some overapproximation of the typechecking gas is consumed. This can still fail on gas exhaustion. *) -and parse_contract_for_script - : type arg. legacy: bool -> context -> Script.location -> arg ty -> Contract.t -> entrypoint:string -> - (context * arg typed_contract option) tzresult Lwt.t - = fun ~legacy ctxt loc arg contract ~entrypoint -> - Lwt.return @@ Gas.consume ctxt Typecheck_costs.contract_exists >>=? fun ctxt -> - Contract.exists ctxt contract >>=? function - | false -> return (ctxt, None) - | true -> - Lwt.return @@ Gas.consume ctxt Typecheck_costs.get_script >>=? fun ctxt -> - trace - (Invalid_contract (loc, contract)) @@ - Contract.get_script_code ctxt contract >>=? fun (ctxt, code) -> match code with (* can only fail because of gas *) - | None -> - begin match entrypoint with - | "default" -> - Lwt.return - (match ty_eq ctxt arg (Unit_t None) with - | Ok (Eq, ctxt) -> - let contract : arg typed_contract = (arg, (contract, entrypoint)) in - ok (ctxt, Some contract) - | Error _ -> - Gas.consume ctxt Typecheck_costs.cycle >>? fun ctxt -> - ok (ctxt, None)) - | _ -> return (ctxt, None) - end - | Some code -> - Script.force_decode ctxt code >>=? fun (code, ctxt) -> (* can only fail because of gas *) - Lwt.return - (match parse_toplevel ~legacy:true code with - | Error _ -> error (Invalid_contract (loc, contract)) - | Ok (arg_type, _, _, root_name) -> - match parse_parameter_ty ctxt ~legacy:true arg_type with - | Error _ -> - error (Invalid_contract (loc, contract)) - | Ok (Ex_ty targ, ctxt) -> - match - find_entrypoint_for_type ~full:targ ~expected:arg ~root_name entrypoint ctxt >>? fun (ctxt, entrypoint, targ) -> - merge_types ~legacy ctxt loc targ arg >>? fun (targ, ctxt) -> - merge_types ~legacy ctxt loc targ arg >>? fun (arg, ctxt) -> - let contract : arg typed_contract = (arg, (contract, entrypoint)) in - ok (ctxt, Some contract) - with - | Ok res -> ok res - | Error _ -> - (* overapproximation by checking if targ = targ, +and parse_contract_for_script : + type arg. + legacy:bool -> + context -> + Script.location -> + arg ty -> + Contract.t -> + entrypoint:string -> + (context * arg typed_contract option) tzresult Lwt.t = + fun ~legacy ctxt loc arg contract ~entrypoint -> + Lwt.return @@ Gas.consume ctxt Typecheck_costs.contract_exists + >>=? fun ctxt -> + match (Contract.is_implicit contract, entrypoint) with + | (Some _, "default") -> + (* An implicit account on the "default" entrypoint always exists and has type unit. *) + Lwt.return + ( match ty_eq ctxt arg (Unit_t None) with + | Ok (Eq, ctxt) -> + let contract : arg typed_contract = + (arg, (contract, entrypoint)) + in + ok (ctxt, Some contract) + | Error _ -> + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> ok (ctxt, None) ) + | (Some _, _) -> + Lwt.return @@ Gas.consume ctxt Typecheck_costs.cycle + >>=? fun ctxt -> + (* An implicit account on any other entrypoint is not a valid contract. *) + return (ctxt, None) + | (None, _) -> ( + (* Originated account *) + Contract.exists ctxt contract + >>=? function + | false -> + return (ctxt, None) + | true -> ( + Lwt.return @@ Gas.consume ctxt Typecheck_costs.get_script + >>=? fun ctxt -> + trace (Invalid_contract (loc, contract)) + @@ Contract.get_script_code ctxt contract + >>=? fun (ctxt, code) -> + match code with + | None -> + (* Since protocol 005, we have the invariant that all originated accounts have code *) + assert false + | Some code -> + Script.force_decode ctxt code + >>=? fun (code, ctxt) -> + (* can only fail because of gas *) + Lwt.return + ( match parse_toplevel ~legacy:true code with + | Error _ -> + error (Invalid_contract (loc, contract)) + | Ok (arg_type, _, _, root_name) -> ( + match parse_parameter_ty ctxt ~legacy:true arg_type with + | Error _ -> + error (Invalid_contract (loc, contract)) + | Ok (Ex_ty targ, ctxt) -> ( + match + find_entrypoint_for_type + ~full:targ + ~expected:arg + ~root_name + entrypoint + ctxt + >>? fun (ctxt, entrypoint, targ) -> + merge_types ~legacy ctxt loc targ arg + >>? fun (targ, ctxt) -> + merge_types ~legacy ctxt loc targ arg + >>? fun (arg, ctxt) -> + let contract : arg typed_contract = + (arg, (contract, entrypoint)) + in + ok (ctxt, Some contract) + with + | Ok res -> + ok res + | Error _ -> + (* overapproximation by checking if targ = targ, can only fail because of gas *) - ty_eq ctxt targ targ >>? fun (Eq, ctxt) -> - merge_types ~legacy ctxt loc targ targ >>? fun (_, ctxt) -> - ok (ctxt, None)) + ty_eq ctxt targ targ + >>? fun (Eq, ctxt) -> + merge_types ~legacy ctxt loc targ targ + >>? fun (_, ctxt) -> ok (ctxt, None) ) ) ) ) ) -and parse_toplevel - : legacy: bool -> Script.expr -> (Script.node * Script.node * Script.node * string option) tzresult - = fun ~legacy toplevel -> - record_trace (Ill_typed_contract (toplevel, [])) @@ - match root toplevel with - | Int (loc, _) -> error (Invalid_kind (loc, [ Seq_kind ], Int_kind)) - | String (loc, _) -> error (Invalid_kind (loc, [ Seq_kind ], String_kind)) - | Bytes (loc, _) -> error (Invalid_kind (loc, [ Seq_kind ], Bytes_kind)) - | Prim (loc, _, _, _) -> error (Invalid_kind (loc, [ Seq_kind ], Prim_kind)) - | Seq (_, fields) -> - let rec find_fields p s c fields = - match fields with - | [] -> ok (p, s, c) - | Int (loc, _) :: _ -> error (Invalid_kind (loc, [ Prim_kind ], Int_kind)) - | String (loc, _) :: _ -> error (Invalid_kind (loc, [ Prim_kind ], String_kind)) - | Bytes (loc, _) :: _ -> error (Invalid_kind (loc, [ Prim_kind ], Bytes_kind)) - | Seq (loc, _) :: _ -> error (Invalid_kind (loc, [ Prim_kind ], Seq_kind)) - | Prim (loc, K_parameter, [ arg ], annot) :: rest -> - begin match p with - | None -> find_fields (Some (arg, loc, annot)) s c rest - | Some _ -> error (Duplicate_field (loc, K_parameter)) - end - | Prim (loc, K_storage, [ arg ], annot) :: rest -> - begin match s with - | None -> find_fields p (Some (arg, loc, annot)) c rest - | Some _ -> error (Duplicate_field (loc, K_storage)) - end - | Prim (loc, K_code, [ arg ], annot) :: rest -> - begin match c with - | None -> find_fields p s (Some (arg, loc, annot)) rest - | Some _ -> error (Duplicate_field (loc, K_code)) - end - | Prim (loc, (K_parameter | K_storage | K_code as name), args, _) :: _ -> - error (Invalid_arity (loc, name, 1, List.length args)) - | Prim (loc, name, _, _) :: _ -> - let allowed = [ K_parameter ; K_storage ; K_code ] in - error (Invalid_primitive (loc, allowed, name)) - in - find_fields None None None fields >>? function - | (None, _, _) -> error (Missing_field K_parameter) - | (Some _, None, _) -> error (Missing_field K_storage) - | (Some _, Some _, None) -> error (Missing_field K_code) - | (Some (p, ploc, pannot), Some (s, sloc, sannot), Some (c, cloc, carrot)) -> - let maybe_root_name = - (* root name can be attached to either the parameter +and parse_toplevel : + legacy:bool -> + Script.expr -> + (Script.node * Script.node * Script.node * string option) tzresult = + fun ~legacy toplevel -> + record_trace (Ill_typed_contract (toplevel, [])) + @@ + match root toplevel with + | Int (loc, _) -> + error (Invalid_kind (loc, [Seq_kind], Int_kind)) + | String (loc, _) -> + error (Invalid_kind (loc, [Seq_kind], String_kind)) + | Bytes (loc, _) -> + error (Invalid_kind (loc, [Seq_kind], Bytes_kind)) + | Prim (loc, _, _, _) -> + error (Invalid_kind (loc, [Seq_kind], Prim_kind)) + | Seq (_, fields) -> ( + let rec find_fields p s c fields = + match fields with + | [] -> + ok (p, s, c) + | Int (loc, _) :: _ -> + error (Invalid_kind (loc, [Prim_kind], Int_kind)) + | String (loc, _) :: _ -> + error (Invalid_kind (loc, [Prim_kind], String_kind)) + | Bytes (loc, _) :: _ -> + error (Invalid_kind (loc, [Prim_kind], Bytes_kind)) + | Seq (loc, _) :: _ -> + error (Invalid_kind (loc, [Prim_kind], Seq_kind)) + | Prim (loc, K_parameter, [arg], annot) :: rest -> ( + match p with + | None -> + find_fields (Some (arg, loc, annot)) s c rest + | Some _ -> + error (Duplicate_field (loc, K_parameter)) ) + | Prim (loc, K_storage, [arg], annot) :: rest -> ( + match s with + | None -> + find_fields p (Some (arg, loc, annot)) c rest + | Some _ -> + error (Duplicate_field (loc, K_storage)) ) + | Prim (loc, K_code, [arg], annot) :: rest -> ( + match c with + | None -> + find_fields p s (Some (arg, loc, annot)) rest + | Some _ -> + error (Duplicate_field (loc, K_code)) ) + | Prim (loc, ((K_parameter | K_storage | K_code) as name), args, _) + :: _ -> + error (Invalid_arity (loc, name, 1, List.length args)) + | Prim (loc, name, _, _) :: _ -> + let allowed = [K_parameter; K_storage; K_code] in + error (Invalid_primitive (loc, allowed, name)) + in + find_fields None None None fields + >>? function + | (None, _, _) -> + error (Missing_field K_parameter) + | (Some _, None, _) -> + error (Missing_field K_storage) + | (Some _, Some _, None) -> + error (Missing_field K_code) + | (Some (p, ploc, pannot), Some (s, sloc, sannot), Some (c, cloc, carrot)) + -> + let maybe_root_name = + (* root name can be attached to either the parameter primitive or the toplevel constructor *) - Script_ir_annot.extract_field_annot p >>? fun (p, root_name) -> - match root_name with - | Some (`Field_annot root_name) -> - ok (p, pannot, Some root_name) - | None -> - match pannot with - | [ single ] when Compare.Int.(String.length single > 0) && Compare.Char.(String.get single 0 = '%') -> - ok (p, [], Some (String.sub single 1 (String.length single - 1))) - | _ -> ok (p, pannot, None) in - if legacy then - (* legacy semantics ignores spurious annotations *) - let p, root_name = match maybe_root_name with Ok (p, _, root_name) -> (p, root_name) | Error _ -> (p, None) in - ok (p, s, c, root_name) - else - (* only one field annot is allowed to set the root entrypoint name *) - maybe_root_name >>? fun (p, pannot, root_name) -> - Script_ir_annot.error_unexpected_annot ploc pannot >>? fun () -> - Script_ir_annot.error_unexpected_annot cloc carrot >>? fun () -> - Script_ir_annot.error_unexpected_annot sloc sannot >>? fun () -> - ok (p, s, c, root_name) + Script_ir_annot.extract_field_annot p + >>? fun (p, root_name) -> + match root_name with + | Some (`Field_annot root_name) -> + ok (p, pannot, Some root_name) + | None -> ( + match pannot with + | [single] + when Compare.Int.(String.length single > 0) + && Compare.Char.(single.[0] = '%') -> + ok + ( p, + [], + Some (String.sub single 1 (String.length single - 1)) ) + | _ -> + ok (p, pannot, None) ) + in + if legacy then + (* legacy semantics ignores spurious annotations *) + let (p, root_name) = + match maybe_root_name with + | Ok (p, _, root_name) -> + (p, root_name) + | Error _ -> + (p, None) + in + ok (p, s, c, root_name) + else + (* only one field annot is allowed to set the root entrypoint name *) + maybe_root_name + >>? fun (p, pannot, root_name) -> + Script_ir_annot.error_unexpected_annot ploc pannot + >>? fun () -> + Script_ir_annot.error_unexpected_annot cloc carrot + >>? fun () -> + Script_ir_annot.error_unexpected_annot sloc sannot + >>? fun () -> ok (p, s, c, root_name) ) -let parse_script - : ?type_logger: type_logger -> - context -> legacy: bool -> Script.t -> (ex_script * context) tzresult Lwt.t - = fun ?type_logger ctxt ~legacy { code ; storage } -> - Script.force_decode ctxt code >>=? fun (code, ctxt) -> - Script.force_decode ctxt storage >>=? fun (storage, ctxt) -> - Lwt.return @@ parse_toplevel ~legacy code >>=? fun (arg_type, storage_type, code_field, root_name) -> - trace - (Ill_formed_type (Some "parameter", code, location arg_type)) - (Lwt.return (parse_parameter_ty ctxt ~legacy arg_type)) - >>=? fun (Ex_ty arg_type, ctxt) -> - begin - if legacy then return () else - Lwt.return (well_formed_entrypoints ~root_name arg_type) - end >>=? fun () -> - trace - (Ill_formed_type (Some "storage", code, location storage_type)) - (Lwt.return (parse_storage_ty ctxt ~legacy storage_type)) - >>=? fun (Ex_ty storage_type, ctxt) -> - let arg_annot = default_annot (type_to_var_annot (name_of_ty arg_type)) - ~default:default_param_annot in - let storage_annot = default_annot (type_to_var_annot (name_of_ty storage_type)) - ~default:default_storage_annot in - let arg_type_full = Pair_t ((arg_type, None, arg_annot), - (storage_type, None, storage_annot), None, - has_big_map arg_type || has_big_map storage_type) in - let ret_type_full = - Pair_t ((List_t (Operation_t None, None, false), None, None), - (storage_type, None, None), None, has_big_map storage_type) in - trace_eval - (fun () -> - Lwt.return @@ serialize_ty_for_error ctxt storage_type >>|? fun (storage_type, _ctxt) -> - Ill_typed_data (None, storage, storage_type)) - (parse_data ?type_logger ctxt ~legacy storage_type (root storage)) >>=? fun (storage, ctxt) -> - trace - (Ill_typed_contract (code, [])) - (parse_returning (Toplevel { storage_type ; param_type = arg_type ; root_name ; - legacy_create_contract_literal = false}) - ctxt ~legacy ?type_logger (arg_type_full, None) ret_type_full code_field) >>=? fun (code, ctxt) -> - return (Ex_script { code ; arg_type ; storage ; storage_type ; root_name }, ctxt) +let parse_script : + ?type_logger:type_logger -> + context -> + legacy:bool -> + Script.t -> + (ex_script * context) tzresult Lwt.t = + fun ?type_logger ctxt ~legacy {code; storage} -> + Script.force_decode ctxt code + >>=? fun (code, ctxt) -> + Script.force_decode ctxt storage + >>=? fun (storage, ctxt) -> + Lwt.return @@ parse_toplevel ~legacy code + >>=? fun (arg_type, storage_type, code_field, root_name) -> + trace + (Ill_formed_type (Some "parameter", code, location arg_type)) + (Lwt.return (parse_parameter_ty ctxt ~legacy arg_type)) + >>=? fun (Ex_ty arg_type, ctxt) -> + ( if legacy then return () + else Lwt.return (well_formed_entrypoints ~root_name arg_type) ) + >>=? fun () -> + trace + (Ill_formed_type (Some "storage", code, location storage_type)) + (Lwt.return (parse_storage_ty ctxt ~legacy storage_type)) + >>=? fun (Ex_ty storage_type, ctxt) -> + let arg_annot = + default_annot + (type_to_var_annot (name_of_ty arg_type)) + ~default:default_param_annot + in + let storage_annot = + default_annot + (type_to_var_annot (name_of_ty storage_type)) + ~default:default_storage_annot + in + let arg_type_full = + Pair_t + ( (arg_type, None, arg_annot), + (storage_type, None, storage_annot), + None, + has_big_map arg_type || has_big_map storage_type ) + in + let ret_type_full = + Pair_t + ( (List_t (Operation_t None, None, false), None, None), + (storage_type, None, None), + None, + has_big_map storage_type ) + in + trace_eval + (fun () -> + Lwt.return @@ serialize_ty_for_error ctxt storage_type + >>|? fun (storage_type, _ctxt) -> + Ill_typed_data (None, storage, storage_type)) + (parse_data ?type_logger ctxt ~legacy storage_type (root storage)) + >>=? fun (storage, ctxt) -> + trace + (Ill_typed_contract (code, [])) + (parse_returning + (Toplevel + { + storage_type; + param_type = arg_type; + root_name; + legacy_create_contract_literal = false; + }) + ctxt + ~legacy + ?type_logger + (arg_type_full, None) + ret_type_full + code_field) + >>=? fun (code, ctxt) -> + return (Ex_script {code; arg_type; storage; storage_type; root_name}, ctxt) -let typecheck_code - : context -> Script.expr -> (type_map * context) tzresult Lwt.t - = fun ctxt code -> - let legacy = false in - Lwt.return @@ parse_toplevel ~legacy code >>=? fun (arg_type, storage_type, code_field, root_name) -> - let type_map = ref [] in - trace - (Ill_formed_type (Some "parameter", code, location arg_type)) - (Lwt.return (parse_parameter_ty ctxt ~legacy arg_type)) - >>=? fun (Ex_ty arg_type, ctxt) -> - begin - if legacy then return () else - Lwt.return (well_formed_entrypoints ~root_name arg_type) - end >>=? fun () -> - trace - (Ill_formed_type (Some "storage", code, location storage_type)) - (Lwt.return (parse_storage_ty ctxt ~legacy storage_type)) - >>=? fun (Ex_ty storage_type, ctxt) -> - let arg_annot = default_annot (type_to_var_annot (name_of_ty arg_type)) - ~default:default_param_annot in - let storage_annot = default_annot (type_to_var_annot (name_of_ty storage_type)) - ~default:default_storage_annot in - let arg_type_full = Pair_t ((arg_type, None, arg_annot), - (storage_type, None, storage_annot), None, - has_big_map arg_type || has_big_map storage_type) in - let ret_type_full = - Pair_t ((List_t (Operation_t None, None, false), None, None), - (storage_type, None, None), None, - has_big_map storage_type) in - let result = - parse_returning - (Toplevel { storage_type ; param_type = arg_type ; root_name ; - legacy_create_contract_literal = false }) - ctxt ~legacy - ~type_logger: (fun loc bef aft -> type_map := (loc, (bef, aft)) :: !type_map) - (arg_type_full, None) ret_type_full code_field in - trace - (Ill_typed_contract (code, !type_map)) - result >>=? fun (Lam _, ctxt) -> - return (!type_map, ctxt) +let typecheck_code : + context -> Script.expr -> (type_map * context) tzresult Lwt.t = + fun ctxt code -> + let legacy = false in + Lwt.return @@ parse_toplevel ~legacy code + >>=? fun (arg_type, storage_type, code_field, root_name) -> + let type_map = ref [] in + trace + (Ill_formed_type (Some "parameter", code, location arg_type)) + (Lwt.return (parse_parameter_ty ctxt ~legacy arg_type)) + >>=? fun (Ex_ty arg_type, ctxt) -> + ( if legacy then return () + else Lwt.return (well_formed_entrypoints ~root_name arg_type) ) + >>=? fun () -> + trace + (Ill_formed_type (Some "storage", code, location storage_type)) + (Lwt.return (parse_storage_ty ctxt ~legacy storage_type)) + >>=? fun (Ex_ty storage_type, ctxt) -> + let arg_annot = + default_annot + (type_to_var_annot (name_of_ty arg_type)) + ~default:default_param_annot + in + let storage_annot = + default_annot + (type_to_var_annot (name_of_ty storage_type)) + ~default:default_storage_annot + in + let arg_type_full = + Pair_t + ( (arg_type, None, arg_annot), + (storage_type, None, storage_annot), + None, + has_big_map arg_type || has_big_map storage_type ) + in + let ret_type_full = + Pair_t + ( (List_t (Operation_t None, None, false), None, None), + (storage_type, None, None), + None, + has_big_map storage_type ) + in + let result = + parse_returning + (Toplevel + { + storage_type; + param_type = arg_type; + root_name; + legacy_create_contract_literal = false; + }) + ctxt + ~legacy + ~type_logger:(fun loc bef aft -> + type_map := (loc, (bef, aft)) :: !type_map) + (arg_type_full, None) + ret_type_full + code_field + in + trace (Ill_typed_contract (code, !type_map)) result + >>=? fun (Lam _, ctxt) -> return (!type_map, ctxt) -let typecheck_data - : ?type_logger: type_logger -> - context -> Script.expr * Script.expr -> context tzresult Lwt.t - = fun ?type_logger ctxt (data, exp_ty) -> - let legacy = false in - trace - (Ill_formed_type (None, exp_ty, 0)) - (Lwt.return @@ parse_packable_ty ctxt ~legacy (root exp_ty)) - >>=? fun (Ex_ty exp_ty, ctxt) -> - trace_eval - (fun () -> - Lwt.return @@ serialize_ty_for_error ctxt exp_ty >>|? fun (exp_ty, _ctxt) -> - Ill_typed_data (None, data, exp_ty)) - (parse_data ?type_logger ctxt ~legacy exp_ty (root data)) >>=? fun (_, ctxt) -> - return ctxt +let typecheck_data : + ?type_logger:type_logger -> + context -> + Script.expr * Script.expr -> + context tzresult Lwt.t = + fun ?type_logger ctxt (data, exp_ty) -> + let legacy = false in + trace + (Ill_formed_type (None, exp_ty, 0)) + (Lwt.return @@ parse_parameter_ty ctxt ~legacy (root exp_ty)) + >>=? fun (Ex_ty exp_ty, ctxt) -> + trace_eval + (fun () -> + Lwt.return @@ serialize_ty_for_error ctxt exp_ty + >>|? fun (exp_ty, _ctxt) -> Ill_typed_data (None, data, exp_ty)) + (parse_data ?type_logger ctxt ~legacy exp_ty (root data)) + >>=? fun (_, ctxt) -> return ctxt module Entrypoints_map = Map.Make (String) -let list_entrypoints (type full) (full : full ty) ctxt ~root_name = - let merge path annot (type t) (ty : t ty) reachable ((unreachables, all) as acc) = +let list_entrypoints (type full) (full : full ty) ctxt ~root_name = + let merge path annot (type t) (ty : t ty) reachable + ((unreachables, all) as acc) = match annot with - | None | Some (`Field_annot "") -> - ok @@ - if reachable then acc else - begin match ty with - | Union_t _ -> acc - | _ -> ( (List.rev path)::unreachables, all ) - end + | None | Some (`Field_annot "") -> ( + ok + @@ + if reachable then acc + else + match ty with + | Union_t _ -> + acc + | _ -> + (List.rev path :: unreachables, all) ) | Some (`Field_annot name) -> - if Compare.Int.(String.length name > 31) then ok ((List.rev path)::unreachables, all) - else if Entrypoints_map.mem name all then ok ((List.rev path)::unreachables, all) - else unparse_ty_no_lwt ctxt ty >>? fun (unparsed_ty , _) -> - ok (unreachables, Entrypoints_map.add name ((List.rev path),unparsed_ty) all) + if Compare.Int.(String.length name > 31) then + ok (List.rev path :: unreachables, all) + else if Entrypoints_map.mem name all then + ok (List.rev path :: unreachables, all) + else + unparse_ty_no_lwt ctxt ty + >>? fun (unparsed_ty, _) -> + ok + ( unreachables, + Entrypoints_map.add name (List.rev path, unparsed_ty) all ) in - let rec fold_tree - : type t. t ty -> + let rec fold_tree : + type t. + t ty -> prim list -> bool -> - prim list list * (prim list * Script.node) Entrypoints_map.t -> - (prim list list * (prim list * Script.node) Entrypoints_map.t) tzresult - = fun t path reachable acc -> - match t with - | Union_t ((tl, al), (tr, ar), _, _) -> - merge (D_Left :: path) al tl reachable acc >>? fun acc -> - merge (D_Right :: path) ar tr reachable acc >>? fun acc -> - fold_tree tl (D_Left :: path) (match al with Some _ -> true | None -> reachable) acc >>? fun acc -> - fold_tree tr (D_Right :: path) (match ar with Some _ -> true | None -> reachable) acc - | _ -> ok acc in - unparse_ty_no_lwt ctxt full >>? fun (unparsed_full , _) -> - let init, reachable = match root_name with - | None | Some "" -> Entrypoints_map.empty, false - | Some name -> Entrypoints_map.singleton name ([],unparsed_full), true in + prim list list * (prim list * Script.node) Entrypoints_map.t -> + (prim list list * (prim list * Script.node) Entrypoints_map.t) tzresult = + fun t path reachable acc -> + match t with + | Union_t ((tl, al), (tr, ar), _, _) -> + merge (D_Left :: path) al tl reachable acc + >>? fun acc -> + merge (D_Right :: path) ar tr reachable acc + >>? fun acc -> + fold_tree + tl + (D_Left :: path) + (match al with Some _ -> true | None -> reachable) + acc + >>? fun acc -> + fold_tree + tr + (D_Right :: path) + (match ar with Some _ -> true | None -> reachable) + acc + | _ -> + ok acc + in + unparse_ty_no_lwt ctxt full + >>? fun (unparsed_full, _) -> + let (init, reachable) = + match root_name with + | None | Some "" -> + (Entrypoints_map.empty, false) + | Some name -> + (Entrypoints_map.singleton name ([], unparsed_full), true) + in fold_tree full [] reachable ([], init) (* ---- Unparsing (Typed IR -> Untyped expressions) --------------------------*) -let rec unparse_data - : type a. context -> unparsing_mode -> a ty -> a -> (Script.node * context) tzresult Lwt.t - = fun ctxt mode ty a -> - Lwt.return (Gas.consume ctxt Unparse_costs.cycle) >>=? fun ctxt -> - match ty, a with - | Unit_t _, () -> - Lwt.return (Gas.consume ctxt Unparse_costs.unit) >>=? fun ctxt -> - return (Prim (-1, D_Unit, [], []), ctxt) - | Int_t _, v -> - Lwt.return (Gas.consume ctxt (Unparse_costs.int v)) >>=? fun ctxt -> - return (Int (-1, Script_int.to_zint v), ctxt) - | Nat_t _, v -> - Lwt.return (Gas.consume ctxt (Unparse_costs.int v)) >>=? fun ctxt -> - return (Int (-1, Script_int.to_zint v), ctxt) - | String_t _, s -> - Lwt.return (Gas.consume ctxt (Unparse_costs.string s)) >>=? fun ctxt -> - return (String (-1, s), ctxt) - | Bytes_t _, s -> - Lwt.return (Gas.consume ctxt (Unparse_costs.bytes s)) >>=? fun ctxt -> - return (Bytes (-1, s), ctxt) - | Bool_t _, true -> - Lwt.return (Gas.consume ctxt Unparse_costs.bool) >>=? fun ctxt -> - return (Prim (-1, D_True, [], []), ctxt) - | Bool_t _, false -> - Lwt.return (Gas.consume ctxt Unparse_costs.bool) >>=? fun ctxt -> - return (Prim (-1, D_False, [], []), ctxt) - | Timestamp_t _, t -> - Lwt.return (Gas.consume ctxt (Unparse_costs.timestamp t)) >>=? fun ctxt -> - begin - match mode with - | Optimized -> return (Int (-1, Script_timestamp.to_zint t), ctxt) - | Readable -> - match Script_timestamp.to_notation t with - | None -> return (Int (-1, Script_timestamp.to_zint t), ctxt) - | Some s -> return (String (-1, s), ctxt) - end - | Address_t _, (c, entrypoint) -> - Lwt.return (Gas.consume ctxt Unparse_costs.contract) >>=? fun ctxt -> - begin - match mode with - | Optimized -> - let entrypoint = match entrypoint with "default" -> "" | name -> name in - let bytes = Data_encoding.Binary.to_bytes_exn - Data_encoding.(tup2 Contract.encoding Variable.string) - (c, entrypoint) in - return (Bytes (-1, bytes), ctxt) - | Readable -> - let notation = match entrypoint with - | "default" -> Contract.to_b58check c - | entrypoint -> Contract.to_b58check c ^ "%" ^ entrypoint in - return (String (-1, notation), ctxt) - end - | Contract_t _, (_, (c, entrypoint)) -> - Lwt.return (Gas.consume ctxt Unparse_costs.contract) >>=? fun ctxt -> - begin - match mode with - | Optimized -> - let entrypoint = match entrypoint with "default" -> "" | name -> name in - let bytes = Data_encoding.Binary.to_bytes_exn - Data_encoding.(tup2 Contract.encoding Variable.string) - (c, entrypoint) in - return (Bytes (-1, bytes), ctxt) - | Readable -> - let notation = match entrypoint with - | "default" -> Contract.to_b58check c - | entrypoint -> Contract.to_b58check c ^ "%" ^ entrypoint in - return (String (-1, notation), ctxt) - end - | Signature_t _, s -> - Lwt.return (Gas.consume ctxt Unparse_costs.signature) >>=? fun ctxt -> - begin - match mode with - | Optimized -> - let bytes = Data_encoding.Binary.to_bytes_exn Signature.encoding s in - return (Bytes (-1, bytes), ctxt) - | Readable -> - return (String (-1, Signature.to_b58check s), ctxt) - end - | Mutez_t _, v -> - Lwt.return (Gas.consume ctxt Unparse_costs.tez) >>=? fun ctxt -> - return (Int (-1, Z.of_int64 (Tez.to_mutez v)), ctxt) - | Key_t _, k -> - Lwt.return (Gas.consume ctxt Unparse_costs.key) >>=? fun ctxt -> - begin - match mode with - | Optimized -> - let bytes = Data_encoding.Binary.to_bytes_exn Signature.Public_key.encoding k in - return (Bytes (-1, bytes), ctxt) - | Readable -> - return (String (-1, Signature.Public_key.to_b58check k), ctxt) - end - | Key_hash_t _, k -> - Lwt.return (Gas.consume ctxt Unparse_costs.key_hash) >>=? fun ctxt -> - begin - match mode with - | Optimized -> - let bytes = Data_encoding.Binary.to_bytes_exn Signature.Public_key_hash.encoding k in - return (Bytes (-1, bytes), ctxt) - | Readable -> - return (String (-1, Signature.Public_key_hash.to_b58check k), ctxt) - end - | Operation_t _, (op, _big_map_diff) -> - let bytes = Data_encoding.Binary.to_bytes_exn Operation.internal_operation_encoding op in - Lwt.return (Gas.consume ctxt (Unparse_costs.operation bytes)) >>=? fun ctxt -> - return (Bytes (-1, bytes), ctxt) - | Chain_id_t _, chain_id -> - let bytes = Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id in - Lwt.return (Gas.consume ctxt (Unparse_costs.chain_id bytes)) >>=? fun ctxt -> - return (Bytes (-1, bytes), ctxt) - | Pair_t ((tl, _, _), (tr, _, _), _, _), (l, r) -> - Lwt.return (Gas.consume ctxt Unparse_costs.pair) >>=? fun ctxt -> - unparse_data ctxt mode tl l >>=? fun (l, ctxt) -> - unparse_data ctxt mode tr r >>=? fun (r, ctxt) -> - return (Prim (-1, D_Pair, [ l; r ], []), ctxt) - | Union_t ((tl, _), _, _, _), L l -> - Lwt.return (Gas.consume ctxt Unparse_costs.union) >>=? fun ctxt -> - unparse_data ctxt mode tl l >>=? fun (l, ctxt) -> - return (Prim (-1, D_Left, [ l ], []), ctxt) - | Union_t (_, (tr, _), _, _), R r -> - Lwt.return (Gas.consume ctxt Unparse_costs.union) >>=? fun ctxt -> - unparse_data ctxt mode tr r >>=? fun (r, ctxt) -> - return (Prim (-1, D_Right, [ r ], []), ctxt) - | Option_t (t, _, _), Some v -> - Lwt.return (Gas.consume ctxt Unparse_costs.some) >>=? fun ctxt -> - unparse_data ctxt mode t v >>=? fun (v, ctxt) -> - return (Prim (-1, D_Some, [ v ], []), ctxt) - | Option_t _, None -> - Lwt.return (Gas.consume ctxt Unparse_costs.none) >>=? fun ctxt -> - return (Prim (-1, D_None, [], []), ctxt) - | List_t (t, _, _), items -> - fold_left_s - (fun (l, ctxt) element -> - Lwt.return (Gas.consume ctxt Unparse_costs.list_element) >>=? fun ctxt -> - unparse_data ctxt mode t element >>=? fun (unparsed, ctxt) -> - return (unparsed :: l, ctxt)) - ([], ctxt) - items >>=? fun (items, ctxt) -> - return (Micheline.Seq (-1, List.rev items), ctxt) - | Set_t (t, _), set -> - let t = ty_of_comparable_ty t in - fold_left_s - (fun (l, ctxt) item -> - Lwt.return (Gas.consume ctxt Unparse_costs.set_element) >>=? fun ctxt -> - unparse_data ctxt mode t item >>=? fun (item, ctxt) -> - return (item :: l, ctxt)) - ([], ctxt) - (set_fold (fun e acc -> e :: acc) set []) >>=? fun (items, ctxt) -> - return (Micheline.Seq (-1, items), ctxt) - | Map_t (kt, vt, _, _), map -> - let kt = ty_of_comparable_ty kt in - fold_left_s - (fun (l, ctxt) (k, v) -> - Lwt.return (Gas.consume ctxt Unparse_costs.map_element) >>=? fun ctxt -> - unparse_data ctxt mode kt k >>=? fun (key, ctxt) -> - unparse_data ctxt mode vt v >>=? fun (value, ctxt) -> - return (Prim (-1, D_Elt, [ key ; value ], []) :: l, ctxt)) - ([], ctxt) - (map_fold (fun k v acc -> (k, v) :: acc) map []) >>=? fun (items, ctxt) -> - return (Micheline.Seq (-1, items), ctxt) - | Big_map_t (kt, vt, _), { id = None ; diff = (module Diff) ; _ } -> - (* this branch is to allow roundtrip of big map literals *) - let kt = ty_of_comparable_ty kt in - fold_left_s - (fun (l, ctxt) (k, v) -> - Lwt.return (Gas.consume ctxt Unparse_costs.map_element) >>=? fun ctxt -> - unparse_data ctxt mode kt k >>=? fun (key, ctxt) -> - unparse_data ctxt mode vt v >>=? fun (value, ctxt) -> - return (Prim (-1, D_Elt, [ key ; value ], []) :: l, ctxt)) - ([], ctxt) - (Diff.OPS.fold - (fun k v acc -> match v with | None -> acc | Some v -> (k, v) :: acc) - (fst Diff.boxed) []) >>=? fun (items, ctxt) -> - return (Micheline.Seq (-1, items), ctxt) - | Big_map_t (_kt, _kv, _), { id = Some id ; diff = (module Diff) ; _ } -> - if Compare.Int.(Diff.OPS.cardinal (fst Diff.boxed) = 0) then - return (Micheline.Int (-1, id), ctxt) - else - (* this can only be the result of an execution and the map +let rec unparse_data : + type a. + context -> + unparsing_mode -> + a ty -> + a -> + (Script.node * context) tzresult Lwt.t = + fun ctxt mode ty a -> + Lwt.return (Gas.consume ctxt Unparse_costs.cycle) + >>=? fun ctxt -> + match (ty, a) with + | (Unit_t _, ()) -> + Lwt.return (Gas.consume ctxt Unparse_costs.unit) + >>=? fun ctxt -> return (Prim (-1, D_Unit, [], []), ctxt) + | (Int_t _, v) -> + Lwt.return (Gas.consume ctxt (Unparse_costs.int v)) + >>=? fun ctxt -> return (Int (-1, Script_int.to_zint v), ctxt) + | (Nat_t _, v) -> + Lwt.return (Gas.consume ctxt (Unparse_costs.int v)) + >>=? fun ctxt -> return (Int (-1, Script_int.to_zint v), ctxt) + | (String_t _, s) -> + Lwt.return (Gas.consume ctxt (Unparse_costs.string s)) + >>=? fun ctxt -> return (String (-1, s), ctxt) + | (Bytes_t _, s) -> + Lwt.return (Gas.consume ctxt (Unparse_costs.bytes s)) + >>=? fun ctxt -> return (Bytes (-1, s), ctxt) + | (Bool_t _, true) -> + Lwt.return (Gas.consume ctxt Unparse_costs.bool) + >>=? fun ctxt -> return (Prim (-1, D_True, [], []), ctxt) + | (Bool_t _, false) -> + Lwt.return (Gas.consume ctxt Unparse_costs.bool) + >>=? fun ctxt -> return (Prim (-1, D_False, [], []), ctxt) + | (Timestamp_t _, t) -> ( + Lwt.return (Gas.consume ctxt (Unparse_costs.timestamp t)) + >>=? fun ctxt -> + match mode with + | Optimized -> + return (Int (-1, Script_timestamp.to_zint t), ctxt) + | Readable -> ( + match Script_timestamp.to_notation t with + | None -> + return (Int (-1, Script_timestamp.to_zint t), ctxt) + | Some s -> + return (String (-1, s), ctxt) ) ) + | (Address_t _, (c, entrypoint)) -> ( + Lwt.return (Gas.consume ctxt Unparse_costs.contract) + >>=? fun ctxt -> + match mode with + | Optimized -> + let entrypoint = + match entrypoint with "default" -> "" | name -> name + in + let bytes = + Data_encoding.Binary.to_bytes_exn + Data_encoding.(tup2 Contract.encoding Variable.string) + (c, entrypoint) + in + return (Bytes (-1, bytes), ctxt) + | Readable -> + let notation = + match entrypoint with + | "default" -> + Contract.to_b58check c + | entrypoint -> + Contract.to_b58check c ^ "%" ^ entrypoint + in + return (String (-1, notation), ctxt) ) + | (Contract_t _, (_, (c, entrypoint))) -> ( + Lwt.return (Gas.consume ctxt Unparse_costs.contract) + >>=? fun ctxt -> + match mode with + | Optimized -> + let entrypoint = + match entrypoint with "default" -> "" | name -> name + in + let bytes = + Data_encoding.Binary.to_bytes_exn + Data_encoding.(tup2 Contract.encoding Variable.string) + (c, entrypoint) + in + return (Bytes (-1, bytes), ctxt) + | Readable -> + let notation = + match entrypoint with + | "default" -> + Contract.to_b58check c + | entrypoint -> + Contract.to_b58check c ^ "%" ^ entrypoint + in + return (String (-1, notation), ctxt) ) + | (Signature_t _, s) -> ( + Lwt.return (Gas.consume ctxt Unparse_costs.signature) + >>=? fun ctxt -> + match mode with + | Optimized -> + let bytes = Data_encoding.Binary.to_bytes_exn Signature.encoding s in + return (Bytes (-1, bytes), ctxt) + | Readable -> + return (String (-1, Signature.to_b58check s), ctxt) ) + | (Mutez_t _, v) -> + Lwt.return (Gas.consume ctxt Unparse_costs.tez) + >>=? fun ctxt -> return (Int (-1, Z.of_int64 (Tez.to_mutez v)), ctxt) + | (Key_t _, k) -> ( + Lwt.return (Gas.consume ctxt Unparse_costs.key) + >>=? fun ctxt -> + match mode with + | Optimized -> + let bytes = + Data_encoding.Binary.to_bytes_exn Signature.Public_key.encoding k + in + return (Bytes (-1, bytes), ctxt) + | Readable -> + return (String (-1, Signature.Public_key.to_b58check k), ctxt) ) + | (Key_hash_t _, k) -> ( + Lwt.return (Gas.consume ctxt Unparse_costs.key_hash) + >>=? fun ctxt -> + match mode with + | Optimized -> + let bytes = + Data_encoding.Binary.to_bytes_exn + Signature.Public_key_hash.encoding + k + in + return (Bytes (-1, bytes), ctxt) + | Readable -> + return (String (-1, Signature.Public_key_hash.to_b58check k), ctxt) ) + | (Operation_t _, (op, _big_map_diff)) -> + let bytes = + Data_encoding.Binary.to_bytes_exn + Operation.internal_operation_encoding + op + in + Lwt.return (Gas.consume ctxt (Unparse_costs.operation bytes)) + >>=? fun ctxt -> return (Bytes (-1, bytes), ctxt) + | (Chain_id_t _, chain_id) -> + let bytes = + Data_encoding.Binary.to_bytes_exn Chain_id.encoding chain_id + in + Lwt.return (Gas.consume ctxt (Unparse_costs.chain_id bytes)) + >>=? fun ctxt -> return (Bytes (-1, bytes), ctxt) + | (Pair_t ((tl, _, _), (tr, _, _), _, _), (l, r)) -> + Lwt.return (Gas.consume ctxt Unparse_costs.pair) + >>=? fun ctxt -> + unparse_data ctxt mode tl l + >>=? fun (l, ctxt) -> + unparse_data ctxt mode tr r + >>=? fun (r, ctxt) -> return (Prim (-1, D_Pair, [l; r], []), ctxt) + | (Union_t ((tl, _), _, _, _), L l) -> + Lwt.return (Gas.consume ctxt Unparse_costs.union) + >>=? fun ctxt -> + unparse_data ctxt mode tl l + >>=? fun (l, ctxt) -> return (Prim (-1, D_Left, [l], []), ctxt) + | (Union_t (_, (tr, _), _, _), R r) -> + Lwt.return (Gas.consume ctxt Unparse_costs.union) + >>=? fun ctxt -> + unparse_data ctxt mode tr r + >>=? fun (r, ctxt) -> return (Prim (-1, D_Right, [r], []), ctxt) + | (Option_t (t, _, _), Some v) -> + Lwt.return (Gas.consume ctxt Unparse_costs.some) + >>=? fun ctxt -> + unparse_data ctxt mode t v + >>=? fun (v, ctxt) -> return (Prim (-1, D_Some, [v], []), ctxt) + | (Option_t _, None) -> + Lwt.return (Gas.consume ctxt Unparse_costs.none) + >>=? fun ctxt -> return (Prim (-1, D_None, [], []), ctxt) + | (List_t (t, _, _), items) -> + fold_left_s + (fun (l, ctxt) element -> + Lwt.return (Gas.consume ctxt Unparse_costs.list_element) + >>=? fun ctxt -> + unparse_data ctxt mode t element + >>=? fun (unparsed, ctxt) -> return (unparsed :: l, ctxt)) + ([], ctxt) + items + >>=? fun (items, ctxt) -> + return (Micheline.Seq (-1, List.rev items), ctxt) + | (Set_t (t, _), set) -> + let t = ty_of_comparable_ty t in + fold_left_s + (fun (l, ctxt) item -> + Lwt.return (Gas.consume ctxt Unparse_costs.set_element) + >>=? fun ctxt -> + unparse_data ctxt mode t item + >>=? fun (item, ctxt) -> return (item :: l, ctxt)) + ([], ctxt) + (set_fold (fun e acc -> e :: acc) set []) + >>=? fun (items, ctxt) -> return (Micheline.Seq (-1, items), ctxt) + | (Map_t (kt, vt, _, _), map) -> + let kt = ty_of_comparable_ty kt in + fold_left_s + (fun (l, ctxt) (k, v) -> + Lwt.return (Gas.consume ctxt Unparse_costs.map_element) + >>=? fun ctxt -> + unparse_data ctxt mode kt k + >>=? fun (key, ctxt) -> + unparse_data ctxt mode vt v + >>=? fun (value, ctxt) -> + return (Prim (-1, D_Elt, [key; value], []) :: l, ctxt)) + ([], ctxt) + (map_fold (fun k v acc -> (k, v) :: acc) map []) + >>=? fun (items, ctxt) -> return (Micheline.Seq (-1, items), ctxt) + | (Big_map_t (kt, vt, _), {id = None; diff = (module Diff); _}) -> + (* this branch is to allow roundtrip of big map literals *) + let kt = ty_of_comparable_ty kt in + fold_left_s + (fun (l, ctxt) (k, v) -> + Lwt.return (Gas.consume ctxt Unparse_costs.map_element) + >>=? fun ctxt -> + unparse_data ctxt mode kt k + >>=? fun (key, ctxt) -> + unparse_data ctxt mode vt v + >>=? fun (value, ctxt) -> + return (Prim (-1, D_Elt, [key; value], []) :: l, ctxt)) + ([], ctxt) + (Diff.OPS.fold + (fun k v acc -> + match v with None -> acc | Some v -> (k, v) :: acc) + (fst Diff.boxed) + []) + >>=? fun (items, ctxt) -> return (Micheline.Seq (-1, items), ctxt) + | (Big_map_t (_kt, _kv, _), {id = Some id; diff = (module Diff); _}) -> + if Compare.Int.(Diff.OPS.cardinal (fst Diff.boxed) = 0) then + return (Micheline.Int (-1, id), ctxt) + else + (* this can only be the result of an execution and the map must have been flushed at this point *) - assert false - | Lambda_t _, Lam (_, original_code) -> - unparse_code ctxt mode original_code + assert false + | (Lambda_t _, Lam (_, original_code)) -> + unparse_code ctxt mode original_code (* Gas accounting may not be perfect in this function, as it is only called by RPCs. *) and unparse_code ctxt mode = let legacy = true in function - | Prim (loc, I_PUSH, [ ty ; data ], annot) -> - Lwt.return (parse_packable_ty ctxt ~legacy ty) >>=? fun (Ex_ty t, ctxt) -> - parse_data ctxt ~legacy t data >>=? fun (data, ctxt) -> - unparse_data ctxt mode t data >>=? fun (data, ctxt) -> - Lwt.return (Gas.consume ctxt (Unparse_costs.prim_cost 2 annot)) >>=? fun ctxt -> - return (Prim (loc, I_PUSH, [ ty ; data ], annot), ctxt) + | Prim (loc, I_PUSH, [ty; data], annot) -> + Lwt.return (parse_packable_ty ctxt ~legacy ty) + >>=? fun (Ex_ty t, ctxt) -> + parse_data ctxt ~legacy t data + >>=? fun (data, ctxt) -> + unparse_data ctxt mode t data + >>=? fun (data, ctxt) -> + Lwt.return (Gas.consume ctxt (Unparse_costs.prim_cost 2 annot)) + >>=? fun ctxt -> return (Prim (loc, I_PUSH, [ty; data], annot), ctxt) | Seq (loc, items) -> fold_left_s (fun (l, ctxt) item -> - unparse_code ctxt mode item >>=? fun (item, ctxt) -> - return (item :: l, ctxt)) - ([], ctxt) items >>=? fun (items, ctxt) -> - Lwt.return (Gas.consume ctxt (Unparse_costs.seq_cost (List.length items))) >>=? fun ctxt -> - return (Micheline.Seq (loc, List.rev items), ctxt) + unparse_code ctxt mode item + >>=? fun (item, ctxt) -> return (item :: l, ctxt)) + ([], ctxt) + items + >>=? fun (items, ctxt) -> + Lwt.return + (Gas.consume ctxt (Unparse_costs.seq_cost (List.length items))) + >>=? fun ctxt -> return (Micheline.Seq (loc, List.rev items), ctxt) | Prim (loc, prim, items, annot) -> fold_left_s (fun (l, ctxt) item -> - unparse_code ctxt mode item >>=? fun (item, ctxt) -> - return (item :: l, ctxt)) - ([], ctxt) items >>=? fun (items, ctxt) -> - Lwt.return (Gas.consume ctxt (Unparse_costs.prim_cost 3 annot)) >>=? fun ctxt -> - return (Prim (loc, prim, List.rev items, annot), ctxt) - | Int _ | String _ | Bytes _ as atom -> return (atom, ctxt) + unparse_code ctxt mode item + >>=? fun (item, ctxt) -> return (item :: l, ctxt)) + ([], ctxt) + items + >>=? fun (items, ctxt) -> + Lwt.return (Gas.consume ctxt (Unparse_costs.prim_cost 3 annot)) + >>=? fun ctxt -> return (Prim (loc, prim, List.rev items, annot), ctxt) + | (Int _ | String _ | Bytes _) as atom -> + return (atom, ctxt) (* Gas accounting may not be perfect in this function, as it is only called by RPCs. *) -let unparse_script ctxt mode { code ; arg_type ; storage ; storage_type ; root_name } = - let Lam (_, original_code) = code in - unparse_code ctxt mode original_code >>=? fun (code, ctxt) -> - unparse_data ctxt mode storage_type storage >>=? fun (storage, ctxt) -> - unparse_ty ctxt arg_type >>=? fun (arg_type, ctxt) -> - unparse_ty ctxt storage_type >>=? fun (storage_type, ctxt) -> - let arg_type = add_field_annot (Option.map ~f:(fun n -> `Field_annot n) root_name) None arg_type in +let unparse_script ctxt mode {code; arg_type; storage; storage_type; root_name} + = + let (Lam (_, original_code)) = code in + unparse_code ctxt mode original_code + >>=? fun (code, ctxt) -> + unparse_data ctxt mode storage_type storage + >>=? fun (storage, ctxt) -> + unparse_ty ctxt arg_type + >>=? fun (arg_type, ctxt) -> + unparse_ty ctxt storage_type + >>=? fun (storage_type, ctxt) -> + let arg_type = + add_field_annot + (Option.map ~f:(fun n -> `Field_annot n) root_name) + None + arg_type + in let open Micheline in let code = - Seq (-1, [ Prim (-1, K_parameter, [ arg_type ], []) ; - Prim (-1, K_storage, [ storage_type ], []) ; - Prim (-1, K_code, [ code ], []) ]) in + Seq + ( -1, + [ Prim (-1, K_parameter, [arg_type], []); + Prim (-1, K_storage, [storage_type], []); + Prim (-1, K_code, [code], []) ] ) + in Lwt.return - (Gas.consume ctxt (Unparse_costs.seq_cost 3) >>? fun ctxt -> - Gas.consume ctxt (Unparse_costs.prim_cost 1 []) >>? fun ctxt -> - Gas.consume ctxt (Unparse_costs.prim_cost 1 []) >>? fun ctxt -> - Gas.consume ctxt (Unparse_costs.prim_cost 1 [])) >>=? fun ctxt -> - return ({ code = lazy_expr (strip_locations code) ; - storage = lazy_expr (strip_locations storage) }, ctxt) + ( Gas.consume ctxt (Unparse_costs.seq_cost 3) + >>? fun ctxt -> + Gas.consume ctxt (Unparse_costs.prim_cost 1 []) + >>? fun ctxt -> + Gas.consume ctxt (Unparse_costs.prim_cost 1 []) + >>? fun ctxt -> Gas.consume ctxt (Unparse_costs.prim_cost 1 []) ) + >>=? fun ctxt -> + return + ( { + code = lazy_expr (strip_locations code); + storage = lazy_expr (strip_locations storage); + }, + ctxt ) let pack_data ctxt typ data = - unparse_data ctxt Optimized typ data >>=? fun (unparsed, ctxt) -> - let bytes = Data_encoding.Binary.to_bytes_exn expr_encoding (Micheline.strip_locations unparsed) in - Lwt.return @@ Gas.consume ctxt (Script.serialized_cost bytes) >>=? fun ctxt -> - let bytes = MBytes.concat "" [ MBytes.of_string "\005" ; bytes ] in - Lwt.return @@ Gas.consume ctxt (Script.serialized_cost bytes) >>=? fun ctxt -> - return (bytes, ctxt) + unparse_data ctxt Optimized typ data + >>=? fun (unparsed, ctxt) -> + let bytes = + Data_encoding.Binary.to_bytes_exn + expr_encoding + (Micheline.strip_locations unparsed) + in + Lwt.return @@ Gas.consume ctxt (Script.serialized_cost bytes) + >>=? fun ctxt -> + let bytes = MBytes.concat "" [MBytes.of_string "\005"; bytes] in + Lwt.return @@ Gas.consume ctxt (Script.serialized_cost bytes) + >>=? fun ctxt -> return (bytes, ctxt) let hash_data ctxt typ data = - pack_data ctxt typ data >>=? fun (bytes, ctxt) -> - Lwt.return @@ Gas.consume ctxt - (Michelson_v1_gas.Cost_of.Legacy.hash bytes Script_expr_hash.size) >>=? fun ctxt -> - return (Script_expr_hash.(hash_bytes [ bytes ]), ctxt) + pack_data ctxt typ data + >>=? fun (bytes, ctxt) -> + Lwt.return + @@ Gas.consume + ctxt + (Michelson_v1_gas.Cost_of.Legacy.hash bytes Script_expr_hash.size) + >>=? fun ctxt -> return (Script_expr_hash.(hash_bytes [bytes]), ctxt) (* ---------------- Big map -------------------------------------------------*) let empty_big_map tk tv = - { id = None ; diff = empty_map tk ; key_type = ty_of_comparable_ty tk ; value_type = tv } + { + id = None; + diff = empty_map tk; + key_type = ty_of_comparable_ty tk; + value_type = tv; + } -let big_map_mem ctxt key { id ; diff ; key_type ; _ } = - match map_get key diff, id with - | None, None -> return (false, ctxt) - | None, Some id -> hash_data ctxt key_type key >>=? fun (hash, ctxt) -> - Alpha_context.Big_map.mem ctxt id hash >>=? fun (ctxt, res) -> - return (res, ctxt) - | Some None, _ -> return (false, ctxt) - | Some (Some _), _ -> return (true, ctxt) +let big_map_mem ctxt key {id; diff; key_type; _} = + match (map_get key diff, id) with + | (None, None) -> + return (false, ctxt) + | (None, Some id) -> + hash_data ctxt key_type key + >>=? fun (hash, ctxt) -> + Alpha_context.Big_map.mem ctxt id hash + >>=? fun (ctxt, res) -> return (res, ctxt) + | (Some None, _) -> + return (false, ctxt) + | (Some (Some _), _) -> + return (true, ctxt) -let big_map_get ctxt key { id ; diff ; key_type ; value_type } = - match map_get key diff, id with - | Some x, _ -> return (x, ctxt) - | None, None -> return (None, ctxt) - | None, Some id -> - hash_data ctxt key_type key >>=? fun (hash, ctxt) -> - Alpha_context.Big_map.get_opt - ctxt id hash >>=? begin function - | (ctxt, None) -> return (None, ctxt) - | (ctxt, Some value) -> - parse_data ctxt ~legacy:true value_type - (Micheline.root value) >>=? fun (x, ctxt) -> - return (Some x, ctxt) - end +let big_map_get ctxt key {id; diff; key_type; value_type} = + match (map_get key diff, id) with + | (Some x, _) -> + return (x, ctxt) + | (None, None) -> + return (None, ctxt) + | (None, Some id) -> ( + hash_data ctxt key_type key + >>=? fun (hash, ctxt) -> + Alpha_context.Big_map.get_opt ctxt id hash + >>=? function + | (ctxt, None) -> + return (None, ctxt) + | (ctxt, Some value) -> + parse_data ctxt ~legacy:true value_type (Micheline.root value) + >>=? fun (x, ctxt) -> return (Some x, ctxt) ) -let big_map_update key value ({ diff ; _ } as map) = - { map with diff = map_set key value diff } +let big_map_update key value ({diff; _} as map) = + {map with diff = map_set key value diff} module Ids = Set.Make (Compare.Z) @@ -3873,15 +5802,18 @@ type big_map_ids = Ids.t let no_big_map_id = Ids.empty -let diff_of_big_map ctxt fresh mode ~ids { id ; key_type ; value_type ; diff } = - Lwt.return (Gas.consume ctxt (Michelson_v1_gas.Cost_of.Legacy.map_to_list diff)) >>=? fun ctxt -> - begin match id with - | Some id -> - if Ids.mem id ids then - fresh ctxt >>=? fun (ctxt, duplicate) -> - return (ctxt, [ Contract.Copy (id, duplicate) ], duplicate) - else - (* The first occurence encountered of a big_map reuses the +let diff_of_big_map ctxt fresh mode ~ids {id; key_type; value_type; diff} = + Lwt.return + (Gas.consume ctxt (Michelson_v1_gas.Cost_of.Legacy.map_to_list diff)) + >>=? fun ctxt -> + ( match id with + | Some id -> + if Ids.mem id ids then + fresh ctxt + >>=? fun (ctxt, duplicate) -> + return (ctxt, [Contract.Copy (id, duplicate)], duplicate) + else + (* The first occurence encountered of a big_map reuses the ID. This way, the payer is only charged for the diff. For this to work, this diff has to be put at the end of the global diff, otherwise the duplicates will use the @@ -3889,171 +5821,277 @@ let diff_of_big_map ctxt fresh mode ~ids { id ; key_type ; value_type ; diff } = this diff first in the accumulator of `extract_big_map_updates`, and this accumulator is not reversed before being flattened. *) - return (ctxt, [], id) - | None -> - fresh ctxt >>=? fun (ctxt, id) -> - unparse_ty ctxt key_type >>=? fun (kt, ctxt) -> - unparse_ty ctxt value_type >>=? fun (kv, ctxt) -> - return (ctxt, [ Contract.Alloc { big_map = id ; - key_type = Micheline.strip_locations kt ; - value_type = Micheline.strip_locations kv } ], id) - end >>=? fun (ctxt, init, big_map) -> + return (ctxt, [], id) + | None -> + fresh ctxt + >>=? fun (ctxt, id) -> + unparse_ty ctxt key_type + >>=? fun (kt, ctxt) -> + unparse_ty ctxt value_type + >>=? fun (kv, ctxt) -> + return + ( ctxt, + [ Contract.Alloc + { + big_map = id; + key_type = Micheline.strip_locations kt; + value_type = Micheline.strip_locations kv; + } ], + id ) ) + >>=? fun (ctxt, init, big_map) -> let pairs = map_fold (fun key value acc -> (key, value) :: acc) diff [] in fold_left_s (fun (acc, ctxt) (key, value) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - hash_data ctxt key_type key >>=? fun (diff_key_hash, ctxt) -> - unparse_data ctxt mode key_type key >>=? fun (key_node, ctxt) -> - let diff_key = Micheline.strip_locations key_node in - begin - match value with - | None -> return (None, ctxt) - | Some x -> - begin - unparse_data ctxt mode value_type x >>=? fun (node, ctxt) -> - return (Some (Micheline.strip_locations node), ctxt) - end - end >>=? fun (diff_value, ctxt) -> - let diff_item = Contract.Update { big_map ; diff_key ; diff_key_hash ; diff_value } in - return (diff_item :: acc, ctxt)) - ([], ctxt) pairs >>=? fun (diff, ctxt) -> - return (init @ diff, big_map, ctxt) + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + hash_data ctxt key_type key + >>=? fun (diff_key_hash, ctxt) -> + unparse_data ctxt mode key_type key + >>=? fun (key_node, ctxt) -> + let diff_key = Micheline.strip_locations key_node in + ( match value with + | None -> + return (None, ctxt) + | Some x -> + unparse_data ctxt mode value_type x + >>=? fun (node, ctxt) -> + return (Some (Micheline.strip_locations node), ctxt) ) + >>=? fun (diff_value, ctxt) -> + let diff_item = + Contract.Update {big_map; diff_key; diff_key_hash; diff_value} + in + return (diff_item :: acc, ctxt)) + ([], ctxt) + pairs + >>=? fun (diff, ctxt) -> return (init @ diff, big_map, ctxt) -let rec extract_big_map_updates - : type a. context -> (context -> (context * Big_map.id) tzresult Lwt.t) -> - unparsing_mode -> Ids.t -> Contract.big_map_diff list -> a ty -> a -> - (context * a * Ids.t * Contract.big_map_diff list) tzresult Lwt.t - = fun ctxt fresh mode ids acc ty x -> - match (ty, x) with - | Big_map_t (_, _, _), map -> - diff_of_big_map ctxt fresh mode ids map >>=? fun (diff, id, ctxt) -> - let (module Map) = map.diff in - let map = { map with diff = empty_map Map.key_ty ; id = Some id } in - return (ctxt, map, Ids.add id ids, diff :: acc) - | Pair_t ((tyl, _, _), (tyr, _, _), _, true), (xl, xr) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - extract_big_map_updates ctxt fresh mode ids acc tyl xl >>=? fun (ctxt, xl, ids, acc) -> - extract_big_map_updates ctxt fresh mode ids acc tyr xr >>=? fun (ctxt, xr, ids, acc) -> - return (ctxt, (xl, xr), ids, acc) - | Union_t ((ty, _), (_, _), _, true), L x -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - extract_big_map_updates ctxt fresh mode ids acc ty x >>=? fun (ctxt, x, ids, acc) -> - return (ctxt, L x, ids, acc) - | Union_t ((_, _), (ty, _), _, true), R x -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - extract_big_map_updates ctxt fresh mode ids acc ty x >>=? fun (ctxt, x, ids, acc) -> - return (ctxt, R x, ids, acc) - | Option_t (ty, _, true), Some x -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - extract_big_map_updates ctxt fresh mode ids acc ty x >>=? fun (ctxt, x, ids, acc) -> - return (ctxt, Some x, ids, acc) - | List_t (ty, _, true), l -> - fold_left_s - (fun (ctxt, l, ids, acc) x -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - extract_big_map_updates ctxt fresh mode ids acc ty x >>=? fun (ctxt, x, ids, acc) -> - return (ctxt, x :: l, ids, acc)) - (ctxt, [], ids, acc) l >>=? fun (ctxt, l, ids, acc) -> - return (ctxt, List.rev l, ids, acc) - | Map_t (_, ty, _, true), ((module M) as m) -> - Lwt.return (Gas.consume ctxt (Michelson_v1_gas.Cost_of.Legacy.map_to_list m)) >>=? fun ctxt -> - fold_left_s - (fun (ctxt, m, ids, acc) (k, x) -> - Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) >>=? fun ctxt -> - extract_big_map_updates ctxt fresh mode ids acc ty x >>=? fun (ctxt, x, ids, acc) -> - return (ctxt, M.OPS.add k x m, ids, acc)) - (ctxt, M.OPS.empty, ids, acc) (M.OPS.bindings (fst M.boxed)) >>=? fun (ctxt, m, ids, acc) -> - let module M = struct - module OPS = M.OPS - type key = M.key - type value = M.value - let key_ty = M.key_ty - let boxed = m, (snd M.boxed) - end in - return (ctxt, (module M : Boxed_map with type key = M.key and type value = M.value), ids, acc) - | Option_t (_, _, true), None -> return (ctxt, None, ids, acc) - | List_t (_, _, false), v -> return (ctxt, v, ids, acc) - | Map_t (_, _, _, false), v -> return (ctxt, v, ids, acc) - | Option_t (_, _, false), None -> return (ctxt, None, ids, acc) - | Pair_t (_, _, _, false), v -> return (ctxt, v, ids, acc) - | Union_t (_, _, _, false), v -> return (ctxt, v, ids, acc) - | Option_t (_, _, false), v -> return (ctxt, v, ids, acc) - | Chain_id_t _, v -> return (ctxt, v, ids, acc) - | Set_t (_, _), v -> return (ctxt, v, ids, acc) - | Unit_t _, v -> return (ctxt, v, ids, acc) - | Int_t _, v -> return (ctxt, v, ids, acc) - | Nat_t _, v -> return (ctxt, v, ids, acc) - | Signature_t _, v -> return (ctxt, v, ids, acc) - | String_t _, v -> return (ctxt, v, ids, acc) - | Bytes_t _, v -> return (ctxt, v, ids, acc) - | Mutez_t _, v -> return (ctxt, v, ids, acc) - | Key_hash_t _, v -> return (ctxt, v, ids, acc) - | Key_t _, v -> return (ctxt, v, ids, acc) - | Timestamp_t _, v -> return (ctxt, v, ids, acc) - | Address_t _, v -> return (ctxt, v, ids, acc) - | Bool_t _, v -> return (ctxt, v, ids, acc) - | Lambda_t (_, _, _), v -> return (ctxt, v, ids, acc) - | Contract_t (_, _), v -> return (ctxt, v, ids, acc) - | Operation_t _, _ -> assert false (* called only on parameters and storage, which cannot contain operations *) +let rec extract_big_map_updates : + type a. + context -> + (context -> (context * Big_map.id) tzresult Lwt.t) -> + unparsing_mode -> + Ids.t -> + Contract.big_map_diff list -> + a ty -> + a -> + (context * a * Ids.t * Contract.big_map_diff list) tzresult Lwt.t = + fun ctxt fresh mode ids acc ty x -> + match (ty, x) with + | (Big_map_t (_, _, _), map) -> + diff_of_big_map ctxt fresh mode ids map + >>=? fun (diff, id, ctxt) -> + let (module Map) = map.diff in + let map = {map with diff = empty_map Map.key_ty; id = Some id} in + return (ctxt, map, Ids.add id ids, diff :: acc) + | (Pair_t ((tyl, _, _), (tyr, _, _), _, true), (xl, xr)) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + extract_big_map_updates ctxt fresh mode ids acc tyl xl + >>=? fun (ctxt, xl, ids, acc) -> + extract_big_map_updates ctxt fresh mode ids acc tyr xr + >>=? fun (ctxt, xr, ids, acc) -> return (ctxt, (xl, xr), ids, acc) + | (Union_t ((ty, _), (_, _), _, true), L x) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + extract_big_map_updates ctxt fresh mode ids acc ty x + >>=? fun (ctxt, x, ids, acc) -> return (ctxt, L x, ids, acc) + | (Union_t ((_, _), (ty, _), _, true), R x) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + extract_big_map_updates ctxt fresh mode ids acc ty x + >>=? fun (ctxt, x, ids, acc) -> return (ctxt, R x, ids, acc) + | (Option_t (ty, _, true), Some x) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + extract_big_map_updates ctxt fresh mode ids acc ty x + >>=? fun (ctxt, x, ids, acc) -> return (ctxt, Some x, ids, acc) + | (List_t (ty, _, true), l) -> + fold_left_s + (fun (ctxt, l, ids, acc) x -> + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + extract_big_map_updates ctxt fresh mode ids acc ty x + >>=? fun (ctxt, x, ids, acc) -> return (ctxt, x :: l, ids, acc)) + (ctxt, [], ids, acc) + l + >>=? fun (ctxt, l, ids, acc) -> return (ctxt, List.rev l, ids, acc) + | (Map_t (_, ty, _, true), ((module M) as m)) -> + Lwt.return + (Gas.consume ctxt (Michelson_v1_gas.Cost_of.Legacy.map_to_list m)) + >>=? fun ctxt -> + fold_left_s + (fun (ctxt, m, ids, acc) (k, x) -> + Lwt.return (Gas.consume ctxt Typecheck_costs.cycle) + >>=? fun ctxt -> + extract_big_map_updates ctxt fresh mode ids acc ty x + >>=? fun (ctxt, x, ids, acc) -> + return (ctxt, M.OPS.add k x m, ids, acc)) + (ctxt, M.OPS.empty, ids, acc) + (M.OPS.bindings (fst M.boxed)) + >>=? fun (ctxt, m, ids, acc) -> + let module M = struct + module OPS = M.OPS + + type key = M.key + + type value = M.value + + let key_ty = M.key_ty + + let boxed = (m, snd M.boxed) + end in + return + ( ctxt, + (module M : Boxed_map with type key = M.key and type value = M.value), + ids, + acc ) + | (Option_t (_, _, true), None) -> + return (ctxt, None, ids, acc) + | (List_t (_, _, false), v) -> + return (ctxt, v, ids, acc) + | (Map_t (_, _, _, false), v) -> + return (ctxt, v, ids, acc) + | (Option_t (_, _, false), None) -> + return (ctxt, None, ids, acc) + | (Pair_t (_, _, _, false), v) -> + return (ctxt, v, ids, acc) + | (Union_t (_, _, _, false), v) -> + return (ctxt, v, ids, acc) + | (Option_t (_, _, false), v) -> + return (ctxt, v, ids, acc) + | (Chain_id_t _, v) -> + return (ctxt, v, ids, acc) + | (Set_t (_, _), v) -> + return (ctxt, v, ids, acc) + | (Unit_t _, v) -> + return (ctxt, v, ids, acc) + | (Int_t _, v) -> + return (ctxt, v, ids, acc) + | (Nat_t _, v) -> + return (ctxt, v, ids, acc) + | (Signature_t _, v) -> + return (ctxt, v, ids, acc) + | (String_t _, v) -> + return (ctxt, v, ids, acc) + | (Bytes_t _, v) -> + return (ctxt, v, ids, acc) + | (Mutez_t _, v) -> + return (ctxt, v, ids, acc) + | (Key_hash_t _, v) -> + return (ctxt, v, ids, acc) + | (Key_t _, v) -> + return (ctxt, v, ids, acc) + | (Timestamp_t _, v) -> + return (ctxt, v, ids, acc) + | (Address_t _, v) -> + return (ctxt, v, ids, acc) + | (Bool_t _, v) -> + return (ctxt, v, ids, acc) + | (Lambda_t (_, _, _), v) -> + return (ctxt, v, ids, acc) + | (Contract_t (_, _), v) -> + return (ctxt, v, ids, acc) + | (Operation_t _, _) -> + assert false + +(* called only on parameters and storage, which cannot contain operations *) let collect_big_maps ctxt ty x = - let rec collect - : type a. context -> a ty -> a -> Ids.t -> (Ids.t * context) tzresult - = fun ctxt ty x acc -> - match (ty, x) with - | Big_map_t (_, _, _), { id = Some id } -> - Gas.consume ctxt Typecheck_costs.cycle >>? fun ctxt -> - ok (Ids.add id acc, ctxt) - | Pair_t ((tyl, _, _), (tyr, _, _), _, true), (xl, xr) -> - collect ctxt tyl xl acc >>? fun (acc, ctxt) -> - collect ctxt tyr xr acc - | Union_t ((ty, _), (_, _), _, true), L x -> - collect ctxt ty x acc - | Union_t ((_, _), (ty, _), _, true), R x -> - collect ctxt ty x acc - | Option_t (ty, _, true), Some x -> - collect ctxt ty x acc - | List_t (ty, _, true), l -> - List.fold_left (fun acc x -> acc >>? fun (acc, ctxt) -> collect ctxt ty x acc) (ok (acc, ctxt)) l - | Map_t (_, ty, _, true), m -> - map_fold (fun _ v acc -> acc >>? fun (acc, ctxt) -> collect ctxt ty v acc) m (ok (acc, ctxt)) - | List_t (_, _, false), _ -> ok (acc, ctxt) - | Map_t (_, _, _, false), _ -> ok (acc, ctxt) - | Big_map_t (_, _, _), { id = None } -> ok (acc, ctxt) - | Option_t (_, _, true), None -> ok (acc, ctxt) - | Option_t (_, _, false), _ -> ok (acc, ctxt) - | Union_t (_, _, _, false), _ -> ok (acc, ctxt) - | Pair_t (_, _, _, false), _ -> ok (acc, ctxt) - | Chain_id_t _, _ -> ok (acc, ctxt) - | Set_t (_, _), _ -> ok (acc, ctxt) - | Unit_t _, _ -> ok (acc, ctxt) - | Int_t _, _ -> ok (acc, ctxt) - | Nat_t _, _ -> ok (acc, ctxt) - | Signature_t _, _ -> ok (acc, ctxt) - | String_t _, _ -> ok (acc, ctxt) - | Bytes_t _, _ -> ok (acc, ctxt) - | Mutez_t _, _ -> ok (acc, ctxt) - | Key_hash_t _, _ -> ok (acc, ctxt) - | Key_t _, _ -> ok (acc, ctxt) - | Timestamp_t _, _ -> ok (acc, ctxt) - | Address_t _, _ -> ok (acc, ctxt) - | Bool_t _, _ -> ok (acc, ctxt) - | Lambda_t (_, _, _), _ -> ok (acc, ctxt) - | Contract_t (_, _), _ -> ok (acc, ctxt) - | Operation_t _, _ -> assert false (* called only on parameters and storage, which cannot contain operations *) in + let rec collect : + type a. context -> a ty -> a -> Ids.t -> (Ids.t * context) tzresult = + fun ctxt ty x acc -> + match (ty, x) with + | (Big_map_t (_, _, _), {id = Some id}) -> + Gas.consume ctxt Typecheck_costs.cycle + >>? fun ctxt -> ok (Ids.add id acc, ctxt) + | (Pair_t ((tyl, _, _), (tyr, _, _), _, true), (xl, xr)) -> + collect ctxt tyl xl acc >>? fun (acc, ctxt) -> collect ctxt tyr xr acc + | (Union_t ((ty, _), (_, _), _, true), L x) -> + collect ctxt ty x acc + | (Union_t ((_, _), (ty, _), _, true), R x) -> + collect ctxt ty x acc + | (Option_t (ty, _, true), Some x) -> + collect ctxt ty x acc + | (List_t (ty, _, true), l) -> + List.fold_left + (fun acc x -> acc >>? fun (acc, ctxt) -> collect ctxt ty x acc) + (ok (acc, ctxt)) + l + | (Map_t (_, ty, _, true), m) -> + map_fold + (fun _ v acc -> acc >>? fun (acc, ctxt) -> collect ctxt ty v acc) + m + (ok (acc, ctxt)) + | (List_t (_, _, false), _) -> + ok (acc, ctxt) + | (Map_t (_, _, _, false), _) -> + ok (acc, ctxt) + | (Big_map_t (_, _, _), {id = None}) -> + ok (acc, ctxt) + | (Option_t (_, _, true), None) -> + ok (acc, ctxt) + | (Option_t (_, _, false), _) -> + ok (acc, ctxt) + | (Union_t (_, _, _, false), _) -> + ok (acc, ctxt) + | (Pair_t (_, _, _, false), _) -> + ok (acc, ctxt) + | (Chain_id_t _, _) -> + ok (acc, ctxt) + | (Set_t (_, _), _) -> + ok (acc, ctxt) + | (Unit_t _, _) -> + ok (acc, ctxt) + | (Int_t _, _) -> + ok (acc, ctxt) + | (Nat_t _, _) -> + ok (acc, ctxt) + | (Signature_t _, _) -> + ok (acc, ctxt) + | (String_t _, _) -> + ok (acc, ctxt) + | (Bytes_t _, _) -> + ok (acc, ctxt) + | (Mutez_t _, _) -> + ok (acc, ctxt) + | (Key_hash_t _, _) -> + ok (acc, ctxt) + | (Key_t _, _) -> + ok (acc, ctxt) + | (Timestamp_t _, _) -> + ok (acc, ctxt) + | (Address_t _, _) -> + ok (acc, ctxt) + | (Bool_t _, _) -> + ok (acc, ctxt) + | (Lambda_t (_, _, _), _) -> + ok (acc, ctxt) + | (Contract_t (_, _), _) -> + ok (acc, ctxt) + | (Operation_t _, _) -> + assert false + (* called only on parameters and storage, which cannot contain operations *) + in Lwt.return (collect ctxt ty x no_big_map_id) -let extract_big_map_diff ctxt mode - ~temporary ~to_duplicate ~to_update - ty v = +let extract_big_map_diff ctxt mode ~temporary ~to_duplicate ~to_update ty v = let to_duplicate = Ids.diff to_duplicate to_update in - let fresh = if temporary then (fun c -> return (Big_map.fresh_temporary c)) else Big_map.fresh in - extract_big_map_updates ctxt fresh mode to_duplicate [] ty v >>=? fun (ctxt, v, alive, diffs) -> - let diffs = if temporary then diffs else + let fresh = + if temporary then fun c -> return (Big_map.fresh_temporary c) + else Big_map.fresh + in + extract_big_map_updates ctxt fresh mode to_duplicate [] ty v + >>=? fun (ctxt, v, alive, diffs) -> + let diffs = + if temporary then diffs + else let dead = Ids.diff to_update alive in - Ids.fold (fun id acc -> Contract.Clear id :: acc) dead [] :: diffs in + Ids.fold (fun id acc -> Contract.Clear id :: acc) dead [] :: diffs + in match diffs with - | [] -> return (v, None, ctxt) - | diffs -> return (v, Some (List.flatten diffs (* do not reverse *)), ctxt) + | [] -> + return (v, None, ctxt) + | diffs -> + return (v, Some (List.flatten diffs (* do not reverse *)), ctxt) let list_of_big_map_ids ids = Ids.elements ids diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.mli b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.mli index 4781e86ef..af93ffdb5 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_ir_translator.mli @@ -28,160 +28,248 @@ open Script_tc_errors type ('ta, 'tb) eq = Eq : ('same, 'same) eq -type ex_comparable_ty = Ex_comparable_ty : 'a Script_typed_ir.comparable_ty -> ex_comparable_ty +type ex_comparable_ty = + | Ex_comparable_ty : 'a Script_typed_ir.comparable_ty -> ex_comparable_ty + type ex_ty = Ex_ty : 'a Script_typed_ir.ty -> ex_ty + type ex_stack_ty = Ex_stack_ty : 'a Script_typed_ir.stack_ty -> ex_stack_ty + type ex_script = Ex_script : ('a, 'b) Script_typed_ir.script -> ex_script + type tc_context = | Lambda : tc_context | Dip : 'a Script_typed_ir.stack_ty * tc_context -> tc_context - | Toplevel : { storage_type : 'sto Script_typed_ir.ty ; - param_type : 'param Script_typed_ir.ty ; - root_name : string option ; - legacy_create_contract_literal : bool } -> tc_context + | Toplevel : { + storage_type : 'sto Script_typed_ir.ty; + param_type : 'param Script_typed_ir.ty; + root_name : string option; + legacy_create_contract_literal : bool; + } + -> tc_context + type 'bef judgement = | Typed : ('bef, 'aft) Script_typed_ir.descr -> 'bef judgement - | Failed : - { descr : 'aft. 'aft Script_typed_ir.stack_ty -> ('bef, 'aft) Script_typed_ir.descr } -> 'bef judgement + | Failed : { + descr : + 'aft. 'aft Script_typed_ir.stack_ty -> + ('bef, 'aft) Script_typed_ir.descr; + } + -> 'bef judgement type unparsing_mode = Optimized | Readable type type_logger = - int -> (Script.expr * Script.annot) list -> (Script.expr * Script.annot) list -> unit + int -> + (Script.expr * Script.annot) list -> + (Script.expr * Script.annot) list -> + unit (* ---- Sets and Maps -------------------------------------------------------*) val empty_set : 'a Script_typed_ir.comparable_ty -> 'a Script_typed_ir.set + val set_fold : - ('elt -> 'acc -> 'acc) -> - 'elt Script_typed_ir.set -> 'acc -> 'acc + ('elt -> 'acc -> 'acc) -> 'elt Script_typed_ir.set -> 'acc -> 'acc + val set_update : 'a -> bool -> 'a Script_typed_ir.set -> 'a Script_typed_ir.set + val set_mem : 'elt -> 'elt Script_typed_ir.set -> bool + val set_size : 'elt Script_typed_ir.set -> Script_int.n Script_int.num -val empty_map : 'a Script_typed_ir.comparable_ty -> ('a, 'b) Script_typed_ir.map +val empty_map : + 'a Script_typed_ir.comparable_ty -> ('a, 'b) Script_typed_ir.map + val map_fold : ('key -> 'value -> 'acc -> 'acc) -> - ('key, 'value) Script_typed_ir.map -> 'acc -> 'acc -val map_update : - 'a -> 'b option -> ('a, 'b) Script_typed_ir.map -> ('a, 'b) Script_typed_ir.map -val map_mem : 'key -> ('key, 'value) Script_typed_ir.map -> bool -val map_get : 'key -> ('key, 'value) Script_typed_ir.map -> 'value option -val map_key_ty : ('a, 'b) Script_typed_ir.map -> 'a Script_typed_ir.comparable_ty -val map_size : ('a, 'b) Script_typed_ir.map -> Script_int.n Script_int.num + ('key, 'value) Script_typed_ir.map -> + 'acc -> + 'acc -val empty_big_map : 'a Script_typed_ir.comparable_ty -> 'b Script_typed_ir.ty -> ('a, 'b) Script_typed_ir.big_map -val big_map_mem : - context -> 'key -> - ('key, 'value) Script_typed_ir.big_map -> - (bool * context) tzresult Lwt.t -val big_map_get : - context -> 'key -> - ('key, 'value) Script_typed_ir.big_map -> - ('value option * context) tzresult Lwt.t -val big_map_update : - 'key -> 'value option -> ('key, 'value) Script_typed_ir.big_map -> - ('key, 'value) Script_typed_ir.big_map +val map_update : + 'a -> + 'b option -> + ('a, 'b) Script_typed_ir.map -> + ('a, 'b) Script_typed_ir.map val has_big_map : 't Script_typed_ir.ty -> bool +val ty_of_comparable_ty : ('a, 's) Script_typed_ir.comparable_struct -> 'a Script_typed_ir.ty +val map_mem : 'key -> ('key, 'value) Script_typed_ir.map -> bool + +val map_get : 'key -> ('key, 'value) Script_typed_ir.map -> 'value option + +val map_key_ty : + ('a, 'b) Script_typed_ir.map -> 'a Script_typed_ir.comparable_ty + +val map_size : ('a, 'b) Script_typed_ir.map -> Script_int.n Script_int.num + +val empty_big_map : + 'a Script_typed_ir.comparable_ty -> + 'b Script_typed_ir.ty -> + ('a, 'b) Script_typed_ir.big_map + +val big_map_mem : + context -> + 'key -> + ('key, 'value) Script_typed_ir.big_map -> + (bool * context) tzresult Lwt.t + +val big_map_get : + context -> + 'key -> + ('key, 'value) Script_typed_ir.big_map -> + ('value option * context) tzresult Lwt.t + +val big_map_update : + 'key -> + 'value option -> + ('key, 'value) Script_typed_ir.big_map -> + ('key, 'value) Script_typed_ir.big_map val ty_eq : context -> - 'ta Script_typed_ir.ty -> 'tb Script_typed_ir.ty -> + 'ta Script_typed_ir.ty -> + 'tb Script_typed_ir.ty -> (('ta Script_typed_ir.ty, 'tb Script_typed_ir.ty) eq * context) tzresult val compare_comparable : 'a Script_typed_ir.comparable_ty -> 'a -> 'a -> int -val ty_of_comparable_ty : ('a, 's) Script_typed_ir.comparable_struct -> 'a Script_typed_ir.ty - val parse_data : - ?type_logger: type_logger -> - context -> legacy: bool -> - 'a Script_typed_ir.ty -> Script.node -> ('a * context) tzresult Lwt.t + ?type_logger:type_logger -> + context -> + legacy:bool -> + 'a Script_typed_ir.ty -> + Script.node -> + ('a * context) tzresult Lwt.t + val unparse_data : - context -> unparsing_mode -> 'a Script_typed_ir.ty -> 'a -> + context -> + unparsing_mode -> + 'a Script_typed_ir.ty -> + 'a -> (Script.node * context) tzresult Lwt.t val parse_instr : - ?type_logger: type_logger -> - tc_context -> context -> legacy: bool -> - Script.node -> 'bef Script_typed_ir.stack_ty -> ('bef judgement * context) tzresult Lwt.t + ?type_logger:type_logger -> + tc_context -> + context -> + legacy:bool -> + Script.node -> + 'bef Script_typed_ir.stack_ty -> + ('bef judgement * context) tzresult Lwt.t val parse_ty : - context -> legacy: bool -> - allow_big_map: bool -> - allow_operation: bool -> - allow_contract: bool -> - Script.node -> (ex_ty * context) tzresult + context -> + legacy:bool -> + allow_big_map:bool -> + allow_operation:bool -> + allow_contract:bool -> + Script.node -> + (ex_ty * context) tzresult val parse_packable_ty : - context -> legacy: bool -> Script.node -> (ex_ty * context) tzresult + context -> legacy:bool -> Script.node -> (ex_ty * context) tzresult val unparse_ty : context -> 'a Script_typed_ir.ty -> (Script.node * context) tzresult Lwt.t val parse_toplevel : - legacy: bool -> Script.expr -> (Script.node * Script.node * Script.node * string option) tzresult + legacy:bool -> + Script.expr -> + (Script.node * Script.node * Script.node * string option) tzresult val add_field_annot : - [ `Field_annot of string ] option -> [ `Var_annot of string ] option -> Script.node -> Script.node + [`Field_annot of string] option -> + [`Var_annot of string] option -> + Script.node -> + Script.node val typecheck_code : context -> Script.expr -> (type_map * context) tzresult Lwt.t val typecheck_data : - ?type_logger: type_logger -> - context -> Script.expr * Script.expr -> context tzresult Lwt.t + ?type_logger:type_logger -> + context -> + Script.expr * Script.expr -> + context tzresult Lwt.t val parse_script : - ?type_logger: type_logger -> - context -> legacy: bool -> Script.t -> (ex_script * context) tzresult Lwt.t + ?type_logger:type_logger -> + context -> + legacy:bool -> + Script.t -> + (ex_script * context) tzresult Lwt.t (* Gas accounting may not be perfect in this function, as it is only called by RPCs. *) val unparse_script : - context -> unparsing_mode -> - ('a, 'b) Script_typed_ir.script -> (Script.t * context) tzresult Lwt.t + context -> + unparsing_mode -> + ('a, 'b) Script_typed_ir.script -> + (Script.t * context) tzresult Lwt.t val parse_contract : - legacy: bool -> context -> Script.location -> 'a Script_typed_ir.ty -> Contract.t -> - entrypoint: string -> + legacy:bool -> + context -> + Script.location -> + 'a Script_typed_ir.ty -> + Contract.t -> + entrypoint:string -> (context * 'a Script_typed_ir.typed_contract) tzresult Lwt.t val parse_contract_for_script : - legacy: bool -> context -> Script.location -> 'a Script_typed_ir.ty -> Contract.t -> - entrypoint: string -> + legacy:bool -> + context -> + Script.location -> + 'a Script_typed_ir.ty -> + Contract.t -> + entrypoint:string -> (context * 'a Script_typed_ir.typed_contract option) tzresult Lwt.t val find_entrypoint : - 't Script_typed_ir.ty -> root_name: string option -> string -> ((Script.node -> Script.node) * ex_ty) tzresult + 't Script_typed_ir.ty -> + root_name:string option -> + string -> + ((Script.node -> Script.node) * ex_ty) tzresult module Entrypoints_map : S.MAP with type key = string val list_entrypoints : 't Script_typed_ir.ty -> context -> - root_name: string option -> - (Michelson_v1_primitives.prim list list * - (Michelson_v1_primitives.prim list * Script.node) Entrypoints_map.t) - tzresult + root_name:string option -> + ( Michelson_v1_primitives.prim list list + * (Michelson_v1_primitives.prim list * Script.node) Entrypoints_map.t ) + tzresult -val pack_data : context -> 'a Script_typed_ir.ty -> 'a -> (MBytes.t * context) tzresult Lwt.t -val hash_data : context -> 'a Script_typed_ir.ty -> 'a -> (Script_expr_hash.t * context) tzresult Lwt.t +val pack_data : + context -> 'a Script_typed_ir.ty -> 'a -> (MBytes.t * context) tzresult Lwt.t + +val hash_data : + context -> + 'a Script_typed_ir.ty -> + 'a -> + (Script_expr_hash.t * context) tzresult Lwt.t type big_map_ids val no_big_map_id : big_map_ids val collect_big_maps : - context -> 'a Script_typed_ir.ty -> 'a -> (big_map_ids * context) tzresult Lwt.t + context -> + 'a Script_typed_ir.ty -> + 'a -> + (big_map_ids * context) tzresult Lwt.t val list_of_big_map_ids : big_map_ids -> Z.t list val extract_big_map_diff : - context -> unparsing_mode -> - temporary: bool -> - to_duplicate: big_map_ids -> - to_update: big_map_ids -> - 'a Script_typed_ir.ty -> 'a -> + context -> + unparsing_mode -> + temporary:bool -> + to_duplicate:big_map_ids -> + to_update:big_map_ids -> + 'a Script_typed_ir.ty -> + 'a -> ('a * Contract.big_map_diff option * context) tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_repr.ml index 81effec8f..f00b6d0b3 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_repr.ml @@ -35,8 +35,6 @@ type lazy_expr = expr Data_encoding.lazy_t type node = (location, Michelson_v1_primitives.prim) Micheline.node - - let expr_encoding = Micheline.canonical_encoding_v1 ~variant:"michelson_v1" @@ -45,60 +43,57 @@ let expr_encoding = type error += Lazy_script_decode (* `Permanent *) let () = - register_error_kind `Permanent + register_error_kind + `Permanent ~id:"invalid_binary_format" ~title:"Invalid binary format" - ~description:"Could not deserialize some piece of data \ - from its binary representation" + ~description: + "Could not deserialize some piece of data from its binary representation" Data_encoding.empty (function Lazy_script_decode -> Some () | _ -> None) (fun () -> Lazy_script_decode) -let lazy_expr_encoding = - Data_encoding.lazy_encoding expr_encoding +let lazy_expr_encoding = Data_encoding.lazy_encoding expr_encoding -let lazy_expr expr = - Data_encoding.make_lazy expr_encoding expr +let lazy_expr expr = Data_encoding.make_lazy expr_encoding expr -type t = { - code : lazy_expr ; - storage : lazy_expr ; -} +type t = {code : lazy_expr; storage : lazy_expr} let encoding = let open Data_encoding in - def "scripted.contracts" @@ - conv - (fun { code ; storage } -> (code, storage)) - (fun (code, storage) -> { code ; storage }) - (obj2 - (req "code" lazy_expr_encoding) - (req "storage" lazy_expr_encoding)) + def "scripted.contracts" + @@ conv + (fun {code; storage} -> (code, storage)) + (fun (code, storage) -> {code; storage}) + (obj2 (req "code" lazy_expr_encoding) (req "storage" lazy_expr_encoding)) + +let int_node_size_of_numbits n = (1, 1 + ((n + 63) / 64)) + +let int_node_size n = int_node_size_of_numbits (Z.numbits n) + +let string_node_size_of_length s = (1, 1 + ((s + 7) / 8)) + +let string_node_size s = string_node_size_of_length (String.length s) -let int_node_size_of_numbits n = - (1, 1 + (n + 63) / 64) -let int_node_size n = - int_node_size_of_numbits (Z.numbits n) -let string_node_size_of_length s = - (1, 1 + (s + 7) / 8) -let string_node_size s = - string_node_size_of_length (String.length s) let bytes_node_size_of_length s = (* approx cost of indirection to the C heap *) - (2, 1 + (s + 7) / 8 + 12) -let bytes_node_size s = - bytes_node_size_of_length (MBytes.length s) + (2, 1 + ((s + 7) / 8) + 12) + +let bytes_node_size s = bytes_node_size_of_length (MBytes.length s) + let prim_node_size_nonrec_of_lengths n_args annots = - let annots_length = List.fold_left (fun acc s -> acc + String.length s) 0 annots in - if Compare.Int.(annots_length = 0) then - (1 + n_args, 2 + 2 * n_args) - else - (2 + n_args, 4 + 2 * n_args + (annots_length + 7) / 8) + let annots_length = + List.fold_left (fun acc s -> acc + String.length s) 0 annots + in + if Compare.Int.(annots_length = 0) then (1 + n_args, 2 + (2 * n_args)) + else (2 + n_args, 4 + (2 * n_args) + ((annots_length + 7) / 8)) + let prim_node_size_nonrec args annots = let n_args = List.length args in prim_node_size_nonrec_of_lengths n_args annots -let seq_node_size_nonrec_of_length n_args = - (1 + n_args, 2 + 2 * n_args) + +let seq_node_size_nonrec_of_length n_args = (1 + n_args, 2 + (2 * n_args)) + let seq_node_size_nonrec args = let n_args = List.length args in seq_node_size_nonrec_of_length n_args @@ -106,53 +101,64 @@ let seq_node_size_nonrec args = let rec node_size node = let open Micheline in match node with - | Int (_, n) -> int_node_size n - | String (_, s) -> string_node_size s - | Bytes (_, s) -> bytes_node_size s + | Int (_, n) -> + int_node_size n + | String (_, s) -> + string_node_size s + | Bytes (_, s) -> + bytes_node_size s | Prim (_, _, args, annot) -> List.fold_left (fun (blocks, words) node -> - let (nblocks, nwords) = node_size node in - (blocks + nblocks, words + nwords)) + let (nblocks, nwords) = node_size node in + (blocks + nblocks, words + nwords)) (prim_node_size_nonrec args annot) args | Seq (_, args) -> List.fold_left (fun (blocks, words) node -> - let (nblocks, nwords) = node_size node in - (blocks + nblocks, words + nwords)) + let (nblocks, nwords) = node_size node in + (blocks + nblocks, words + nwords)) (seq_node_size_nonrec args) args -let expr_size expr = - node_size (Micheline.root expr) +let expr_size expr = node_size (Micheline.root expr) let traversal_cost node = - let blocks, _words = node_size node in + let (blocks, _words) = node_size node in Gas_limit_repr.step_cost blocks let cost_of_size (blocks, words) = let open Gas_limit_repr in - ((Compare.Int.max 0 (blocks - 1)) *@ alloc_cost 0) +@ - alloc_cost words +@ - step_cost blocks + (Compare.Int.max 0 (blocks - 1) *@ alloc_cost 0) + +@ alloc_cost words +@ step_cost blocks -let node_cost node = - cost_of_size (node_size node) +let node_cost node = cost_of_size (node_size node) let int_node_cost n = cost_of_size (int_node_size n) -let int_node_cost_of_numbits n = cost_of_size (int_node_size_of_numbits n) -let string_node_cost s = cost_of_size (string_node_size s) -let string_node_cost_of_length s = cost_of_size (string_node_size_of_length s) -let bytes_node_cost s = cost_of_size (bytes_node_size s) -let bytes_node_cost_of_length s = cost_of_size (bytes_node_size_of_length s) -let prim_node_cost_nonrec args annot = cost_of_size (prim_node_size_nonrec args annot) -let prim_node_cost_nonrec_of_length n_args annot = cost_of_size (prim_node_size_nonrec_of_lengths n_args annot) -let seq_node_cost_nonrec args = cost_of_size (seq_node_size_nonrec args) -let seq_node_cost_nonrec_of_length n_args = cost_of_size (seq_node_size_nonrec_of_length n_args) -let deserialized_cost expr = - cost_of_size (expr_size expr) +let int_node_cost_of_numbits n = cost_of_size (int_node_size_of_numbits n) + +let string_node_cost s = cost_of_size (string_node_size s) + +let string_node_cost_of_length s = cost_of_size (string_node_size_of_length s) + +let bytes_node_cost s = cost_of_size (bytes_node_size s) + +let bytes_node_cost_of_length s = cost_of_size (bytes_node_size_of_length s) + +let prim_node_cost_nonrec args annot = + cost_of_size (prim_node_size_nonrec args annot) + +let prim_node_cost_nonrec_of_length n_args annot = + cost_of_size (prim_node_size_nonrec_of_lengths n_args annot) + +let seq_node_cost_nonrec args = cost_of_size (seq_node_size_nonrec args) + +let seq_node_cost_nonrec_of_length n_args = + cost_of_size (seq_node_size_nonrec_of_length n_args) + +let deserialized_cost expr = cost_of_size (expr_size expr) let serialized_cost bytes = let open Gas_limit_repr in @@ -164,14 +170,14 @@ let force_decode lexpr = ~fun_value:(fun _ -> false) ~fun_bytes:(fun _ -> true) ~fun_combine:(fun _ _ -> false) - lexpr in + lexpr + in match Data_encoding.force_decode lexpr with | Some v -> - if account_deserialization_cost then - ok (v, deserialized_cost v) - else - ok (v, Gas_limit_repr.free) - | None -> error Lazy_script_decode + if account_deserialization_cost then ok (v, deserialized_cost v) + else ok (v, Gas_limit_repr.free) + | None -> + error Lazy_script_decode let force_bytes expr = let open Gas_limit_repr in @@ -180,14 +186,17 @@ let force_bytes expr = ~fun_value:(fun v -> Some v) ~fun_bytes:(fun _ -> None) ~fun_combine:(fun _ _ -> None) - expr in + expr + in match Data_encoding.force_bytes expr with - | bytes -> - begin match account_serialization_cost with - | Some v -> ok (bytes, traversal_cost (Micheline.root v) +@ serialized_cost bytes) - | None -> ok (bytes, Gas_limit_repr.free) - end - | exception _ -> error Lazy_script_decode + | bytes -> ( + match account_serialization_cost with + | Some v -> + ok (bytes, traversal_cost (Micheline.root v) +@ serialized_cost bytes) + | None -> + ok (bytes, Gas_limit_repr.free) ) + | exception _ -> + error Lazy_script_decode let minimal_deserialize_cost lexpr = Data_encoding.apply_lazy @@ -199,20 +208,25 @@ let minimal_deserialize_cost lexpr = let unit = Micheline.strip_locations (Prim (0, Michelson_v1_primitives.D_Unit, [], [])) -let unit_parameter = - lazy_expr unit +let unit_parameter = lazy_expr unit let is_unit_parameter = let unit_bytes = Data_encoding.force_bytes unit_parameter in Data_encoding.apply_lazy - ~fun_value:(fun v -> match Micheline.root v with Prim (_, Michelson_v1_primitives.D_Unit, [], []) -> true | _ -> false) - ~fun_bytes:(fun b -> MBytes.(=) b unit_bytes) + ~fun_value:(fun v -> + match Micheline.root v with + | Prim (_, Michelson_v1_primitives.D_Unit, [], []) -> + true + | _ -> + false) + ~fun_bytes:(fun b -> MBytes.( = ) b unit_bytes) ~fun_combine:(fun res _ -> res) let rec strip_annotations node = let open Micheline in match node with - | Int (_, _) | String (_, _) | Bytes (_, _) as leaf -> leaf + | (Int (_, _) | String (_, _) | Bytes (_, _)) as leaf -> + leaf | Prim (loc, name, args, _) -> Prim (loc, name, List.map strip_annotations args, []) | Seq (loc, args) -> diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/script_repr.mli index d44e137e4..514389d20 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_repr.mli @@ -43,25 +43,36 @@ val lazy_expr_encoding : lazy_expr Data_encoding.t val lazy_expr : expr -> lazy_expr -type t = { code : lazy_expr ; storage : lazy_expr } +type t = {code : lazy_expr; storage : lazy_expr} val encoding : t Data_encoding.encoding val deserialized_cost : expr -> Gas_limit_repr.cost val serialized_cost : MBytes.t -> Gas_limit_repr.cost + val traversal_cost : node -> Gas_limit_repr.cost + val node_cost : node -> Gas_limit_repr.cost val int_node_cost : Z.t -> Gas_limit_repr.cost + val int_node_cost_of_numbits : int -> Gas_limit_repr.cost + val string_node_cost : string -> Gas_limit_repr.cost + val string_node_cost_of_length : int -> Gas_limit_repr.cost + val bytes_node_cost : MBytes.t -> Gas_limit_repr.cost + val bytes_node_cost_of_length : int -> Gas_limit_repr.cost + val prim_node_cost_nonrec : expr list -> annot -> Gas_limit_repr.cost + val prim_node_cost_nonrec_of_length : int -> annot -> Gas_limit_repr.cost + val seq_node_cost_nonrec : expr list -> Gas_limit_repr.cost + val seq_node_cost_nonrec_of_length : int -> Gas_limit_repr.cost val force_decode : lazy_expr -> (expr * Gas_limit_repr.cost) tzresult diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors.ml index 3d0e0ea85..0dfeb1e1b 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors.ml @@ -26,65 +26,133 @@ open Alpha_context open Script - (* ---- Error definitions ---------------------------------------------------*) (* Auxiliary types for error documentation *) -type namespace = Type_namespace | Constant_namespace | Instr_namespace | Keyword_namespace +type namespace = + | Type_namespace + | Constant_namespace + | Instr_namespace + | Keyword_namespace + type kind = Int_kind | String_kind | Bytes_kind | Prim_kind | Seq_kind + type unparsed_stack_ty = (Script.expr * Script.annot) list + type type_map = (int * (unparsed_stack_ty * unparsed_stack_ty)) list (* Structure errors *) type error += Invalid_arity of Script.location * prim * int * int -type error += Invalid_namespace of Script.location * prim * namespace * namespace + +type error += + | Invalid_namespace of Script.location * prim * namespace * namespace + type error += Invalid_primitive of Script.location * prim list * prim + type error += Invalid_kind of Script.location * kind list * kind + type error += Missing_field of prim + type error += Duplicate_field of Script.location * prim + type error += Unexpected_big_map of Script.location + type error += Unexpected_operation of Script.location + type error += Unexpected_contract of Script.location + type error += No_such_entrypoint of string + type error += Duplicate_entrypoint of string + type error += Unreachable_entrypoint of prim list + type error += Entrypoint_name_too_long of string (* Instruction typing errors *) type error += Fail_not_in_tail_position of Script.location -type error += Undefined_binop : Script.location * prim * Script.expr * Script.expr -> error + +type error += + | Undefined_binop : + Script.location * prim * Script.expr * Script.expr + -> error + type error += Undefined_unop : Script.location * prim * Script.expr -> error -type error += Bad_return : Script.location * unparsed_stack_ty * Script.expr -> error -type error += Bad_stack : Script.location * prim * int * unparsed_stack_ty -> error -type error += Unmatched_branches : Script.location * unparsed_stack_ty * unparsed_stack_ty -> error + +type error += + | Bad_return : Script.location * unparsed_stack_ty * Script.expr -> error + +type error += + | Bad_stack : Script.location * prim * int * unparsed_stack_ty -> error + +type error += + | Unmatched_branches : + Script.location * unparsed_stack_ty * unparsed_stack_ty + -> error + type error += Self_in_lambda of Script.location + type error += Bad_stack_length + type error += Bad_stack_item of int + type error += Inconsistent_annotations of string * string -type error += Inconsistent_type_annotations : Script.location * Script.expr * Script.expr -> error + +type error += + | Inconsistent_type_annotations : + Script.location * Script.expr * Script.expr + -> error + type error += Inconsistent_field_annotations of string * string + type error += Unexpected_annotation of Script.location + type error += Ungrouped_annotations of Script.location + type error += Invalid_map_body : Script.location * unparsed_stack_ty -> error + type error += Invalid_map_block_fail of Script.location -type error += Invalid_iter_body : Script.location * unparsed_stack_ty * unparsed_stack_ty -> error + +type error += + | Invalid_iter_body : + Script.location * unparsed_stack_ty * unparsed_stack_ty + -> error + type error += Type_too_large : Script.location * int * int -> error (* Value typing errors *) -type error += Invalid_constant : Script.location * Script.expr * Script.expr -> error -type error += Invalid_syntactic_constant : Script.location * Script.expr * string -> error +type error += + | Invalid_constant : Script.location * Script.expr * Script.expr -> error + +type error += + | Invalid_syntactic_constant : + Script.location * Script.expr * string + -> error + type error += Invalid_contract of Script.location * Contract.t + type error += Invalid_big_map of Script.location * Big_map.id -type error += Comparable_type_expected : Script.location * Script.expr -> error + +type error += + | Comparable_type_expected : Script.location * Script.expr -> error + type error += Inconsistent_types : Script.expr * Script.expr -> error + type error += Unordered_map_keys of Script.location * Script.expr + type error += Unordered_set_values of Script.location * Script.expr + type error += Duplicate_map_keys of Script.location * Script.expr + type error += Duplicate_set_values of Script.location * Script.expr (* Toplevel errors *) -type error += Ill_typed_data : string option * Script.expr * Script.expr -> error -type error += Ill_formed_type of string option * Script.expr * Script.location +type error += + | Ill_typed_data : string option * Script.expr * Script.expr -> error + +type error += + | Ill_formed_type of string option * Script.expr * Script.location + type error += Ill_typed_contract : Script.expr * type_map -> error (* Gas related errors *) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors_registration.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors_registration.ml index e8a33c5fe..91ef45d4f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors_registration.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_tc_errors_registration.ml @@ -42,66 +42,67 @@ let type_map_enc = let stack_ty_enc = let open Data_encoding in - (list - (obj2 - (req "type" Script.expr_encoding) - (dft "annots" (list string) []))) + list (obj2 (req "type" Script.expr_encoding) (dft "annots" (list string) [])) (* main registration *) let () = let open Data_encoding in let located enc = - merge_objs - (obj1 (req "location" Script.location_encoding)) - enc in - let arity_enc = - int8 in + merge_objs (obj1 (req "location" Script.location_encoding)) enc + in + let arity_enc = int8 in let namespace_enc = - def "primitiveNamespace" - ~title: "Primitive namespace" + def + "primitiveNamespace" + ~title:"Primitive namespace" ~description: - "One of the three possible namespaces of primitive \ - (data constructor, type name or instruction)." @@ - string_enum [ "type", Type_namespace ; - "constant", Constant_namespace ; - "instruction", Instr_namespace ] in + "One of the three possible namespaces of primitive (data constructor, \ + type name or instruction)." + @@ string_enum + [ ("type", Type_namespace); + ("constant", Constant_namespace); + ("instruction", Instr_namespace) ] + in let kind_enc = - def "expressionKind" - ~title: "Expression kind" + def + "expressionKind" + ~title:"Expression kind" ~description: - "One of the four possible kinds of expression \ - (integer, string, primitive application or sequence)." @@ - string_enum [ "integer", Int_kind ; - "string", String_kind ; - "bytes", Bytes_kind ; - "primitiveApplication", Prim_kind ; - "sequence", Seq_kind ] in + "One of the four possible kinds of expression (integer, string, \ + primitive application or sequence)." + @@ string_enum + [ ("integer", Int_kind); + ("string", String_kind); + ("bytes", Bytes_kind); + ("primitiveApplication", Prim_kind); + ("sequence", Seq_kind) ] + in (* -- Structure errors ---------------------- *) (* Invalid arity *) register_error_kind `Permanent ~id:"michelson_v1.invalid_arity" - ~title: "Invalid arity" + ~title:"Invalid arity" ~description: - "In a script or data expression, a primitive was applied \ - to an unsupported number of arguments." - (located (obj3 - (req "primitive_name" Script.prim_encoding) - (req "expected_arity" arity_enc) - (req "wrong_arity" arity_enc))) + "In a script or data expression, a primitive was applied to an \ + unsupported number of arguments." + (located + (obj3 + (req "primitive_name" Script.prim_encoding) + (req "expected_arity" arity_enc) + (req "wrong_arity" arity_enc))) (function | Invalid_arity (loc, name, exp, got) -> Some (loc, (name, exp, got)) - | _ -> None) - (fun (loc, (name, exp, got)) -> - Invalid_arity (loc, name, exp, got)) ; + | _ -> + None) + (fun (loc, (name, exp, got)) -> Invalid_arity (loc, name, exp, got)) ; (* Missing field *) register_error_kind `Permanent ~id:"michelson_v1.missing_script_field" ~title:"Script is missing a field (parse error)" - ~description: - "When parsing script, a field was expected, but not provided" + ~description:"When parsing script, a field was expected, but not provided" (obj1 (req "prim" prim_encoding)) (function Missing_field prim -> Some prim | _ -> None) (fun prim -> Missing_field prim) ; @@ -109,140 +110,124 @@ let () = register_error_kind `Permanent ~id:"michelson_v1.invalid_primitive" - ~title: "Invalid primitive" - ~description: - "In a script or data expression, a primitive was unknown." - (located (obj2 - (dft "expected_primitive_names" (list prim_encoding) []) - (req "wrong_primitive_name" prim_encoding))) + ~title:"Invalid primitive" + ~description:"In a script or data expression, a primitive was unknown." + (located + (obj2 + (dft "expected_primitive_names" (list prim_encoding) []) + (req "wrong_primitive_name" prim_encoding))) (function - | Invalid_primitive (loc, exp, got) -> Some (loc, (exp, got)) - | _ -> None) - (fun (loc, (exp, got)) -> - Invalid_primitive (loc, exp, got)) ; + | Invalid_primitive (loc, exp, got) -> Some (loc, (exp, got)) | _ -> None) + (fun (loc, (exp, got)) -> Invalid_primitive (loc, exp, got)) ; (* Invalid kind *) register_error_kind `Permanent ~id:"michelson_v1.invalid_expression_kind" - ~title: "Invalid expression kind" + ~title:"Invalid expression kind" ~description: "In a script or data expression, an expression was of the wrong kind \ (for instance a string where only a primitive applications can appear)." - (located (obj2 - (req "expected_kinds" (list kind_enc)) - (req "wrong_kind" kind_enc))) + (located + (obj2 (req "expected_kinds" (list kind_enc)) (req "wrong_kind" kind_enc))) (function - | Invalid_kind (loc, exp, got) -> Some (loc, (exp, got)) - | _ -> None) - (fun (loc, (exp, got)) -> - Invalid_kind (loc, exp, got)) ; + | Invalid_kind (loc, exp, got) -> Some (loc, (exp, got)) | _ -> None) + (fun (loc, (exp, got)) -> Invalid_kind (loc, exp, got)) ; (* Invalid namespace *) register_error_kind `Permanent ~id:"michelson_v1.invalid_primitive_namespace" - ~title: "Invalid primitive namespace" + ~title:"Invalid primitive namespace" ~description: "In a script or data expression, a primitive was of the wrong namespace." - (located (obj3 - (req "primitive_name" prim_encoding) - (req "expected_namespace" namespace_enc) - (req "wrong_namespace" namespace_enc))) + (located + (obj3 + (req "primitive_name" prim_encoding) + (req "expected_namespace" namespace_enc) + (req "wrong_namespace" namespace_enc))) (function - | Invalid_namespace (loc, name, exp, got) -> Some (loc, (name, exp, got)) - | _ -> None) - (fun (loc, (name, exp, got)) -> - Invalid_namespace (loc, name, exp, got)) ; + | Invalid_namespace (loc, name, exp, got) -> + Some (loc, (name, exp, got)) + | _ -> + None) + (fun (loc, (name, exp, got)) -> Invalid_namespace (loc, name, exp, got)) ; (* Duplicate field *) register_error_kind `Permanent ~id:"michelson_v1.duplicate_script_field" - ~title: "Script has a duplicated field (parse error)" - ~description: - "When parsing script, a field was found more than once" - (obj2 - (req "loc" location_encoding) - (req "prim" prim_encoding)) + ~title:"Script has a duplicated field (parse error)" + ~description:"When parsing script, a field was found more than once" + (obj2 (req "loc" location_encoding) (req "prim" prim_encoding)) (function Duplicate_field (loc, prim) -> Some (loc, prim) | _ -> None) (fun (loc, prim) -> Duplicate_field (loc, prim)) ; (* Unexpected big_map *) register_error_kind `Permanent ~id:"michelson_v1.unexpected_bigmap" - ~title: "Big map in unauthorized position (type error)" + ~title:"Big map in unauthorized position (type error)" ~description: - "When parsing script, a big_map type was found in a position \ - where it could end up stored inside a big_map, which is \ - forbidden for now." - (obj1 - (req "loc" location_encoding)) + "When parsing script, a big_map type was found in a position where it \ + could end up stored inside a big_map, which is forbidden for now." + (obj1 (req "loc" location_encoding)) (function Unexpected_big_map loc -> Some loc | _ -> None) (fun loc -> Unexpected_big_map loc) ; (* Unexpected operation *) register_error_kind `Permanent ~id:"michelson_v1.unexpected_operation" - ~title: "Operation in unauthorized position (type error)" + ~title:"Operation in unauthorized position (type error)" ~description: - "When parsing script, an operation type was found \ - in the storage or parameter field." - (obj1 - (req "loc" location_encoding)) + "When parsing script, an operation type was found in the storage or \ + parameter field." + (obj1 (req "loc" location_encoding)) (function Unexpected_operation loc -> Some loc | _ -> None) (fun loc -> Unexpected_operation loc) ; (* No such entrypoint *) register_error_kind `Permanent ~id:"michelson_v1.no_such_entrypoint" - ~title: "No such entrypoint (type error)" - ~description: - "An entrypoint was not found when calling a contract." - (obj1 - (req "entrypoint" string)) + ~title:"No such entrypoint (type error)" + ~description:"An entrypoint was not found when calling a contract." + (obj1 (req "entrypoint" string)) (function No_such_entrypoint entrypoint -> Some entrypoint | _ -> None) (fun entrypoint -> No_such_entrypoint entrypoint) ; (* Unreachable entrypoint *) register_error_kind `Permanent ~id:"michelson_v1.unreachable_entrypoint" - ~title: "Unreachable entrypoint (type error)" - ~description: - "An entrypoint in the contract is not reachable." - (obj1 - (req "path" (list prim_encoding))) + ~title:"Unreachable entrypoint (type error)" + ~description:"An entrypoint in the contract is not reachable." + (obj1 (req "path" (list prim_encoding))) (function Unreachable_entrypoint path -> Some path | _ -> None) (fun path -> Unreachable_entrypoint path) ; (* Duplicate entrypoint *) register_error_kind `Permanent ~id:"michelson_v1.duplicate_entrypoint" - ~title: "Duplicate entrypoint (type error)" - ~description: - "Two entrypoints have the same name." - (obj1 - (req "path" string)) + ~title:"Duplicate entrypoint (type error)" + ~description:"Two entrypoints have the same name." + (obj1 (req "path" string)) (function Duplicate_entrypoint entrypoint -> Some entrypoint | _ -> None) (fun entrypoint -> Duplicate_entrypoint entrypoint) ; (* Entrypoint name too long *) register_error_kind `Permanent ~id:"michelson_v1.entrypoint_name_too_long" - ~title: "Entrypoint name too long (type error)" + ~title:"Entrypoint name too long (type error)" ~description: "An entrypoint name exceeds the maximum length of 31 characters." - (obj1 - (req "name" string)) - (function Entrypoint_name_too_long entrypoint -> Some entrypoint | _ -> None) + (obj1 (req "name" string)) + (function + | Entrypoint_name_too_long entrypoint -> Some entrypoint | _ -> None) (fun entrypoint -> Entrypoint_name_too_long entrypoint) ; (* Unexpected contract *) register_error_kind `Permanent ~id:"michelson_v1.unexpected_contract" - ~title: "Contract in unauthorized position (type error)" + ~title:"Contract in unauthorized position (type error)" ~description: - "When parsing script, a contract type was found \ - in the storage or parameter field." - (obj1 - (req "loc" location_encoding)) + "When parsing script, a contract type was found in the storage or \ + parameter field." + (obj1 (req "loc" location_encoding)) (function Unexpected_contract loc -> Some loc | _ -> None) (fun loc -> Unexpected_contract loc) ; (* -- Value typing errors ---------------------- *) @@ -255,10 +240,8 @@ let () = (obj2 (req "location" Script.location_encoding) (req "item" Script.expr_encoding)) - (function - | Unordered_map_keys (loc, expr) -> Some (loc, expr) - | _ -> None) - (fun (loc, expr) -> Unordered_map_keys (loc, expr)); + (function Unordered_map_keys (loc, expr) -> Some (loc, expr) | _ -> None) + (fun (loc, expr) -> Unordered_map_keys (loc, expr)) ; (* Duplicate map keys *) register_error_kind `Permanent @@ -268,10 +251,8 @@ let () = (obj2 (req "location" Script.location_encoding) (req "item" Script.expr_encoding)) - (function - | Duplicate_map_keys (loc, expr) -> Some (loc, expr) - | _ -> None) - (fun (loc, expr) -> Duplicate_map_keys (loc, expr)); + (function Duplicate_map_keys (loc, expr) -> Some (loc, expr) | _ -> None) + (fun (loc, expr) -> Duplicate_map_keys (loc, expr)) ; (* Unordered set values *) register_error_kind `Permanent @@ -282,126 +263,117 @@ let () = (req "location" Script.location_encoding) (req "value" Script.expr_encoding)) (function - | Unordered_set_values (loc, expr) -> Some (loc, expr) - | _ -> None) - (fun (loc, expr) -> Unordered_set_values (loc, expr)); + | Unordered_set_values (loc, expr) -> Some (loc, expr) | _ -> None) + (fun (loc, expr) -> Unordered_set_values (loc, expr)) ; (* Duplicate set values *) register_error_kind `Permanent ~id:"michelson_v1.duplicate_set_values_in_literal" ~title:"Sets literals cannot contain duplicate elements" - ~description:"Set literals cannot contain duplicate elements, \ - but a duplicae was found while parsing." + ~description: + "Set literals cannot contain duplicate elements, but a duplicae was \ + found while parsing." (obj2 (req "location" Script.location_encoding) (req "value" Script.expr_encoding)) (function - | Duplicate_set_values (loc, expr) -> Some (loc, expr) - | _ -> None) - (fun (loc, expr) -> Duplicate_set_values (loc, expr)); + | Duplicate_set_values (loc, expr) -> Some (loc, expr) | _ -> None) + (fun (loc, expr) -> Duplicate_set_values (loc, expr)) ; (* -- Instruction typing errors ------------- *) (* Fail not in tail position *) register_error_kind `Permanent ~id:"michelson_v1.fail_not_in_tail_position" - ~title: "FAIL not in tail position" - ~description: - "There is non trivial garbage code after a FAIL instruction." + ~title:"FAIL not in tail position" + ~description:"There is non trivial garbage code after a FAIL instruction." (located empty) - (function - | Fail_not_in_tail_position loc -> Some (loc, ()) - | _ -> None) - (fun (loc, ()) -> - Fail_not_in_tail_position loc) ; + (function Fail_not_in_tail_position loc -> Some (loc, ()) | _ -> None) + (fun (loc, ()) -> Fail_not_in_tail_position loc) ; (* Undefined binary operation *) register_error_kind `Permanent ~id:"michelson_v1.undefined_binop" - ~title: "Undefined binop" + ~title:"Undefined binop" ~description: - "A binary operation is called on operands of types \ - over which it is not defined." - (located (obj3 - (req "operator_name" prim_encoding) - (req "wrong_left_operand_type" Script.expr_encoding) - (req "wrong_right_operand_type" Script.expr_encoding))) + "A binary operation is called on operands of types over which it is not \ + defined." + (located + (obj3 + (req "operator_name" prim_encoding) + (req "wrong_left_operand_type" Script.expr_encoding) + (req "wrong_right_operand_type" Script.expr_encoding))) (function | Undefined_binop (loc, n, tyl, tyr) -> Some (loc, (n, tyl, tyr)) - | _ -> None) - (fun (loc, (n, tyl, tyr)) -> - Undefined_binop (loc, n, tyl, tyr)) ; + | _ -> + None) + (fun (loc, (n, tyl, tyr)) -> Undefined_binop (loc, n, tyl, tyr)) ; (* Undefined unary operation *) register_error_kind `Permanent ~id:"michelson_v1.undefined_unop" - ~title: "Undefined unop" + ~title:"Undefined unop" ~description: - "A unary operation is called on an operand of type \ - over which it is not defined." - (located (obj2 - (req "operator_name" prim_encoding) - (req "wrong_operand_type" Script.expr_encoding))) - (function - | Undefined_unop (loc, n, ty) -> - Some (loc, (n, ty)) - | _ -> None) - (fun (loc, (n, ty)) -> - Undefined_unop (loc, n, ty)) ; + "A unary operation is called on an operand of type over which it is not \ + defined." + (located + (obj2 + (req "operator_name" prim_encoding) + (req "wrong_operand_type" Script.expr_encoding))) + (function Undefined_unop (loc, n, ty) -> Some (loc, (n, ty)) | _ -> None) + (fun (loc, (n, ty)) -> Undefined_unop (loc, n, ty)) ; (* Bad return *) register_error_kind `Permanent ~id:"michelson_v1.bad_return" - ~title: "Bad return" - ~description: - "Unexpected stack at the end of a lambda or script." - (located (obj2 - (req "expected_return_type" Script.expr_encoding) - (req "wrong_stack_type" stack_ty_enc))) - (function - | Bad_return (loc, sty, ty) -> Some (loc, (ty, sty)) - | _ -> None) - (fun (loc, (ty, sty)) -> - Bad_return (loc, sty, ty)) ; + ~title:"Bad return" + ~description:"Unexpected stack at the end of a lambda or script." + (located + (obj2 + (req "expected_return_type" Script.expr_encoding) + (req "wrong_stack_type" stack_ty_enc))) + (function Bad_return (loc, sty, ty) -> Some (loc, (ty, sty)) | _ -> None) + (fun (loc, (ty, sty)) -> Bad_return (loc, sty, ty)) ; (* Bad stack *) register_error_kind `Permanent ~id:"michelson_v1.bad_stack" - ~title: "Bad stack" - ~description: - "The stack has an unexpected length or contents." - (located (obj3 - (req "primitive_name" prim_encoding) - (req "relevant_stack_portion" int16) - (req "wrong_stack_type" stack_ty_enc))) + ~title:"Bad stack" + ~description:"The stack has an unexpected length or contents." + (located + (obj3 + (req "primitive_name" prim_encoding) + (req "relevant_stack_portion" int16) + (req "wrong_stack_type" stack_ty_enc))) (function - | Bad_stack (loc, name, s, sty) -> Some (loc, (name, s, sty)) - | _ -> None) - (fun (loc, (name, s, sty)) -> - Bad_stack (loc, name, s, sty)) ; + | Bad_stack (loc, name, s, sty) -> Some (loc, (name, s, sty)) | _ -> None) + (fun (loc, (name, s, sty)) -> Bad_stack (loc, name, s, sty)) ; (* Inconsistent annotations *) register_error_kind `Permanent ~id:"michelson_v1.inconsistent_annotations" ~title:"Annotations inconsistent between branches" ~description:"The annotations on two types could not be merged" - (obj2 - (req "annot1" string) - (req "annot2" string)) - (function Inconsistent_annotations (annot1, annot2) -> Some (annot1, annot2) - | _ -> None) + (obj2 (req "annot1" string) (req "annot2" string)) + (function + | Inconsistent_annotations (annot1, annot2) -> + Some (annot1, annot2) + | _ -> + None) (fun (annot1, annot2) -> Inconsistent_annotations (annot1, annot2)) ; (* Inconsistent field annotations *) register_error_kind `Permanent ~id:"michelson_v1.inconsistent_field_annotations" ~title:"Annotations for field accesses is inconsistent" - ~description:"The specified field does not match the field annotation in the type" - (obj2 - (req "annot1" string) - (req "annot2" string)) - (function Inconsistent_field_annotations (annot1, annot2) -> Some (annot1, annot2) - | _ -> None) + ~description: + "The specified field does not match the field annotation in the type" + (obj2 (req "annot1" string) (req "annot2" string)) + (function + | Inconsistent_field_annotations (annot1, annot2) -> + Some (annot1, annot2) + | _ -> + None) (fun (annot1, annot2) -> Inconsistent_field_annotations (annot1, annot2)) ; (* Inconsistent type annotations *) register_error_kind @@ -409,12 +381,15 @@ let () = ~id:"michelson_v1.inconsistent_type_annotations" ~title:"Types contain inconsistent annotations" ~description:"The two types contain annotations that do not match" - (located (obj2 - (req "type1" Script.expr_encoding) - (req "type2" Script.expr_encoding))) + (located + (obj2 + (req "type1" Script.expr_encoding) + (req "type2" Script.expr_encoding))) (function - | Inconsistent_type_annotations (loc, ty1, ty2) -> Some (loc, (ty1, ty2)) - | _ -> None) + | Inconsistent_type_annotations (loc, ty1, ty2) -> + Some (loc, (ty1, ty2)) + | _ -> + None) (fun (loc, (ty1, ty2)) -> Inconsistent_type_annotations (loc, ty1, ty2)) ; (* Unexpected annotation *) register_error_kind @@ -423,9 +398,8 @@ let () = ~title:"An annotation was encountered where no annotation is expected" ~description:"A node in the syntax tree was impropperly annotated" (located empty) - (function Unexpected_annotation loc -> Some (loc, ()) - | _ -> None) - (fun (loc, ()) -> Unexpected_annotation loc); + (function Unexpected_annotation loc -> Some (loc, ()) | _ -> None) + (fun (loc, ()) -> Unexpected_annotation loc) ; (* Ungrouped annotations *) register_error_kind `Permanent @@ -433,203 +407,167 @@ let () = ~title:"Annotations of the same kind were found spread apart" ~description:"Annotations of the same kind must be grouped" (located empty) - (function Ungrouped_annotations loc -> Some (loc, ()) - | _ -> None) - (fun (loc, ()) -> Ungrouped_annotations loc); + (function Ungrouped_annotations loc -> Some (loc, ()) | _ -> None) + (fun (loc, ()) -> Ungrouped_annotations loc) ; (* Unmatched branches *) register_error_kind `Permanent ~id:"michelson_v1.unmatched_branches" - ~title: "Unmatched branches" + ~title:"Unmatched branches" ~description: - "At the join point at the end of two code branches \ - the stacks have inconsistent lengths or contents." - (located (obj2 - (req "first_stack_type" stack_ty_enc) - (req "other_stack_type" stack_ty_enc))) + "At the join point at the end of two code branches the stacks have \ + inconsistent lengths or contents." + (located + (obj2 + (req "first_stack_type" stack_ty_enc) + (req "other_stack_type" stack_ty_enc))) (function | Unmatched_branches (loc, stya, styb) -> Some (loc, (stya, styb)) - | _ -> None) - (fun (loc, (stya, styb)) -> - Unmatched_branches (loc, stya, styb)) ; + | _ -> + None) + (fun (loc, (stya, styb)) -> Unmatched_branches (loc, stya, styb)) ; (* Bad stack item *) register_error_kind `Permanent ~id:"michelson_v1.bad_stack_item" - ~title: "Bad stack item" + ~title:"Bad stack item" ~description: - "The type of a stack item is unexpected \ - (this error is always accompanied by a more precise one)." + "The type of a stack item is unexpected (this error is always \ + accompanied by a more precise one)." (obj1 (req "item_level" int16)) - (function - | Bad_stack_item n -> Some n - | _ -> None) - (fun n -> - Bad_stack_item n) ; + (function Bad_stack_item n -> Some n | _ -> None) + (fun n -> Bad_stack_item n) ; (* SELF in lambda *) register_error_kind `Permanent ~id:"michelson_v1.self_in_lambda" - ~title: "SELF instruction in lambda" - ~description: - "A SELF instruction was encountered in a lambda expression." + ~title:"SELF instruction in lambda" + ~description:"A SELF instruction was encountered in a lambda expression." (located empty) - (function - | Self_in_lambda loc -> Some (loc, ()) - | _ -> None) - (fun (loc, ()) -> - Self_in_lambda loc) ; + (function Self_in_lambda loc -> Some (loc, ()) | _ -> None) + (fun (loc, ()) -> Self_in_lambda loc) ; (* Bad stack length *) register_error_kind `Permanent ~id:"michelson_v1.inconsistent_stack_lengths" - ~title: "Inconsistent stack lengths" + ~title:"Inconsistent stack lengths" ~description: - "A stack was of an unexpected length \ - (this error is always in the context of a located error)." + "A stack was of an unexpected length (this error is always in the \ + context of a located error)." empty - (function - | Bad_stack_length -> Some () - | _ -> None) - (fun () -> - Bad_stack_length) ; + (function Bad_stack_length -> Some () | _ -> None) + (fun () -> Bad_stack_length) ; (* -- Value typing errors ------------------- *) (* Invalid constant *) register_error_kind `Permanent ~id:"michelson_v1.invalid_constant" - ~title: "Invalid constant" - ~description: - "A data expression was invalid for its expected type." - (located (obj2 - (req "expected_type" Script.expr_encoding) - (req "wrong_expression" Script.expr_encoding))) + ~title:"Invalid constant" + ~description:"A data expression was invalid for its expected type." + (located + (obj2 + (req "expected_type" Script.expr_encoding) + (req "wrong_expression" Script.expr_encoding))) (function - | Invalid_constant (loc, expr, ty) -> - Some (loc, (ty, expr)) - | _ -> None) - (fun (loc, (ty, expr)) -> - Invalid_constant (loc, expr, ty)) ; + | Invalid_constant (loc, expr, ty) -> Some (loc, (ty, expr)) | _ -> None) + (fun (loc, (ty, expr)) -> Invalid_constant (loc, expr, ty)) ; (* Invalid syntactic constant *) register_error_kind `Permanent ~id:"invalidSyntacticConstantError" - ~title: "Invalid constant (parse error)" - ~description: - "A compile-time constant was invalid for its expected form." - (located (obj2 - (req "expectedForm" Script.expr_encoding) - (req "wrongExpression" Script.expr_encoding))) + ~title:"Invalid constant (parse error)" + ~description:"A compile-time constant was invalid for its expected form." + (located + (obj2 + (req "expectedForm" Script.expr_encoding) + (req "wrongExpression" Script.expr_encoding))) (function - | Invalid_constant (loc, expr, ty) -> - Some (loc, (ty, expr)) - | _ -> None) - (fun (loc, (ty, expr)) -> - Invalid_constant (loc, expr, ty)) ; + | Invalid_constant (loc, expr, ty) -> Some (loc, (ty, expr)) | _ -> None) + (fun (loc, (ty, expr)) -> Invalid_constant (loc, expr, ty)) ; (* Invalid contract *) register_error_kind `Permanent ~id:"michelson_v1.invalid_contract" - ~title: "Invalid contract" + ~title:"Invalid contract" ~description: - "A script or data expression references a contract that does not \ - exist or assumes a wrong type for an existing contract." + "A script or data expression references a contract that does not exist \ + or assumes a wrong type for an existing contract." (located (obj1 (req "contract" Contract.encoding))) - (function - | Invalid_contract (loc, c) -> - Some (loc, c) - | _ -> None) - (fun (loc, c) -> - Invalid_contract (loc, c)) ; + (function Invalid_contract (loc, c) -> Some (loc, c) | _ -> None) + (fun (loc, c) -> Invalid_contract (loc, c)) ; (* Invalid big_map *) register_error_kind `Permanent ~id:"michelson_v1.invalid_big_map" - ~title: "Invalid big_map" + ~title:"Invalid big_map" ~description: - "A script or data expression references a big_map that does not \ - exist or assumes a wrong type for an existing big_map." + "A script or data expression references a big_map that does not exist \ + or assumes a wrong type for an existing big_map." (located (obj1 (req "big_map" z))) - (function - | Invalid_big_map (loc, c) -> - Some (loc, c) - | _ -> None) - (fun (loc, c) -> - Invalid_big_map (loc, c)) ; + (function Invalid_big_map (loc, c) -> Some (loc, c) | _ -> None) + (fun (loc, c) -> Invalid_big_map (loc, c)) ; (* Comparable type expected *) register_error_kind `Permanent ~id:"michelson_v1.comparable_type_expected" - ~title: "Comparable type expected" + ~title:"Comparable type expected" ~description: - "A non comparable type was used in a place where \ - only comparable types are accepted." + "A non comparable type was used in a place where only comparable types \ + are accepted." (located (obj1 (req "wrong_type" Script.expr_encoding))) (function - | Comparable_type_expected (loc, ty) -> Some (loc, ty) - | _ -> None) - (fun (loc, ty) -> - Comparable_type_expected (loc, ty)) ; + | Comparable_type_expected (loc, ty) -> Some (loc, ty) | _ -> None) + (fun (loc, ty) -> Comparable_type_expected (loc, ty)) ; (* Inconsistent types *) register_error_kind `Permanent ~id:"michelson_v1.inconsistent_types" - ~title: "Inconsistent types" + ~title:"Inconsistent types" ~description: - "This is the basic type clash error, \ - that appears in several places where the equality of \ - two types have to be proven, it is always accompanied \ - with another error that provides more context." + "This is the basic type clash error, that appears in several places \ + where the equality of two types have to be proven, it is always \ + accompanied with another error that provides more context." (obj2 (req "first_type" Script.expr_encoding) (req "other_type" Script.expr_encoding)) - (function - | Inconsistent_types (tya, tyb) -> Some (tya, tyb) - | _ -> None) + (function Inconsistent_types (tya, tyb) -> Some (tya, tyb) | _ -> None) (fun (tya, tyb) -> Inconsistent_types (tya, tyb)) ; (* -- Instruction typing errors ------------------- *) (* Invalid map body *) register_error_kind `Permanent ~id:"michelson_v1.invalid_map_body" - ~title: "Invalid map body" - ~description: - "The body of a map block did not match the expected type" - (obj2 - (req "loc" Script.location_encoding) - (req "body_type" stack_ty_enc)) - (function - | Invalid_map_body (loc, stack) -> Some (loc, stack) - | _ -> None) + ~title:"Invalid map body" + ~description:"The body of a map block did not match the expected type" + (obj2 (req "loc" Script.location_encoding) (req "body_type" stack_ty_enc)) + (function Invalid_map_body (loc, stack) -> Some (loc, stack) | _ -> None) (fun (loc, stack) -> Invalid_map_body (loc, stack)) ; (* Invalid map block FAIL *) register_error_kind `Permanent ~id:"michelson_v1.invalid_map_block_fail" ~title:"FAIL instruction occurred as body of map block" - ~description:"FAIL cannot be the only instruction in the body. \ - The propper type of the return list cannot be inferred." + ~description: + "FAIL cannot be the only instruction in the body. The propper type of \ + the return list cannot be inferred." (obj1 (req "loc" Script.location_encoding)) - (function - | Invalid_map_block_fail loc -> Some loc - | _ -> None) + (function Invalid_map_block_fail loc -> Some loc | _ -> None) (fun loc -> Invalid_map_block_fail loc) ; (* Invalid ITER body *) register_error_kind `Permanent ~id:"michelson_v1.invalid_iter_body" ~title:"ITER body returned wrong stack type" - ~description:"The body of an ITER instruction \ - must result in the same stack type as before \ - the ITER." + ~description: + "The body of an ITER instruction must result in the same stack type as \ + before the ITER." (obj3 (req "loc" Script.location_encoding) (req "bef_stack" stack_ty_enc) (req "aft_stack" stack_ty_enc)) (function - | Invalid_iter_body (loc, bef, aft) -> Some (loc, bef, aft) - | _ -> None) + | Invalid_iter_body (loc, bef, aft) -> Some (loc, bef, aft) | _ -> None) (fun (loc, bef, aft) -> Invalid_iter_body (loc, bef, aft)) ; (* Type too large *) register_error_kind @@ -642,32 +580,29 @@ let () = (req "type_size" uint16) (req "maximum_type_size" uint16)) (function - | Type_too_large (loc, ts, maxts) -> Some (loc, ts, maxts) - | _ -> None) + | Type_too_large (loc, ts, maxts) -> Some (loc, ts, maxts) | _ -> None) (fun (loc, ts, maxts) -> Type_too_large (loc, ts, maxts)) ; (* -- Toplevel errors ------------------- *) (* Ill typed data *) register_error_kind `Permanent ~id:"michelson_v1.ill_typed_data" - ~title: "Ill typed data" + ~title:"Ill typed data" ~description: - "The toplevel error thrown when trying to typecheck \ - a data expression against a given type \ - (always followed by more precise errors)." + "The toplevel error thrown when trying to typecheck a data expression \ + against a given type (always followed by more precise errors)." (obj3 (opt "identifier" string) (req "expected_type" Script.expr_encoding) (req "ill_typed_expression" Script.expr_encoding)) (function - | Ill_typed_data (name, expr, ty) -> Some (name, ty, expr) - | _ -> None) - (fun (name, ty, expr) -> Ill_typed_data (name, expr, ty)) ; + | Ill_typed_data (name, expr, ty) -> Some (name, ty, expr) | _ -> None) + (fun (name, ty, expr) -> Ill_typed_data (name, expr, ty)) ; (* Ill formed type *) register_error_kind `Permanent ~id:"michelson_v1.ill_formed_type" - ~title: "Ill formed type" + ~title:"Ill formed type" ~description: "The toplevel error thrown when trying to parse a type expression \ (always followed by more precise errors)." @@ -676,35 +611,32 @@ let () = (req "ill_formed_expression" Script.expr_encoding) (req "location" Script.location_encoding)) (function - | Ill_formed_type (name, expr, loc) -> Some (name, expr, loc) - | _ -> None) - (fun (name, expr, loc) -> - Ill_formed_type (name, expr, loc)) ; + | Ill_formed_type (name, expr, loc) -> Some (name, expr, loc) | _ -> None) + (fun (name, expr, loc) -> Ill_formed_type (name, expr, loc)) ; (* Ill typed contract *) register_error_kind `Permanent ~id:"michelson_v1.ill_typed_contract" - ~title: "Ill typed contract" + ~title:"Ill typed contract" ~description: - "The toplevel error thrown when trying to typecheck \ - a contract code against given input, output and storage types \ - (always followed by more precise errors)." + "The toplevel error thrown when trying to typecheck a contract code \ + against given input, output and storage types (always followed by more \ + precise errors)." (obj2 (req "ill_typed_code" Script.expr_encoding) (req "type_map" type_map_enc)) (function | Ill_typed_contract (expr, type_map) -> Some (expr, type_map) - | _ -> None) - (fun (expr, type_map) -> - Ill_typed_contract (expr, type_map)) ; + | _ -> + None) + (fun (expr, type_map) -> Ill_typed_contract (expr, type_map)) ; (* Cannot serialize error *) register_error_kind `Temporary ~id:"michelson_v1.cannot_serialize_error" ~title:"Not enough gas to serialize error" - ~description:"The error was too big to be serialized with \ - the provided gas" + ~description:"The error was too big to be serialized with the provided gas" Data_encoding.empty (function Cannot_serialize_error -> Some () | _ -> None) (fun () -> Cannot_serialize_error) ; @@ -717,4 +649,4 @@ let () = "A deprecated instruction usage is disallowed in newly created contracts" (obj1 (req "prim" prim_encoding)) (function Deprecated_instruction prim -> Some prim | _ -> None) - (fun prim -> Deprecated_instruction prim) ; + (fun prim -> Deprecated_instruction prim) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.ml index 8c6a48d32..c8474e2e1 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.ml @@ -31,34 +31,27 @@ let of_int64 = Z.of_int64 let of_string x = match Time_repr.of_notation x with - | None -> - begin try Some (Z.of_string x) - with _ -> None - end + | None -> ( + try Some (Z.of_string x) with _ -> None ) | Some time -> Some (of_int64 (Time_repr.to_seconds time)) let to_notation x = try let notation = Time_repr.to_notation (Time.of_seconds (Z.to_int64 x)) in - if String.equal notation "out_of_range" - then None - else Some notation + if String.equal notation "out_of_range" then None else Some notation with _ -> None let to_num_str = Z.to_string -let to_string x = - match to_notation x with - | None -> to_num_str x - | Some s -> s +let to_string x = match to_notation x with None -> to_num_str x | Some s -> s let diff x y = Script_int_repr.of_zint @@ Z.sub x y let sub_delta t delta = Z.sub t (Script_int_repr.to_zint delta) -let add_delta t delta = - Z.add t (Script_int_repr.to_zint delta) +let add_delta t delta = Z.add t (Script_int_repr.to_zint delta) let to_zint x = x + let of_zint x = x diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.mli index 73496c369..7f2b156d2 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_timestamp_repr.mli @@ -33,10 +33,13 @@ val compare : t -> t -> int (* Convert a timestamp to a notation if possible *) val to_notation : t -> string option + (* Convert a timestamp to a string representation of the seconds *) val to_num_str : t -> string + (* Convert to a notation if possible, or num if not *) val to_string : t -> string + val of_string : string -> t option val diff : t -> t -> z num @@ -46,4 +49,5 @@ val add_delta : t -> z num -> t val sub_delta : t -> z num -> t val to_zint : t -> Z.t + val of_zint : Z.t -> t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/script_typed_ir.ml b/vendors/ligo-utils/tezos-protocol-alpha/script_typed_ir.ml index d536ecec8..99b5c9b4f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/script_typed_ir.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/script_typed_ir.ml @@ -28,11 +28,13 @@ open Script_int (* ---- Auxiliary types -----------------------------------------------------*) -type var_annot = [ `Var_annot of string ] -type type_annot = [ `Type_annot of string ] -type field_annot = [ `Field_annot of string ] +type var_annot = [`Var_annot of string] -type annot = [ var_annot | type_annot | field_annot ] +type type_annot = [`Type_annot of string] + +type field_annot = [`Field_annot of string] + +type annot = [var_annot | type_annot | field_annot] type address = Contract.t * string @@ -41,6 +43,7 @@ type ('a, 'b) pair = 'a * 'b type ('a, 'b) union = L of 'a | R of 'b type comb = Comb + type leaf = Leaf type (_, _) comparable_struct = @@ -51,20 +54,27 @@ type (_, _) comparable_struct = | Mutez_key : type_annot option -> (Tez.t, _) comparable_struct | Bool_key : type_annot option -> (bool, _) comparable_struct | Key_hash_key : type_annot option -> (public_key_hash, _) comparable_struct - | Timestamp_key : type_annot option -> (Script_timestamp.t, _) comparable_struct + | Timestamp_key : + type_annot option + -> (Script_timestamp.t, _) comparable_struct | Address_key : type_annot option -> (address, _) comparable_struct | Pair_key : - (('a, leaf) comparable_struct * field_annot option) * - (('b, _) comparable_struct * field_annot option) * - type_annot option -> (('a, 'b) pair, comb) comparable_struct + (('a, leaf) comparable_struct * field_annot option) + * (('b, comb) comparable_struct * field_annot option) + * type_annot option + -> (('a, 'b) pair, comb) comparable_struct type 'a comparable_ty = ('a, comb) comparable_struct module type Boxed_set = sig type elt + val elt_ty : elt comparable_ty + module OPS : S.SET with type elt = elt + val boxed : OPS.t + val size : int end @@ -72,27 +82,35 @@ type 'elt set = (module Boxed_set with type elt = 'elt) module type Boxed_map = sig type key + type value + val key_ty : key comparable_ty + module OPS : S.MAP with type key = key + val boxed : value OPS.t * int end -type ('key, 'value) map = (module Boxed_map with type key = 'key and type value = 'value) +type ('key, 'value) map = + (module Boxed_map with type key = 'key and type value = 'value) type operation = packed_internal_operation * Contract.big_map_diff option -type ('arg, 'storage) script = - { code : (('arg, 'storage) pair, (operation list, 'storage) pair) lambda ; - arg_type : 'arg ty ; - storage : 'storage ; - storage_type : 'storage ty ; - root_name : string option } +type ('arg, 'storage) script = { + code : (('arg, 'storage) pair, (operation list, 'storage) pair) lambda; + arg_type : 'arg ty; + storage : 'storage; + storage_type : 'storage ty; + root_name : string option; +} and end_of_stack = unit and ('arg, 'ret) lambda = - Lam : ('arg * end_of_stack, 'ret * end_of_stack) descr * Script.node -> ('arg, 'ret) lambda + | Lam : + ('arg * end_of_stack, 'ret * end_of_stack) descr * Script.node + -> ('arg, 'ret) lambda and 'arg typed_contract = 'arg ty * address @@ -110,33 +128,43 @@ and 'ty ty = | Address_t : type_annot option -> address ty | Bool_t : type_annot option -> bool ty | Pair_t : - ('a ty * field_annot option * var_annot option) * - ('b ty * field_annot option * var_annot option) * - type_annot option * - bool -> ('a, 'b) pair ty + ('a ty * field_annot option * var_annot option) + * ('b ty * field_annot option * var_annot option) + * type_annot option + * bool + -> ('a, 'b) pair ty | Union_t : - ('a ty * field_annot option) * - ('b ty * field_annot option) * - type_annot option * - bool -> ('a, 'b) union ty - | Lambda_t : 'arg ty * 'ret ty * type_annot option -> ('arg, 'ret) lambda ty - | Option_t : 'v ty * type_annot option * bool -> 'v option ty + ('a ty * field_annot option) + * ('b ty * field_annot option) + * type_annot option + * bool + -> ('a, 'b) union ty + | Lambda_t : 'arg ty * 'ret ty * type_annot option -> ('arg, 'ret) lambda ty + | Option_t : 'v ty * type_annot option * bool -> 'v option ty | List_t : 'v ty * type_annot option * bool -> 'v list ty | Set_t : 'v comparable_ty * type_annot option -> 'v set ty - | Map_t : 'k comparable_ty * 'v ty * type_annot option * bool -> ('k, 'v) map ty - | Big_map_t : 'k comparable_ty * 'v ty * type_annot option -> ('k, 'v) big_map ty + | Map_t : + 'k comparable_ty * 'v ty * type_annot option * bool + -> ('k, 'v) map ty + | Big_map_t : + 'k comparable_ty * 'v ty * type_annot option + -> ('k, 'v) big_map ty | Contract_t : 'arg ty * type_annot option -> 'arg typed_contract ty | Operation_t : type_annot option -> operation ty | Chain_id_t : type_annot option -> Chain_id.t ty and 'ty stack_ty = - | Item_t : 'ty ty * 'rest stack_ty * var_annot option -> ('ty * 'rest) stack_ty + | Item_t : + 'ty ty * 'rest stack_ty * var_annot option + -> ('ty * 'rest) stack_ty | Empty_t : end_of_stack stack_ty -and ('key, 'value) big_map = { id : Z.t option ; - diff : ('key, 'value option) map ; - key_type : 'key ty ; - value_type : 'value ty } +and ('key, 'value) big_map = { + id : Z.t option; + diff : ('key, 'value option) map; + key_type : 'key ty; + value_type : 'value ty; +} (* ---- Instructions --------------------------------------------------------*) @@ -151,280 +179,225 @@ and ('key, 'value) big_map = { id : Z.t option ; constructors or type witness parameters. *) and ('bef, 'aft) instr = (* stack ops *) - | Drop : - (_ * 'rest, 'rest) instr - | Dup : - ('top * 'rest, 'top * ('top * 'rest)) instr - | Swap : - ('tip * ('top * 'rest), 'top * ('tip * 'rest)) instr - | Const : 'ty -> - ('rest, ('ty * 'rest)) instr + | Drop : (_ * 'rest, 'rest) instr + | Dup : ('top * 'rest, 'top * ('top * 'rest)) instr + | Swap : ('tip * ('top * 'rest), 'top * ('tip * 'rest)) instr + | Const : 'ty -> ('rest, 'ty * 'rest) instr (* pairs *) - | Cons_pair : - (('car * ('cdr * 'rest)), (('car, 'cdr) pair * 'rest)) instr - | Car : - (('car, _) pair * 'rest, 'car * 'rest) instr - | Cdr : - ((_, 'cdr) pair * 'rest, 'cdr * 'rest) instr + | Cons_pair : ('car * ('cdr * 'rest), ('car, 'cdr) pair * 'rest) instr + | Car : (('car, _) pair * 'rest, 'car * 'rest) instr + | Cdr : ((_, 'cdr) pair * 'rest, 'cdr * 'rest) instr (* options *) - | Cons_some : - ('v * 'rest, 'v option * 'rest) instr - | Cons_none : 'a ty -> - ('rest, 'a option * 'rest) instr - | If_none : ('bef, 'aft) descr * ('a * 'bef, 'aft) descr -> - ('a option * 'bef, 'aft) instr + | Cons_some : ('v * 'rest, 'v option * 'rest) instr + | Cons_none : 'a ty -> ('rest, 'a option * 'rest) instr + | If_none : + ('bef, 'aft) descr * ('a * 'bef, 'aft) descr + -> ('a option * 'bef, 'aft) instr (* unions *) - | Left : - ('l * 'rest, (('l, 'r) union * 'rest)) instr - | Right : - ('r * 'rest, (('l, 'r) union * 'rest)) instr - | If_left : ('l * 'bef, 'aft) descr * ('r * 'bef, 'aft) descr -> - (('l, 'r) union * 'bef, 'aft) instr + | Left : ('l * 'rest, ('l, 'r) union * 'rest) instr + | Right : ('r * 'rest, ('l, 'r) union * 'rest) instr + | If_left : + ('l * 'bef, 'aft) descr * ('r * 'bef, 'aft) descr + -> (('l, 'r) union * 'bef, 'aft) instr (* lists *) - | Cons_list : - ('a * ('a list * 'rest), ('a list * 'rest)) instr - | Nil : - ('rest, ('a list * 'rest)) instr - | If_cons : ('a * ('a list * 'bef), 'aft) descr * ('bef, 'aft) descr -> - ('a list * 'bef, 'aft) instr - | List_map : ('a * 'rest, 'b * 'rest) descr -> - ('a list * 'rest, 'b list * 'rest) instr - | List_iter : ('a * 'rest, 'rest) descr -> - ('a list * 'rest, 'rest) instr + | Cons_list : ('a * ('a list * 'rest), 'a list * 'rest) instr + | Nil : ('rest, 'a list * 'rest) instr + | If_cons : + ('a * ('a list * 'bef), 'aft) descr * ('bef, 'aft) descr + -> ('a list * 'bef, 'aft) instr + | List_map : + ('a * 'rest, 'b * 'rest) descr + -> ('a list * 'rest, 'b list * 'rest) instr + | List_iter : ('a * 'rest, 'rest) descr -> ('a list * 'rest, 'rest) instr | List_size : ('a list * 'rest, n num * 'rest) instr (* sets *) - | Empty_set : 'a comparable_ty -> - ('rest, 'a set * 'rest) instr - | Set_iter : ('a * 'rest, 'rest) descr -> - ('a set * 'rest, 'rest) instr - | Set_mem : - ('elt * ('elt set * 'rest), bool * 'rest) instr - | Set_update : - ('elt * (bool * ('elt set * 'rest)), 'elt set * 'rest) instr + | Empty_set : 'a comparable_ty -> ('rest, 'a set * 'rest) instr + | Set_iter : ('a * 'rest, 'rest) descr -> ('a set * 'rest, 'rest) instr + | Set_mem : ('elt * ('elt set * 'rest), bool * 'rest) instr + | Set_update : ('elt * (bool * ('elt set * 'rest)), 'elt set * 'rest) instr | Set_size : ('a set * 'rest, n num * 'rest) instr (* maps *) - | Empty_map : 'a comparable_ty * 'v ty -> - ('rest, ('a, 'v) map * 'rest) instr - | Map_map : (('a * 'v) * 'rest, 'r * 'rest) descr -> - (('a, 'v) map * 'rest, ('a, 'r) map * 'rest) instr - | Map_iter : (('a * 'v) * 'rest, 'rest) descr -> - (('a, 'v) map * 'rest, 'rest) instr - | Map_mem : - ('a * (('a, 'v) map * 'rest), bool * 'rest) instr - | Map_get : - ('a * (('a, 'v) map * 'rest), 'v option * 'rest) instr - | Map_update : - ('a * ('v option * (('a, 'v) map * 'rest)), ('a, 'v) map * 'rest) instr + | Empty_map : 'a comparable_ty * 'v ty -> ('rest, ('a, 'v) map * 'rest) instr + | Map_map : + (('a * 'v) * 'rest, 'r * 'rest) descr + -> (('a, 'v) map * 'rest, ('a, 'r) map * 'rest) instr + | Map_iter : + (('a * 'v) * 'rest, 'rest) descr + -> (('a, 'v) map * 'rest, 'rest) instr + | Map_mem : ('a * (('a, 'v) map * 'rest), bool * 'rest) instr + | Map_get : ('a * (('a, 'v) map * 'rest), 'v option * 'rest) instr + | Map_update + : ('a * ('v option * (('a, 'v) map * 'rest)), ('a, 'v) map * 'rest) instr | Map_size : (('a, 'b) map * 'rest, n num * 'rest) instr (* big maps *) - | Empty_big_map : 'a comparable_ty * 'v ty -> - ('rest, ('a, 'v) big_map * 'rest) instr - | Big_map_mem : - ('a * (('a, 'v) big_map * 'rest), bool * 'rest) instr - | Big_map_get : - ('a * (('a, 'v) big_map * 'rest), 'v option * 'rest) instr - | Big_map_update : - ('key * ('value option * (('key, 'value) big_map * 'rest)), ('key, 'value) big_map * 'rest) instr + | Empty_big_map : + 'a comparable_ty * 'v ty + -> ('rest, ('a, 'v) big_map * 'rest) instr + | Big_map_mem : ('a * (('a, 'v) big_map * 'rest), bool * 'rest) instr + | Big_map_get : ('a * (('a, 'v) big_map * 'rest), 'v option * 'rest) instr + | Big_map_update + : ( 'key * ('value option * (('key, 'value) big_map * 'rest)), + ('key, 'value) big_map * 'rest ) + instr (* string operations *) - | Concat_string : - (string list * 'rest, string * 'rest) instr - | Concat_string_pair : - (string * (string * 'rest), string * 'rest) instr - | Slice_string : - (n num * (n num * (string * 'rest)), string option * 'rest) instr - | String_size : - (string * 'rest, n num * 'rest) instr + | Concat_string : (string list * 'rest, string * 'rest) instr + | Concat_string_pair : (string * (string * 'rest), string * 'rest) instr + | Slice_string + : (n num * (n num * (string * 'rest)), string option * 'rest) instr + | String_size : (string * 'rest, n num * 'rest) instr (* bytes operations *) - | Concat_bytes : - (MBytes.t list * 'rest, MBytes.t * 'rest) instr - | Concat_bytes_pair : - (MBytes.t * (MBytes.t * 'rest), MBytes.t * 'rest) instr - | Slice_bytes : - (n num * (n num * (MBytes.t * 'rest)), MBytes.t option * 'rest) instr - | Bytes_size : - (MBytes.t * 'rest, n num * 'rest) instr + | Concat_bytes : (MBytes.t list * 'rest, MBytes.t * 'rest) instr + | Concat_bytes_pair : (MBytes.t * (MBytes.t * 'rest), MBytes.t * 'rest) instr + | Slice_bytes + : (n num * (n num * (MBytes.t * 'rest)), MBytes.t option * 'rest) instr + | Bytes_size : (MBytes.t * 'rest, n num * 'rest) instr (* timestamp operations *) - | Add_seconds_to_timestamp : - (z num * (Script_timestamp.t * 'rest), - Script_timestamp.t * 'rest) instr - | Add_timestamp_to_seconds : - (Script_timestamp.t * (z num * 'rest), - Script_timestamp.t * 'rest) instr - | Sub_timestamp_seconds : - (Script_timestamp.t * (z num * 'rest), - Script_timestamp.t * 'rest) instr - | Diff_timestamps : - (Script_timestamp.t * (Script_timestamp.t * 'rest), - z num * 'rest) instr + | Add_seconds_to_timestamp + : ( z num * (Script_timestamp.t * 'rest), + Script_timestamp.t * 'rest ) + instr + | Add_timestamp_to_seconds + : ( Script_timestamp.t * (z num * 'rest), + Script_timestamp.t * 'rest ) + instr + | Sub_timestamp_seconds + : ( Script_timestamp.t * (z num * 'rest), + Script_timestamp.t * 'rest ) + instr + | Diff_timestamps + : ( Script_timestamp.t * (Script_timestamp.t * 'rest), + z num * 'rest ) + instr (* tez operations *) - | Add_tez : - (Tez.t * (Tez.t * 'rest), Tez.t * 'rest) instr - | Sub_tez : - (Tez.t * (Tez.t * 'rest), Tez.t * 'rest) instr - | Mul_teznat : - (Tez.t * (n num * 'rest), Tez.t * 'rest) instr - | Mul_nattez : - (n num * (Tez.t * 'rest), Tez.t * 'rest) instr - | Ediv_teznat : - (Tez.t * (n num * 'rest), ((Tez.t, Tez.t) pair) option * 'rest) instr - | Ediv_tez : - (Tez.t * (Tez.t * 'rest), ((n num, Tez.t) pair) option * 'rest) instr + | Add_tez : (Tez.t * (Tez.t * 'rest), Tez.t * 'rest) instr + | Sub_tez : (Tez.t * (Tez.t * 'rest), Tez.t * 'rest) instr + | Mul_teznat : (Tez.t * (n num * 'rest), Tez.t * 'rest) instr + | Mul_nattez : (n num * (Tez.t * 'rest), Tez.t * 'rest) instr + | Ediv_teznat + : (Tez.t * (n num * 'rest), (Tez.t, Tez.t) pair option * 'rest) instr + | Ediv_tez + : (Tez.t * (Tez.t * 'rest), (n num, Tez.t) pair option * 'rest) instr (* boolean operations *) - | Or : - (bool * (bool * 'rest), bool * 'rest) instr - | And : - (bool * (bool * 'rest), bool * 'rest) instr - | Xor : - (bool * (bool * 'rest), bool * 'rest) instr - | Not : - (bool * 'rest, bool * 'rest) instr + | Or : (bool * (bool * 'rest), bool * 'rest) instr + | And : (bool * (bool * 'rest), bool * 'rest) instr + | Xor : (bool * (bool * 'rest), bool * 'rest) instr + | Not : (bool * 'rest, bool * 'rest) instr (* integer operations *) - | Is_nat : - (z num * 'rest, n num option * 'rest) instr - | Neg_nat : - (n num * 'rest, z num * 'rest) instr - | Neg_int : - (z num * 'rest, z num * 'rest) instr - | Abs_int : - (z num * 'rest, n num * 'rest) instr - | Int_nat : - (n num * 'rest, z num * 'rest) instr - | Add_intint : - (z num * (z num * 'rest), z num * 'rest) instr - | Add_intnat : - (z num * (n num * 'rest), z num * 'rest) instr - | Add_natint : - (n num * (z num * 'rest), z num * 'rest) instr - | Add_natnat : - (n num * (n num * 'rest), n num * 'rest) instr - | Sub_int : - ('s num * ('t num * 'rest), z num * 'rest) instr - | Mul_intint : - (z num * (z num * 'rest), z num * 'rest) instr - | Mul_intnat : - (z num * (n num * 'rest), z num * 'rest) instr - | Mul_natint : - (n num * (z num * 'rest), z num * 'rest) instr - | Mul_natnat : - (n num * (n num * 'rest), n num * 'rest) instr - | Ediv_intint : - (z num * (z num * 'rest), ((z num, n num) pair) option * 'rest) instr - | Ediv_intnat : - (z num * (n num * 'rest), ((z num, n num) pair) option * 'rest) instr - | Ediv_natint : - (n num * (z num * 'rest), ((z num, n num) pair) option * 'rest) instr - | Ediv_natnat : - (n num * (n num * 'rest), ((n num, n num) pair) option * 'rest) instr - | Lsl_nat : - (n num * (n num * 'rest), n num * 'rest) instr - | Lsr_nat : - (n num * (n num * 'rest), n num * 'rest) instr - | Or_nat : - (n num * (n num * 'rest), n num * 'rest) instr - | And_nat : - (n num * (n num * 'rest), n num * 'rest) instr - | And_int_nat : - (z num * (n num * 'rest), n num * 'rest) instr - | Xor_nat : - (n num * (n num * 'rest), n num * 'rest) instr - | Not_nat : - (n num * 'rest, z num * 'rest) instr - | Not_int : - (z num * 'rest, z num * 'rest) instr + | Is_nat : (z num * 'rest, n num option * 'rest) instr + | Neg_nat : (n num * 'rest, z num * 'rest) instr + | Neg_int : (z num * 'rest, z num * 'rest) instr + | Abs_int : (z num * 'rest, n num * 'rest) instr + | Int_nat : (n num * 'rest, z num * 'rest) instr + | Add_intint : (z num * (z num * 'rest), z num * 'rest) instr + | Add_intnat : (z num * (n num * 'rest), z num * 'rest) instr + | Add_natint : (n num * (z num * 'rest), z num * 'rest) instr + | Add_natnat : (n num * (n num * 'rest), n num * 'rest) instr + | Sub_int : ('s num * ('t num * 'rest), z num * 'rest) instr + | Mul_intint : (z num * (z num * 'rest), z num * 'rest) instr + | Mul_intnat : (z num * (n num * 'rest), z num * 'rest) instr + | Mul_natint : (n num * (z num * 'rest), z num * 'rest) instr + | Mul_natnat : (n num * (n num * 'rest), n num * 'rest) instr + | Ediv_intint + : (z num * (z num * 'rest), (z num, n num) pair option * 'rest) instr + | Ediv_intnat + : (z num * (n num * 'rest), (z num, n num) pair option * 'rest) instr + | Ediv_natint + : (n num * (z num * 'rest), (z num, n num) pair option * 'rest) instr + | Ediv_natnat + : (n num * (n num * 'rest), (n num, n num) pair option * 'rest) instr + | Lsl_nat : (n num * (n num * 'rest), n num * 'rest) instr + | Lsr_nat : (n num * (n num * 'rest), n num * 'rest) instr + | Or_nat : (n num * (n num * 'rest), n num * 'rest) instr + | And_nat : (n num * (n num * 'rest), n num * 'rest) instr + | And_int_nat : (z num * (n num * 'rest), n num * 'rest) instr + | Xor_nat : (n num * (n num * 'rest), n num * 'rest) instr + | Not_nat : (n num * 'rest, z num * 'rest) instr + | Not_int : (z num * 'rest, z num * 'rest) instr (* control *) - | Seq : ('bef, 'trans) descr * ('trans, 'aft) descr -> - ('bef, 'aft) instr - | If : ('bef, 'aft) descr * ('bef, 'aft) descr -> - (bool * 'bef, 'aft) instr - | Loop : ('rest, bool * 'rest) descr -> - (bool * 'rest, 'rest) instr - | Loop_left : ('a * 'rest, ('a, 'b) union * 'rest) descr -> - (('a, 'b) union * 'rest, 'b * 'rest) instr - | Dip : ('bef, 'aft) descr -> - ('top * 'bef, 'top * 'aft) instr - | Exec : - ('arg * (('arg, 'ret) lambda * 'rest), 'ret * 'rest) instr - | Apply : 'arg ty -> - ('arg * (('arg * 'remaining, 'ret) lambda * 'rest), ('remaining, 'ret) lambda * 'rest) instr - | Lambda : ('arg, 'ret) lambda -> - ('rest, ('arg, 'ret) lambda * 'rest) instr - | Failwith : - 'a ty -> ('a * 'rest, 'aft) instr - | Nop : - ('rest, 'rest) instr + | Seq : ('bef, 'trans) descr * ('trans, 'aft) descr -> ('bef, 'aft) instr + | If : ('bef, 'aft) descr * ('bef, 'aft) descr -> (bool * 'bef, 'aft) instr + | Loop : ('rest, bool * 'rest) descr -> (bool * 'rest, 'rest) instr + | Loop_left : + ('a * 'rest, ('a, 'b) union * 'rest) descr + -> (('a, 'b) union * 'rest, 'b * 'rest) instr + | Dip : ('bef, 'aft) descr -> ('top * 'bef, 'top * 'aft) instr + | Exec : ('arg * (('arg, 'ret) lambda * 'rest), 'ret * 'rest) instr + | Apply : + 'arg ty + -> ( 'arg * (('arg * 'remaining, 'ret) lambda * 'rest), + ('remaining, 'ret) lambda * 'rest ) + instr + | Lambda : ('arg, 'ret) lambda -> ('rest, ('arg, 'ret) lambda * 'rest) instr + | Failwith : 'a ty -> ('a * 'rest, 'aft) instr + | Nop : ('rest, 'rest) instr (* comparison *) - | Compare : 'a comparable_ty -> - ('a * ('a * 'rest), z num * 'rest) instr + | Compare : 'a comparable_ty -> ('a * ('a * 'rest), z num * 'rest) instr (* comparators *) - | Eq : - (z num * 'rest, bool * 'rest) instr - | Neq : - (z num * 'rest, bool * 'rest) instr - | Lt : - (z num * 'rest, bool * 'rest) instr - | Gt : - (z num * 'rest, bool * 'rest) instr - | Le : - (z num * 'rest, bool * 'rest) instr - | Ge : - (z num * 'rest, bool * 'rest) instr + | Eq : (z num * 'rest, bool * 'rest) instr + | Neq : (z num * 'rest, bool * 'rest) instr + | Lt : (z num * 'rest, bool * 'rest) instr + | Gt : (z num * 'rest, bool * 'rest) instr + | Le : (z num * 'rest, bool * 'rest) instr + | Ge : (z num * 'rest, bool * 'rest) instr (* protocol *) - | Address : - (_ typed_contract * 'rest, address * 'rest) instr - | Contract : 'p ty * string -> - (address * 'rest, 'p typed_contract option * 'rest) instr - | Transfer_tokens : - ('arg * (Tez.t * ('arg typed_contract * 'rest)), operation * 'rest) instr - | Create_account : - (public_key_hash * (public_key_hash option * (bool * (Tez.t * 'rest))), - operation * (address * 'rest)) instr - | Implicit_account : - (public_key_hash * 'rest, unit typed_contract * 'rest) instr - | Create_contract : 'g ty * 'p ty * ('p * 'g, operation list * 'g) lambda * string option -> - (public_key_hash * (public_key_hash option * (bool * (bool * (Tez.t * ('g * 'rest))))), - operation * (address * 'rest)) instr - | Create_contract_2 : 'g ty * 'p ty * ('p * 'g, operation list * 'g) lambda * string option -> - (public_key_hash option * (Tez.t * ('g * 'rest)), operation * (address * 'rest)) instr - | Set_delegate : - (public_key_hash option * 'rest, operation * 'rest) instr - | Now : - ('rest, Script_timestamp.t * 'rest) instr - | Balance : - ('rest, Tez.t * 'rest) instr - | Check_signature : - (public_key * (signature * (MBytes.t * 'rest)), bool * 'rest) instr - | Hash_key : - (public_key * 'rest, public_key_hash * 'rest) instr - | Pack : 'a ty -> - ('a * 'rest, MBytes.t * 'rest) instr - | Unpack : 'a ty -> - (MBytes.t * 'rest, 'a option * 'rest) instr - | Blake2b : - (MBytes.t * 'rest, MBytes.t * 'rest) instr - | Sha256 : - (MBytes.t * 'rest, MBytes.t * 'rest) instr - | Sha512 : - (MBytes.t * 'rest, MBytes.t * 'rest) instr - | Steps_to_quota : (* TODO: check that it always returns a nat *) + | Address : (_ typed_contract * 'rest, address * 'rest) instr + | Contract : + 'p ty * string + -> (address * 'rest, 'p typed_contract option * 'rest) instr + | Transfer_tokens + : ( 'arg * (Tez.t * ('arg typed_contract * 'rest)), + operation * 'rest ) + instr + | Create_account + : ( public_key_hash * (public_key_hash option * (bool * (Tez.t * 'rest))), + operation * (address * 'rest) ) + instr + | Implicit_account + : (public_key_hash * 'rest, unit typed_contract * 'rest) instr + | Create_contract : + 'g ty * 'p ty * ('p * 'g, operation list * 'g) lambda * string option + -> ( public_key_hash + * (public_key_hash option * (bool * (bool * (Tez.t * ('g * 'rest))))), + operation * (address * 'rest) ) + instr + | Create_contract_2 : + 'g ty * 'p ty * ('p * 'g, operation list * 'g) lambda * string option + -> ( public_key_hash option * (Tez.t * ('g * 'rest)), + operation * (address * 'rest) ) + instr + | Set_delegate : (public_key_hash option * 'rest, operation * 'rest) instr + | Now : ('rest, Script_timestamp.t * 'rest) instr + | Balance : ('rest, Tez.t * 'rest) instr + | Check_signature + : (public_key * (signature * (MBytes.t * 'rest)), bool * 'rest) instr + | Hash_key : (public_key * 'rest, public_key_hash * 'rest) instr + | Pack : 'a ty -> ('a * 'rest, MBytes.t * 'rest) instr + | Unpack : 'a ty -> (MBytes.t * 'rest, 'a option * 'rest) instr + | Blake2b : (MBytes.t * 'rest, MBytes.t * 'rest) instr + | Sha256 : (MBytes.t * 'rest, MBytes.t * 'rest) instr + | Sha512 : (MBytes.t * 'rest, MBytes.t * 'rest) instr + | Steps_to_quota + : (* TODO: check that it always returns a nat *) ('rest, n num * 'rest) instr - | Source : - ('rest, address * 'rest) instr - | Sender : - ('rest, address * 'rest) instr - | Self : 'p ty * string -> - ('rest, 'p typed_contract * 'rest) instr - | Amount : - ('rest, Tez.t * 'rest) instr - | Dig : int * ('x * 'rest, 'rest, 'bef, 'aft) stack_prefix_preservation_witness -> - ('bef, 'x * 'aft) instr - | Dug : int * ('rest, 'x * 'rest, 'bef, 'aft) stack_prefix_preservation_witness -> - ('x * 'bef, 'aft) instr - | Dipn : int * ('fbef, 'faft, 'bef, 'aft) stack_prefix_preservation_witness * ('fbef, 'faft) descr -> - ('bef, 'aft) instr - | Dropn : int * ('rest, 'rest, 'bef, _) stack_prefix_preservation_witness -> - ('bef, 'rest) instr - | ChainId : - ('rest, Chain_id.t * 'rest) instr + | Source : ('rest, address * 'rest) instr + | Sender : ('rest, address * 'rest) instr + | Self : 'p ty * string -> ('rest, 'p typed_contract * 'rest) instr + | Amount : ('rest, Tez.t * 'rest) instr + | Dig : + int * ('x * 'rest, 'rest, 'bef, 'aft) stack_prefix_preservation_witness + -> ('bef, 'x * 'aft) instr + | Dug : + int * ('rest, 'x * 'rest, 'bef, 'aft) stack_prefix_preservation_witness + -> ('x * 'bef, 'aft) instr + | Dipn : + int + * ('fbef, 'faft, 'bef, 'aft) stack_prefix_preservation_witness + * ('fbef, 'faft) descr + -> ('bef, 'aft) instr + | Dropn : + int * ('rest, 'rest, 'bef, _) stack_prefix_preservation_witness + -> ('bef, 'rest) instr + | ChainId : ('rest, Chain_id.t * 'rest) instr (* Type witness for operations that work deep in the stack ignoring (and preserving) a prefix. @@ -434,14 +407,16 @@ and ('bef, 'aft) instr = parameters are the shape of the stack without the prefix before and after. The inductive definition makes it so by construction. *) and ('bef, 'aft, 'bef_suffix, 'aft_suffix) stack_prefix_preservation_witness = - | Prefix : ('fbef, 'faft, 'bef, 'aft) stack_prefix_preservation_witness - -> ('fbef, 'faft, 'x * 'bef, 'x * 'aft) stack_prefix_preservation_witness + | Prefix : + ('fbef, 'faft, 'bef, 'aft) stack_prefix_preservation_witness + -> ('fbef, 'faft, 'x * 'bef, 'x * 'aft) stack_prefix_preservation_witness | Rest : ('bef, 'aft, 'bef, 'aft) stack_prefix_preservation_witness -and ('bef, 'aft) descr = - { loc : Script.location ; - bef : 'bef stack_ty ; - aft : 'aft stack_ty ; - instr : ('bef, 'aft) instr } +and ('bef, 'aft) descr = { + loc : Script.location; + bef : 'bef stack_ty; + aft : 'aft stack_ty; + instr : ('bef, 'aft) instr; +} type ex_big_map = Ex_bm : ('key, 'value) big_map -> ex_big_map diff --git a/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.ml index 4a18d2a6a..bf949161f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.ml @@ -26,13 +26,17 @@ (* Tezos Protocol Implementation - Random number generation *) type seed = B of State_hash.t + type t = T of State_hash.t + type sequence = S of State_hash.t + type nonce = MBytes.t let nonce_encoding = Data_encoding.Fixed.bytes Constants_repr.nonce_length let init = "Laissez-faire les proprietaires." + let zero_bytes = MBytes.of_string (String.make Nonce_hash.size '\000') let state_hash_encoding = @@ -44,31 +48,25 @@ let state_hash_encoding = let seed_encoding = let open Data_encoding in - conv - (fun (B b) -> b) - (fun b -> B b) - state_hash_encoding + conv (fun (B b) -> b) (fun b -> B b) state_hash_encoding let empty = B (State_hash.hash_bytes [MBytes.of_string init]) let nonce (B state) nonce = - B (State_hash.hash_bytes ( [State_hash.to_bytes state; nonce] )) + B (State_hash.hash_bytes [State_hash.to_bytes state; nonce]) let initialize_new (B state) append = - T (State_hash.hash_bytes - (State_hash.to_bytes state :: zero_bytes :: append )) + T (State_hash.hash_bytes (State_hash.to_bytes state :: zero_bytes :: append)) let xor_higher_bits i b = let higher = MBytes.get_int32 b 0 in let r = Int32.logxor higher i in let res = MBytes.copy b in - MBytes.set_int32 res 0 r; - res + MBytes.set_int32 res 0 r ; res let sequence (T state) n = - State_hash.to_bytes state - |> xor_higher_bits n - |> (fun b -> S (State_hash.hash_bytes [b])) + State_hash.to_bytes state |> xor_higher_bits n + |> fun b -> S (State_hash.hash_bytes [b]) let take (S state) = let b = State_hash.to_bytes state in @@ -76,19 +74,19 @@ let take (S state) = (State_hash.to_bytes h, S h) let take_int32 s bound = - if Compare.Int32.(bound <= 0l) - then invalid_arg "Seed_repr.take_int32" (* FIXME *) + if Compare.Int32.(bound <= 0l) then invalid_arg "Seed_repr.take_int32" + (* FIXME *) else let rec loop s = - let bytes, s = take s in + let (bytes, s) = take s in let r = Int32.abs (MBytes.get_int32 bytes 0) in let drop_if_over = - Int32.sub Int32.max_int (Int32.rem Int32.max_int bound) in - if Compare.Int32.(r >= drop_if_over) - then loop s + Int32.sub Int32.max_int (Int32.rem Int32.max_int bound) + in + if Compare.Int32.(r >= drop_if_over) then loop s else let v = Int32.rem r bound in - v, s + (v, s) in loop s @@ -101,15 +99,17 @@ let () = ~title:"Unexpected nonce length" ~description:"Nonce length is incorrect." ~pp:(fun ppf () -> - Format.fprintf ppf "Nonce length is not %i bytes long as it should." - Constants_repr.nonce_length) + Format.fprintf + ppf + "Nonce length is not %i bytes long as it should." + Constants_repr.nonce_length) Data_encoding.empty (function Unexpected_nonce_length -> Some () | _ -> None) (fun () -> Unexpected_nonce_length) let make_nonce nonce = - if Compare.Int.(MBytes.length nonce <> Constants_repr.nonce_length) - then error Unexpected_nonce_length + if Compare.Int.(MBytes.length nonce <> Constants_repr.nonce_length) then + error Unexpected_nonce_length else ok nonce let hash nonce = Nonce_hash.hash_bytes [nonce] @@ -122,18 +122,13 @@ let nonce_hash_key_part = Nonce_hash.to_path let initial_nonce_0 = zero_bytes -let initial_nonce_hash_0 = - hash initial_nonce_0 +let initial_nonce_hash_0 = hash initial_nonce_0 let deterministic_seed seed = nonce seed zero_bytes let initial_seeds n = let rec loop acc elt i = - if Compare.Int.(i = 1) then - List.rev (elt :: acc) - else - loop - (elt :: acc) - (deterministic_seed elt) - (i-1) in + if Compare.Int.(i = 1) then List.rev (elt :: acc) + else loop (elt :: acc) (deterministic_seed elt) (i - 1) + in loop [] (B (State_hash.hash_bytes [])) n diff --git a/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.mli index d8ed774ce..7319f0a5c 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/seed_repr.mli @@ -32,7 +32,6 @@ The only expected property is: It should be difficult to find a seed such that the generated sequence is a given one. *) - (** {2 Random Generation} *) (** The state of the random number generator *) @@ -91,9 +90,11 @@ val nonce_hash_key_part : Nonce_hash.t -> string list -> string list (** {2 Predefined nonce} *) val initial_nonce_0 : nonce + val initial_nonce_hash_0 : Nonce_hash.t (** {2 Serializers} *) -val nonce_encoding : nonce Data_encoding.t +val nonce_encoding : nonce Data_encoding.t + val seed_encoding : seed Data_encoding.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.ml index 6f855b652..f1f00315d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.ml @@ -26,9 +26,13 @@ open Misc type error += - | Unknown of { oldest : Cycle_repr.t ; - cycle : Cycle_repr.t ; - latest : Cycle_repr.t } (* `Permanent *) + | Unknown of { + oldest : Cycle_repr.t; + cycle : Cycle_repr.t; + latest : Cycle_repr.t; + } + +(* `Permanent *) let () = register_error_kind @@ -37,46 +41,60 @@ let () = ~title:"Unknown seed" ~description:"The requested seed is not available" ~pp:(fun ppf (oldest, cycle, latest) -> - if Cycle_repr.(cycle < oldest) then - Format.fprintf ppf - "The seed for cycle %a has been cleared from the context \ - \ (oldest known seed is for cycle %a)" - Cycle_repr.pp cycle - Cycle_repr.pp oldest - else - Format.fprintf ppf - "The seed for cycle %a has not been computed yet \ - \ (latest known seed is for cycle %a)" - Cycle_repr.pp cycle - Cycle_repr.pp latest) - Data_encoding.(obj3 - (req "oldest" Cycle_repr.encoding) - (req "requested" Cycle_repr.encoding) - (req "latest" Cycle_repr.encoding)) + if Cycle_repr.(cycle < oldest) then + Format.fprintf + ppf + "The seed for cycle %a has been cleared from the context (oldest \ + known seed is for cycle %a)" + Cycle_repr.pp + cycle + Cycle_repr.pp + oldest + else + Format.fprintf + ppf + "The seed for cycle %a has not been computed yet (latest known \ + seed is for cycle %a)" + Cycle_repr.pp + cycle + Cycle_repr.pp + latest) + Data_encoding.( + obj3 + (req "oldest" Cycle_repr.encoding) + (req "requested" Cycle_repr.encoding) + (req "latest" Cycle_repr.encoding)) (function - | Unknown { oldest ; cycle ; latest } -> Some (oldest, cycle, latest) - | _ -> None) - (fun (oldest, cycle, latest) -> Unknown { oldest ; cycle ; latest }) + | Unknown {oldest; cycle; latest} -> + Some (oldest, cycle, latest) + | _ -> + None) + (fun (oldest, cycle, latest) -> Unknown {oldest; cycle; latest}) let compute_for_cycle c ~revealed cycle = match Cycle_repr.pred cycle with - | None -> assert false (* should not happen *) + | None -> + assert false (* should not happen *) | Some previous_cycle -> let levels = Level_storage.levels_with_commitments_in_cycle c revealed in let combine (c, random_seed, unrevealed) level = - Storage.Seed.Nonce.get c level >>=? function + Storage.Seed.Nonce.get c level + >>=? function | Revealed nonce -> - Storage.Seed.Nonce.delete c level >>=? fun c -> + Storage.Seed.Nonce.delete c level + >>=? fun c -> return (c, Seed_repr.nonce random_seed nonce, unrevealed) | Unrevealed u -> - Storage.Seed.Nonce.delete c level >>=? fun c -> - return (c, random_seed, u :: unrevealed) + Storage.Seed.Nonce.delete c level + >>=? fun c -> return (c, random_seed, u :: unrevealed) in - Storage.Seed.For_cycle.get c previous_cycle >>=? fun prev_seed -> + Storage.Seed.For_cycle.get c previous_cycle + >>=? fun prev_seed -> let seed = Seed_repr.deterministic_seed prev_seed in - fold_left_s combine (c, seed, []) levels >>=? fun (c, seed, unrevealed) -> - Storage.Seed.For_cycle.init c cycle seed >>=? fun c -> - return (c, unrevealed) + fold_left_s combine (c, seed, []) levels + >>=? fun (c, seed, unrevealed) -> + Storage.Seed.For_cycle.init c cycle seed + >>=? fun c -> return (c, unrevealed) let for_cycle ctxt cycle = let preserved = Constants_storage.preserved_cycles ctxt in @@ -85,40 +103,46 @@ let for_cycle ctxt cycle = let latest = if Cycle_repr.(current_cycle = root) then Cycle_repr.add current_cycle (preserved + 1) - else - Cycle_repr.add current_cycle preserved in + else Cycle_repr.add current_cycle preserved + in let oldest = match Cycle_repr.sub current_cycle preserved with - | None -> Cycle_repr.root - | Some oldest -> oldest in - fail_unless Cycle_repr.(oldest <= cycle && cycle <= latest) - (Unknown { oldest ; cycle ; latest }) >>=? fun () -> - Storage.Seed.For_cycle.get ctxt cycle + | None -> + Cycle_repr.root + | Some oldest -> + oldest + in + fail_unless + Cycle_repr.(oldest <= cycle && cycle <= latest) + (Unknown {oldest; cycle; latest}) + >>=? fun () -> Storage.Seed.For_cycle.get ctxt cycle -let clear_cycle c cycle = - Storage.Seed.For_cycle.delete c cycle +let clear_cycle c cycle = Storage.Seed.For_cycle.delete c cycle let init ctxt = let preserved = Constants_storage.preserved_cycles ctxt in List.fold_left2 (fun ctxt c seed -> - ctxt >>=? fun ctxt -> - let cycle = Cycle_repr.of_int32_exn (Int32.of_int c) in - Storage.Seed.For_cycle.init ctxt cycle seed) + ctxt + >>=? fun ctxt -> + let cycle = Cycle_repr.of_int32_exn (Int32.of_int c) in + Storage.Seed.For_cycle.init ctxt cycle seed) (return ctxt) - (0 --> (preserved+1)) - (Seed_repr.initial_seeds (preserved+2)) + (0 --> (preserved + 1)) + (Seed_repr.initial_seeds (preserved + 2)) let cycle_end ctxt last_cycle = let preserved = Constants_storage.preserved_cycles ctxt in - begin - match Cycle_repr.sub last_cycle preserved with - | None -> return ctxt - | Some cleared_cycle -> - clear_cycle ctxt cleared_cycle - end >>=? fun ctxt -> + ( match Cycle_repr.sub last_cycle preserved with + | None -> + return ctxt + | Some cleared_cycle -> + clear_cycle ctxt cleared_cycle ) + >>=? fun ctxt -> match Cycle_repr.pred last_cycle with - | None -> return (ctxt, []) - | Some revealed -> (* cycle with revelations *) - let inited_seed_cycle = Cycle_repr.add last_cycle (preserved+1) in + | None -> + return (ctxt, []) + | Some revealed -> + (* cycle with revelations *) + let inited_seed_cycle = Cycle_repr.add last_cycle (preserved + 1) in compute_for_cycle ctxt ~revealed inited_seed_cycle diff --git a/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.mli index 2a1fd25a0..37e87efed 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/seed_storage.mli @@ -24,21 +24,24 @@ (*****************************************************************************) type error += - | Unknown of { oldest : Cycle_repr.t ; - cycle : Cycle_repr.t ; - latest : Cycle_repr.t } (* `Permanent *) + | Unknown of { + oldest : Cycle_repr.t; + cycle : Cycle_repr.t; + latest : Cycle_repr.t; + } + +(* `Permanent *) (** Generates the first [preserved_cycles+2] seeds for which there are no nonces. *) -val init: - Raw_context.t -> Raw_context.t tzresult Lwt.t +val init : Raw_context.t -> Raw_context.t tzresult Lwt.t -val for_cycle: - Raw_context.t -> Cycle_repr.t -> Seed_repr.seed tzresult Lwt.t +val for_cycle : Raw_context.t -> Cycle_repr.t -> Seed_repr.seed tzresult Lwt.t (** If it is the end of the cycle, computes and stores the seed of cycle at distance [preserved_cycle+2] in the future using the seed of the previous cycle and the revelations of the current one. *) -val cycle_end: - Raw_context.t -> Cycle_repr.t -> +val cycle_end : + Raw_context.t -> + Cycle_repr.t -> (Raw_context.t * Nonce_storage.unrevealed list) tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/services_registration.ml b/vendors/ligo-utils/tezos-protocol-alpha/services_registration.ml index 3113307f7..44338933c 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/services_registration.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/services_registration.ml @@ -26,12 +26,12 @@ open Alpha_context type rpc_context = { - block_hash: Block_hash.t ; - block_header: Block_header.shell_header ; - context: Alpha_context.t ; + block_hash : Block_hash.t; + block_header : Block_header.shell_header; + context : Alpha_context.t; } -let rpc_init ({ block_hash ; block_header ; context } : Updater.rpc_context) = +let rpc_init ({block_hash; block_header; context} : Updater.rpc_context) = let level = block_header.level in let timestamp = block_header.timestamp in let fitness = block_header.fitness in @@ -39,59 +39,55 @@ let rpc_init ({ block_hash ; block_header ; context } : Updater.rpc_context) = ~level ~predecessor_timestamp:timestamp ~timestamp - ~fitness context >>=? fun context -> - return { block_hash ; block_header ; context } + ~fitness + context + >>=? fun context -> return {block_hash; block_header; context} -let rpc_services = ref (RPC_directory.empty : Updater.rpc_context RPC_directory.t) +let rpc_services = + ref (RPC_directory.empty : Updater.rpc_context RPC_directory.t) let register0_fullctxt s f = rpc_services := - RPC_directory.register !rpc_services s - (fun ctxt q i -> - rpc_init ctxt >>=? fun ctxt -> - f ctxt q i) + RPC_directory.register !rpc_services s (fun ctxt q i -> + rpc_init ctxt >>=? fun ctxt -> f ctxt q i) + let opt_register0_fullctxt s f = rpc_services := - RPC_directory.opt_register !rpc_services s - (fun ctxt q i -> - rpc_init ctxt >>=? fun ctxt -> - f ctxt q i) -let register0 s f = - register0_fullctxt s (fun { context ; _ } -> f context) + RPC_directory.opt_register !rpc_services s (fun ctxt q i -> + rpc_init ctxt >>=? fun ctxt -> f ctxt q i) + +let register0 s f = register0_fullctxt s (fun {context; _} -> f context) + let register0_noctxt s f = - rpc_services := - RPC_directory.register !rpc_services s - (fun _ q i -> f q i) + rpc_services := RPC_directory.register !rpc_services s (fun _ q i -> f q i) let register1_fullctxt s f = rpc_services := - RPC_directory.register !rpc_services s - (fun (ctxt, arg) q i -> - rpc_init ctxt >>=? fun ctxt -> - f ctxt arg q i) -let register1 s f = register1_fullctxt s (fun { context ; _ } x -> f context x) + RPC_directory.register !rpc_services s (fun (ctxt, arg) q i -> + rpc_init ctxt >>=? fun ctxt -> f ctxt arg q i) + +let register1 s f = register1_fullctxt s (fun {context; _} x -> f context x) + let register1_noctxt s f = rpc_services := - RPC_directory.register !rpc_services s - (fun (_, arg) q i -> f arg q i) + RPC_directory.register !rpc_services s (fun (_, arg) q i -> f arg q i) let register2_fullctxt s f = rpc_services := - RPC_directory.register !rpc_services s - (fun ((ctxt, arg1), arg2) q i -> - rpc_init ctxt >>=? fun ctxt -> - f ctxt arg1 arg2 q i) + RPC_directory.register !rpc_services s (fun ((ctxt, arg1), arg2) q i -> + rpc_init ctxt >>=? fun ctxt -> f ctxt arg1 arg2 q i) + let register2 s f = - register2_fullctxt s (fun { context ; _ } a1 a2 q i -> f context a1 a2 q i) + register2_fullctxt s (fun {context; _} a1 a2 q i -> f context a1 a2 q i) let get_rpc_services () = let p = RPC_directory.map (fun c -> - rpc_init c >>= function - | Error _ -> assert false - | Ok c -> Lwt.return c.context) - (Storage_description.build_directory Alpha_context.description) in + rpc_init c + >>= function Error _ -> assert false | Ok c -> Lwt.return c.context) + (Storage_description.build_directory Alpha_context.description) + in RPC_directory.register_dynamic_directory !rpc_services RPC_path.(open_root / "context" / "raw" / "json") diff --git a/vendors/ligo-utils/tezos-protocol-alpha/state_hash.ml b/vendors/ligo-utils/tezos-protocol-alpha/state_hash.ml index ac240a4ad..f72c0d5c5 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/state_hash.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/state_hash.ml @@ -25,13 +25,16 @@ let random_state_hash = "\076\064\204" (* rng(53): never used... *) -include Blake2B.Make(Base58)(struct - let name = "random" - let title = "A random generation state" - let b58check_prefix = random_state_hash - let size = None - end) +include Blake2B.Make + (Base58) + (struct + let name = "random" -let () = - Base58.check_encoded_prefix b58check_encoding "rng" 53 + let title = "A random generation state" + let b58check_prefix = random_state_hash + + let size = None + end) + +let () = Base58.check_encoded_prefix b58check_encoding "rng" 53 diff --git a/vendors/ligo-utils/tezos-protocol-alpha/storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/storage.ml index 5d2ec65c9..86f11b8bb 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/storage.ml @@ -27,269 +27,301 @@ open Storage_functors module Int = struct type t = int + let encoding = Data_encoding.uint16 end module Int32 = struct type t = Int32.t + let encoding = Data_encoding.int32 end module Z = struct include Z + let encoding = Data_encoding.z end module Int_index = struct type t = int + let path_length = 1 + let to_path c l = string_of_int c :: l + let of_path = function - | [] | _ :: _ :: _ -> None - | [ c ] -> int_of_string_opt c + | [] | _ :: _ :: _ -> + None + | [c] -> + int_of_string_opt c + type 'a ipath = 'a * t - let args = Storage_description.One { - rpc_arg = RPC_arg.int ; - encoding = Data_encoding.int31 ; - compare = Compare.Int.compare ; - } + + let args = + Storage_description.One + { + rpc_arg = RPC_arg.int; + encoding = Data_encoding.int31; + compare = Compare.Int.compare; + } end -module Make_index(H : Storage_description.INDEX) - : INDEX with type t = H.t and type 'a ipath = 'a * H.t = struct +module Make_index (H : Storage_description.INDEX) : + INDEX with type t = H.t and type 'a ipath = 'a * H.t = struct include H + type 'a ipath = 'a * t - let args = Storage_description.One { - rpc_arg ; - encoding ; - compare ; - } + + let args = Storage_description.One {rpc_arg; encoding; compare} end module Block_priority = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["block_priority"] end) - (Int) - -(* Only for migration from 004 *) -module Last_block_priority = - Make_single_data_storage(Ghost) - (Raw_context) - (struct let name = ["last_block_priority"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["block_priority"] + end) (Int) (** Contracts handling *) module Contract = struct - module Raw_context = - Make_subcontext(Registered)(Raw_context)(struct let name = ["contracts"] end) + Make_subcontext (Registered) (Raw_context) + (struct + let name = ["contracts"] + end) module Global_counter = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["global_counter"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["global_counter"] + end) (Z) module Indexed_context = Make_indexed_subcontext - (Make_subcontext(Registered)(Raw_context)(struct let name = ["index"] end)) - (Make_index(Contract_repr.Index)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["index"] + end)) + (Make_index (Contract_repr.Index)) let fold = Indexed_context.fold_keys + let list = Indexed_context.keys module Balance = Indexed_context.Make_map - (struct let name = ["balance"] end) + (struct + let name = ["balance"] + end) (Tez_repr) module Frozen_balance_index = Make_indexed_subcontext - (Make_subcontext(Registered) - (Indexed_context.Raw_context) - (struct let name = ["frozen_balance"] end)) - (Make_index(Cycle_repr.Index)) + (Make_subcontext (Registered) (Indexed_context.Raw_context) + (struct + let name = ["frozen_balance"] + end)) + (Make_index (Cycle_repr.Index)) module Frozen_deposits = Frozen_balance_index.Make_map - (struct let name = ["deposits"] end) + (struct + let name = ["deposits"] + end) (Tez_repr) module Frozen_fees = Frozen_balance_index.Make_map - (struct let name = ["fees"] end) + (struct + let name = ["fees"] + end) (Tez_repr) module Frozen_rewards = Frozen_balance_index.Make_map - (struct let name = ["rewards"] end) + (struct + let name = ["rewards"] + end) (Tez_repr) module Manager = Indexed_context.Make_map - (struct let name = ["manager"] end) + (struct + let name = ["manager"] + end) (Manager_repr) - module Spendable_004 = - Indexed_context.Make_set(Ghost) - (struct let name = ["spendable"] end) - - module Delegatable_004 = - Indexed_context.Make_set(Ghost) - (struct let name = ["delegatable"] end) - module Delegate = Indexed_context.Make_map - (struct let name = ["delegate"] end) + (struct + let name = ["delegate"] + end) (Signature.Public_key_hash) module Inactive_delegate = - Indexed_context.Make_set(Registered) - (struct let name = ["inactive_delegate"] end) + Indexed_context.Make_set + (Registered) + (struct + let name = ["inactive_delegate"] + end) module Delegate_desactivation = Indexed_context.Make_map - (struct let name = ["delegate_desactivation"] end) + (struct + let name = ["delegate_desactivation"] + end) (Cycle_repr) module Delegated = Make_data_set_storage - (Make_subcontext(Registered) - (Indexed_context.Raw_context) - (struct let name = ["delegated"] end)) - (Make_index(Contract_repr.Index)) - - (** Only for migration from proto_004 *) - module Delegated_004 = - Make_data_set_storage - (Make_subcontext(Ghost) - (Indexed_context.Raw_context) - (struct let name = ["delegated_004"] end)) - (Make_index(Contract_hash)) + (Make_subcontext (Registered) (Indexed_context.Raw_context) + (struct + let name = ["delegated"] + end)) + (Make_index (Contract_repr.Index)) module Counter = Indexed_context.Make_map - (struct let name = ["counter"] end) + (struct + let name = ["counter"] + end) (Z) (* Consume gas for serilization and deserialization of expr in this module *) module Make_carbonated_map_expr (N : Storage_sigs.NAME) = struct - module I = Indexed_context.Make_carbonated_map + module I = + Indexed_context.Make_carbonated_map (N) (struct type t = Script_repr.lazy_expr + let encoding = Script_repr.lazy_expr_encoding end) type context = I.context + type key = I.key + type value = I.value let mem = I.mem + let delete = I.delete + let remove = I.remove let consume_deserialize_gas ctxt value = - Lwt.return @@ - (Raw_context.check_enough_gas ctxt (Script_repr.minimal_deserialize_cost value) >>? fun () -> - Script_repr.force_decode value >>? fun (_value, value_cost) -> - Raw_context.consume_gas ctxt value_cost) + Lwt.return + @@ ( Raw_context.check_enough_gas + ctxt + (Script_repr.minimal_deserialize_cost value) + >>? fun () -> + Script_repr.force_decode value + >>? fun (_value, value_cost) -> + Raw_context.consume_gas ctxt value_cost ) let consume_serialize_gas ctxt value = - Lwt.return @@ - (Script_repr.force_bytes value >>? fun (_value, value_cost) -> - Raw_context.consume_gas ctxt value_cost) + Lwt.return + @@ ( Script_repr.force_bytes value + >>? fun (_value, value_cost) -> + Raw_context.consume_gas ctxt value_cost ) let get ctxt contract = - I.get ctxt contract >>=? fun (ctxt, value) -> - consume_deserialize_gas ctxt value >>|? fun ctxt -> - (ctxt, value) + I.get ctxt contract + >>=? fun (ctxt, value) -> + consume_deserialize_gas ctxt value >>|? fun ctxt -> (ctxt, value) let get_option ctxt contract = - I.get_option ctxt contract >>=? fun (ctxt, value_opt) -> + I.get_option ctxt contract + >>=? fun (ctxt, value_opt) -> match value_opt with - | None -> return (ctxt, None) + | None -> + return (ctxt, None) | Some value -> - consume_deserialize_gas ctxt value >>|? fun ctxt -> - (ctxt, value_opt) + consume_deserialize_gas ctxt value >>|? fun ctxt -> (ctxt, value_opt) let set ctxt contract value = - consume_serialize_gas ctxt value >>=? fun ctxt -> - I.set ctxt contract value + consume_serialize_gas ctxt value + >>=? fun ctxt -> I.set ctxt contract value let set_option ctxt contract value_opt = match value_opt with - | None -> I.set_option ctxt contract None + | None -> + I.set_option ctxt contract None | Some value -> - consume_serialize_gas ctxt value >>=? fun ctxt -> - I.set_option ctxt contract value_opt + consume_serialize_gas ctxt value + >>=? fun ctxt -> I.set_option ctxt contract value_opt let init ctxt contract value = - consume_serialize_gas ctxt value >>=? fun ctxt -> - I.init ctxt contract value + consume_serialize_gas ctxt value + >>=? fun ctxt -> I.init ctxt contract value let init_set ctxt contract value = - consume_serialize_gas ctxt value >>=? fun ctxt -> - I.init_set ctxt contract value - - (** Only for used for 005 migration to avoid gas cost. *) - let init_free ctxt contract value = - I.init_free ctxt contract value - - (** Only for used for 005 migration to avoid gas cost. *) - let set_free ctxt contract value = - I.set_free ctxt contract value + consume_serialize_gas ctxt value + >>=? fun ctxt -> I.init_set ctxt contract value end - module Code = - Make_carbonated_map_expr - (struct let name = ["code"] end) + module Code = Make_carbonated_map_expr (struct + let name = ["code"] + end) - module Storage = - Make_carbonated_map_expr - (struct let name = ["storage"] end) + module Storage = Make_carbonated_map_expr (struct + let name = ["storage"] + end) module Paid_storage_space = Indexed_context.Make_map - (struct let name = ["paid_bytes"] end) + (struct + let name = ["paid_bytes"] + end) (Z) module Used_storage_space = Indexed_context.Make_map - (struct let name = ["used_bytes"] end) + (struct + let name = ["used_bytes"] + end) (Z) module Roll_list = Indexed_context.Make_map - (struct let name = ["roll_list"] end) + (struct + let name = ["roll_list"] + end) (Roll_repr) module Change = Indexed_context.Make_map - (struct let name = ["change"] end) + (struct + let name = ["change"] + end) (Tez_repr) - end (** Big maps handling *) module Big_map = struct module Raw_context = - Make_subcontext(Registered)(Raw_context)(struct let name = ["big_maps"] end) + Make_subcontext (Registered) (Raw_context) + (struct + let name = ["big_maps"] + end) module Next = struct - include - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["next"] end) - (Z) + include Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["next"] + end) + (Z) + let incr ctxt = - get ctxt >>=? fun i -> - set ctxt (Z.succ i) >>=? fun ctxt -> - return (ctxt, i) + get ctxt + >>=? fun i -> set ctxt (Z.succ i) >>=? fun ctxt -> return (ctxt, i) + let init ctxt = init ctxt Z.zero end @@ -300,184 +332,224 @@ module Big_map = struct let construct = Z.to_string in let destruct hash = match Z.of_string hash with - | exception _ -> Error "Cannot parse big map id" - | id -> Ok id in + | exception _ -> + Error "Cannot parse big map id" + | id -> + Ok id + in RPC_arg.make - ~descr: "A big map identifier" - ~name: "big_map_id" + ~descr:"A big map identifier" + ~name:"big_map_id" ~construct ~destruct () let encoding = - Data_encoding.def "big_map_id" + Data_encoding.def + "big_map_id" ~title:"Big map identifier" - ~description: "A big map identifier" + ~description:"A big map identifier" Z.encoding + let compare = Compare.Z.compare let path_length = 7 let to_path c l = let raw_key = Data_encoding.Binary.to_bytes_exn encoding c in - let `Hex index_key = MBytes.to_hex (Raw_hashes.blake2b raw_key) in - String.sub index_key 0 2 :: - String.sub index_key 2 2 :: - String.sub index_key 4 2 :: - String.sub index_key 6 2 :: - String.sub index_key 8 2 :: - String.sub index_key 10 2 :: - Z.to_string c :: - l + let (`Hex index_key) = MBytes.to_hex (Raw_hashes.blake2b raw_key) in + String.sub index_key 0 2 :: String.sub index_key 2 2 + :: String.sub index_key 4 2 :: String.sub index_key 6 2 + :: String.sub index_key 8 2 :: String.sub index_key 10 2 :: Z.to_string c + :: l let of_path = function - | [] | [_] | [_;_] | [_;_;_] | [_;_;_;_] | [_;_;_;_;_] | [_;_;_;_;_;_] - | _::_::_::_::_::_::_::_::_ -> + | [] + | [_] + | [_; _] + | [_; _; _] + | [_; _; _; _] + | [_; _; _; _; _] + | [_; _; _; _; _; _] + | _ :: _ :: _ :: _ :: _ :: _ :: _ :: _ :: _ -> None - | [ index1 ; index2 ; index3 ; index4 ; index5 ; index6 ; key ] -> + | [index1; index2; index3; index4; index5; index6; key] -> let c = Z.of_string key in let raw_key = Data_encoding.Binary.to_bytes_exn encoding c in - let `Hex index_key = MBytes.to_hex (Raw_hashes.blake2b raw_key) in - assert Compare.String.(String.sub index_key 0 2 = index1) ; - assert Compare.String.(String.sub index_key 2 2 = index2) ; - assert Compare.String.(String.sub index_key 4 2 = index3) ; - assert Compare.String.(String.sub index_key 6 2 = index4) ; - assert Compare.String.(String.sub index_key 8 2 = index5) ; - assert Compare.String.(String.sub index_key 10 2 = index6) ; + let (`Hex index_key) = MBytes.to_hex (Raw_hashes.blake2b raw_key) in + assert (Compare.String.(String.sub index_key 0 2 = index1)) ; + assert (Compare.String.(String.sub index_key 2 2 = index2)) ; + assert (Compare.String.(String.sub index_key 4 2 = index3)) ; + assert (Compare.String.(String.sub index_key 6 2 = index4)) ; + assert (Compare.String.(String.sub index_key 8 2 = index5)) ; + assert (Compare.String.(String.sub index_key 10 2 = index6)) ; Some c end module Indexed_context = Make_indexed_subcontext - (Make_subcontext(Registered)(Raw_context)(struct let name = ["index"] end)) - (Make_index(Index)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["index"] + end)) + (Make_index (Index)) let rpc_arg = Index.rpc_arg let fold = Indexed_context.fold_keys + let list = Indexed_context.keys - let remove_rec ctxt n = - Indexed_context.remove_rec ctxt n + let remove_rec ctxt n = Indexed_context.remove_rec ctxt n - let copy ctxt ~from ~to_ = - Indexed_context.copy ctxt ~from ~to_ + let copy ctxt ~from ~to_ = Indexed_context.copy ctxt ~from ~to_ type key = Raw_context.t * Z.t module Total_bytes = Indexed_context.Make_map - (struct let name = ["total_bytes"] end) + (struct + let name = ["total_bytes"] + end) (Z) module Key_type = Indexed_context.Make_map - (struct let name = ["key_type"] end) - (struct - type t = Script_repr.expr - let encoding = Script_repr.expr_encoding - end) + (struct + let name = ["key_type"] + end) + (struct + type t = Script_repr.expr + + let encoding = Script_repr.expr_encoding + end) module Value_type = Indexed_context.Make_map - (struct let name = ["value_type"] end) - (struct - type t = Script_repr.expr - let encoding = Script_repr.expr_encoding - end) + (struct + let name = ["value_type"] + end) + (struct + type t = Script_repr.expr + + let encoding = Script_repr.expr_encoding + end) module Contents = struct + module I = + Storage_functors.Make_indexed_carbonated_data_storage + (Make_subcontext (Registered) (Indexed_context.Raw_context) + (struct + let name = ["contents"] + end)) + (Make_index (Script_expr_hash)) + (struct + type t = Script_repr.expr - module I = Storage_functors.Make_indexed_carbonated_data_storage - (Make_subcontext(Registered) - (Indexed_context.Raw_context) - (struct let name = ["contents"] end)) - (Make_index(Script_expr_hash)) - (struct - type t = Script_repr.expr - let encoding = Script_repr.expr_encoding - end) + let encoding = Script_repr.expr_encoding + end) type context = I.context + type key = I.key + type value = I.value let mem = I.mem + let delete = I.delete + let remove = I.remove + let set = I.set + let set_option = I.set_option + let init = I.init + let init_set = I.init_set let consume_deserialize_gas ctxt value = - Lwt.return @@ - Raw_context.consume_gas ctxt (Script_repr.deserialized_cost value) + Lwt.return + @@ Raw_context.consume_gas ctxt (Script_repr.deserialized_cost value) let get ctxt contract = - I.get ctxt contract >>=? fun (ctxt, value) -> - consume_deserialize_gas ctxt value >>|? fun ctxt -> - (ctxt, value) + I.get ctxt contract + >>=? fun (ctxt, value) -> + consume_deserialize_gas ctxt value >>|? fun ctxt -> (ctxt, value) let get_option ctxt contract = - I.get_option ctxt contract >>=? fun (ctxt, value_opt) -> + I.get_option ctxt contract + >>=? fun (ctxt, value_opt) -> match value_opt with - | None -> return (ctxt, None) + | None -> + return (ctxt, None) | Some value -> - consume_deserialize_gas ctxt value >>|? fun ctxt -> - (ctxt, value_opt) + consume_deserialize_gas ctxt value >>|? fun ctxt -> (ctxt, value_opt) end - end module Delegates = Make_data_set_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["delegates"] end)) - (Make_index(Signature.Public_key_hash)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["delegates"] + end)) + (Make_index (Signature.Public_key_hash)) module Active_delegates_with_rolls = Make_data_set_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["active_delegates_with_rolls"] end)) - (Make_index(Signature.Public_key_hash)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["active_delegates_with_rolls"] + end)) + (Make_index (Signature.Public_key_hash)) module Delegates_with_frozen_balance_index = Make_indexed_subcontext - (Make_subcontext(Registered)(Raw_context) - (struct let name = ["delegates_with_frozen_balance"] end)) - (Make_index(Cycle_repr.Index)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["delegates_with_frozen_balance"] + end)) + (Make_index (Cycle_repr.Index)) module Delegates_with_frozen_balance = Make_data_set_storage (Delegates_with_frozen_balance_index.Raw_context) - (Make_index(Signature.Public_key_hash)) + (Make_index (Signature.Public_key_hash)) (** Rolls *) module Cycle = struct - module Indexed_context = Make_indexed_subcontext - (Make_subcontext(Registered)(Raw_context)(struct let name = ["cycle"] end)) - (Make_index(Cycle_repr.Index)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["cycle"] + end)) + (Make_index (Cycle_repr.Index)) module Last_roll = Make_indexed_data_storage - (Make_subcontext(Registered) - (Indexed_context.Raw_context) - (struct let name = ["last_roll"] end)) - (Int_index) + (Make_subcontext (Registered) (Indexed_context.Raw_context) + (struct + let name = ["last_roll"] + end)) + (Int_index) (Roll_repr) module Roll_snapshot = Indexed_context.Make_map - (struct let name = ["roll_snapshot"] end) + (struct + let name = ["roll_snapshot"] + end) (Int) type unrevealed_nonce = { - nonce_hash: Nonce_hash.t ; - delegate: Signature.Public_key_hash.t ; - rewards: Tez_repr.t ; - fees: Tez_repr.t ; + nonce_hash : Nonce_hash.t; + delegate : Signature.Public_key_hash.t; + rewards : Tez_repr.t; + fees : Tez_repr.t; } type nonce_status = @@ -486,213 +558,259 @@ module Cycle = struct let nonce_status_encoding = let open Data_encoding in - union [ - case (Tag 0) - ~title:"Unrevealed" - (tup4 - Nonce_hash.encoding - Signature.Public_key_hash.encoding - Tez_repr.encoding - Tez_repr.encoding) - (function - | Unrevealed { nonce_hash ; delegate ; rewards ; fees } -> - Some (nonce_hash, delegate, rewards, fees) - | _ -> None) - (fun (nonce_hash, delegate, rewards, fees) -> - Unrevealed { nonce_hash ; delegate ; rewards ; fees }) ; - case (Tag 1) - ~title:"Revealed" - Seed_repr.nonce_encoding - (function - | Revealed nonce -> Some nonce - | _ -> None) - (fun nonce -> Revealed nonce) - ] + union + [ case + (Tag 0) + ~title:"Unrevealed" + (tup4 + Nonce_hash.encoding + Signature.Public_key_hash.encoding + Tez_repr.encoding + Tez_repr.encoding) + (function + | Unrevealed {nonce_hash; delegate; rewards; fees} -> + Some (nonce_hash, delegate, rewards, fees) + | _ -> + None) + (fun (nonce_hash, delegate, rewards, fees) -> + Unrevealed {nonce_hash; delegate; rewards; fees}); + case + (Tag 1) + ~title:"Revealed" + Seed_repr.nonce_encoding + (function Revealed nonce -> Some nonce | _ -> None) + (fun nonce -> Revealed nonce) ] module Nonce = Make_indexed_data_storage - (Make_subcontext(Registered) - (Indexed_context.Raw_context) - (struct let name = ["nonces"] end)) - (Make_index(Raw_level_repr.Index)) - (struct - type t = nonce_status - let encoding = nonce_status_encoding - end) + (Make_subcontext (Registered) (Indexed_context.Raw_context) + (struct + let name = ["nonces"] + end)) + (Make_index (Raw_level_repr.Index)) + (struct + type t = nonce_status + + let encoding = nonce_status_encoding + end) module Seed = Indexed_context.Make_map - (struct let name = ["random_seed"] end) + (struct + let name = ["random_seed"] + end) (struct type t = Seed_repr.seed + let encoding = Seed_repr.seed_encoding end) - end module Roll = struct - module Raw_context = - Make_subcontext(Registered)(Raw_context)(struct let name = ["rolls"] end) + Make_subcontext (Registered) (Raw_context) + (struct + let name = ["rolls"] + end) module Indexed_context = Make_indexed_subcontext - (Make_subcontext(Registered)(Raw_context)(struct let name = ["index"] end)) - (Make_index(Roll_repr.Index)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["index"] + end)) + (Make_index (Roll_repr.Index)) module Next = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["next"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["next"] + end) (Roll_repr) module Limbo = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["limbo"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["limbo"] + end) (Roll_repr) module Delegate_roll_list = - Wrap_indexed_data_storage(Contract.Roll_list)(struct - type t = Signature.Public_key_hash.t - let wrap = Contract_repr.implicit_contract - let unwrap = Contract_repr.is_implicit - end) + Wrap_indexed_data_storage + (Contract.Roll_list) + (struct + type t = Signature.Public_key_hash.t + + let wrap = Contract_repr.implicit_contract + + let unwrap = Contract_repr.is_implicit + end) module Successor = Indexed_context.Make_map - (struct let name = ["successor"] end) + (struct + let name = ["successor"] + end) (Roll_repr) module Delegate_change = - Wrap_indexed_data_storage(Contract.Change)(struct - type t = Signature.Public_key_hash.t - let wrap = Contract_repr.implicit_contract - let unwrap = Contract_repr.is_implicit - end) + Wrap_indexed_data_storage + (Contract.Change) + (struct + type t = Signature.Public_key_hash.t + + let wrap = Contract_repr.implicit_contract + + let unwrap = Contract_repr.is_implicit + end) module Snapshoted_owner_index = struct type t = Cycle_repr.t * int + let path_length = Cycle_repr.Index.path_length + 1 - let to_path (c, n) s = - Cycle_repr.Index.to_path c (string_of_int n :: s) + + let to_path (c, n) s = Cycle_repr.Index.to_path c (string_of_int n :: s) + let of_path l = match Misc.take Cycle_repr.Index.path_length l with - | None | Some (_, ([] | _ :: _ :: _ ))-> None - | Some (l1, [l2]) -> - match Cycle_repr.Index.of_path l1, int_of_string_opt l2 with - | None, _ | _, None -> None - | Some c, Some i -> Some (c, i) + | None | Some (_, ([] | _ :: _ :: _)) -> + None + | Some (l1, [l2]) -> ( + match (Cycle_repr.Index.of_path l1, int_of_string_opt l2) with + | (None, _) | (_, None) -> + None + | (Some c, Some i) -> + Some (c, i) ) type 'a ipath = ('a * Cycle_repr.t) * int + let left_args = - Storage_description.One { - rpc_arg = Cycle_repr.rpc_arg ; - encoding = Cycle_repr.encoding ; - compare = Cycle_repr.compare - } + Storage_description.One + { + rpc_arg = Cycle_repr.rpc_arg; + encoding = Cycle_repr.encoding; + compare = Cycle_repr.compare; + } + let right_args = - Storage_description.One { - rpc_arg = RPC_arg.int ; - encoding = Data_encoding.int31 ; - compare = Compare.Int.compare ; - } - let args = - Storage_description.(Pair (left_args, right_args)) + Storage_description.One + { + rpc_arg = RPC_arg.int; + encoding = Data_encoding.int31; + compare = Compare.Int.compare; + } + + let args = Storage_description.(Pair (left_args, right_args)) end module Owner = Make_indexed_data_snapshotable_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["owner"] end)) - (Snapshoted_owner_index) - (Make_index(Roll_repr.Index)) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["owner"] + end)) + (Snapshoted_owner_index) + (Make_index (Roll_repr.Index)) (Signature.Public_key) module Snapshot_for_cycle = Cycle.Roll_snapshot module Last_for_snapshot = Cycle.Last_roll let clear = Indexed_context.clear - end -(** Votes **) +(** Votes *) module Vote = struct - module Raw_context = - Make_subcontext(Registered)(Raw_context)(struct let name = ["votes"] end) + Make_subcontext (Registered) (Raw_context) + (struct + let name = ["votes"] + end) module Current_period_kind = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["current_period_kind"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["current_period_kind"] + end) (struct type t = Voting_period_repr.kind + let encoding = Voting_period_repr.kind_encoding end) - module Current_quorum_004 = - Make_single_data_storage(Ghost) - (Raw_context) - (struct let name = ["current_quorum"] end) - (Int32) - module Participation_ema = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["participation_ema"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["participation_ema"] + end) (Int32) module Current_proposal = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["current_proposal"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["current_proposal"] + end) (Protocol_hash) module Listings_size = - Make_single_data_storage(Registered) - (Raw_context) - (struct let name = ["listings_size"] end) + Make_single_data_storage (Registered) (Raw_context) + (struct + let name = ["listings_size"] + end) (Int32) module Listings = Make_indexed_data_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["listings"] end)) - (Make_index(Signature.Public_key_hash)) - (Int32) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["listings"] + end)) + (Make_index (Signature.Public_key_hash)) + (Int32) module Proposals = Make_data_set_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["proposals"] end)) - (Pair(Make_index(Protocol_hash))(Make_index(Signature.Public_key_hash))) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["proposals"] + end)) + (Pair + (Make_index + (Protocol_hash)) + (Make_index (Signature.Public_key_hash))) module Proposals_count = Make_indexed_data_storage - (Make_subcontext(Registered)(Raw_context) - (struct let name = ["proposals_count"] end)) - (Make_index(Signature.Public_key_hash)) - (Int) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["proposals_count"] + end)) + (Make_index (Signature.Public_key_hash)) + (Int) module Ballots = Make_indexed_data_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["ballots"] end)) - (Make_index(Signature.Public_key_hash)) - (struct - type t = Vote_repr.ballot - let encoding = Vote_repr.ballot_encoding - end) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["ballots"] + end)) + (Make_index (Signature.Public_key_hash)) + (struct + type t = Vote_repr.ballot + let encoding = Vote_repr.ballot_encoding + end) end (** Seed *) module Seed = struct - type unrevealed_nonce = Cycle.unrevealed_nonce = { - nonce_hash: Nonce_hash.t ; - delegate: Signature.Public_key_hash.t ; - rewards: Tez_repr.t ; - fees: Tez_repr.t ; + nonce_hash : Nonce_hash.t; + delegate : Signature.Public_key_hash.t; + rewards : Tez_repr.t; + fees : Tez_repr.t; } type nonce_status = Cycle.nonce_status = @@ -701,49 +819,73 @@ module Seed = struct module Nonce = struct open Level_repr + type context = Raw_context.t + let mem ctxt l = Cycle.Nonce.mem (ctxt, l.cycle) l.level + let get ctxt l = Cycle.Nonce.get (ctxt, l.cycle) l.level + let get_option ctxt l = Cycle.Nonce.get_option (ctxt, l.cycle) l.level + let set ctxt l v = Cycle.Nonce.set (ctxt, l.cycle) l.level v + let init ctxt l v = Cycle.Nonce.init (ctxt, l.cycle) l.level v + let init_set ctxt l v = Cycle.Nonce.init_set (ctxt, l.cycle) l.level v + let set_option ctxt l v = Cycle.Nonce.set_option (ctxt, l.cycle) l.level v + let delete ctxt l = Cycle.Nonce.delete (ctxt, l.cycle) l.level + let remove ctxt l = Cycle.Nonce.remove (ctxt, l.cycle) l.level end - module For_cycle = Cycle.Seed + module For_cycle = Cycle.Seed end (** Commitments *) module Commitments = Make_indexed_data_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["commitments"] end)) - (Make_index(Blinded_public_key_hash.Index)) - (Tez_repr) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["commitments"] + end)) + (Make_index (Blinded_public_key_hash.Index)) + (Tez_repr) (** Ramp up security deposits... *) module Ramp_up = struct - module Rewards = Make_indexed_data_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["ramp_up"; "rewards"] end)) - (Make_index(Cycle_repr.Index)) - (struct - type t = Tez_repr.t * Tez_repr.t - let encoding = Data_encoding.tup2 Tez_repr.encoding Tez_repr.encoding - end) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["ramp_up"; "rewards"] + end)) + (Make_index (Cycle_repr.Index)) + (struct + type t = Tez_repr.t list * Tez_repr.t list + + let encoding = + Data_encoding.( + obj2 + (req "baking_reward_per_endorsement" (list Tez_repr.encoding)) + (req "endorsement_reward" (list Tez_repr.encoding))) + end) module Security_deposits = Make_indexed_data_storage - (Make_subcontext(Registered)(Raw_context)(struct let name = ["ramp_up"; "deposits"] end)) - (Make_index(Cycle_repr.Index)) - (struct - type t = Tez_repr.t * Tez_repr.t - let encoding = Data_encoding.tup2 Tez_repr.encoding Tez_repr.encoding - end) + (Make_subcontext (Registered) (Raw_context) + (struct + let name = ["ramp_up"; "deposits"] + end)) + (Make_index (Cycle_repr.Index)) + (struct + type t = Tez_repr.t * Tez_repr.t + let encoding = + Data_encoding.tup2 Tez_repr.encoding Tez_repr.encoding + end) end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/storage.mli index 1d7c887d5..669b3048f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/storage.mli @@ -38,372 +38,359 @@ open Storage_sigs module Block_priority : sig val get : Raw_context.t -> int tzresult Lwt.t + val set : Raw_context.t -> int -> Raw_context.t tzresult Lwt.t + val init : Raw_context.t -> int -> Raw_context.t tzresult Lwt.t end -(* Only for migration from 004 *) -module Last_block_priority : sig - val delete : Raw_context.t -> Raw_context.t tzresult Lwt.t -end - module Roll : sig - (** Storage from this submodule must only be accessed through the module `Roll`. *) - module Owner : Indexed_data_snapshotable_storage - with type key = Roll_repr.t - and type snapshot = (Cycle_repr.t * int) - and type value = Signature.Public_key.t - and type t := Raw_context.t + module Owner : + Indexed_data_snapshotable_storage + with type key = Roll_repr.t + and type snapshot = Cycle_repr.t * int + and type value = Signature.Public_key.t + and type t := Raw_context.t - val clear: Raw_context.t -> Raw_context.t Lwt.t + val clear : Raw_context.t -> Raw_context.t Lwt.t (** The next roll to be allocated. *) - module Next : Single_data_storage - with type value = Roll_repr.t - and type t := Raw_context.t + module Next : + Single_data_storage + with type value = Roll_repr.t + and type t := Raw_context.t (** Rolls linked lists represent both account owned and free rolls. All rolls belongs either to the limbo list or to an owned list. *) (** Head of the linked list of rolls in limbo *) - module Limbo : Single_data_storage - with type value = Roll_repr.t - and type t := Raw_context.t + module Limbo : + Single_data_storage + with type value = Roll_repr.t + and type t := Raw_context.t (** Rolls associated to contracts, a linked list per contract *) - module Delegate_roll_list : Indexed_data_storage - with type key = Signature.Public_key_hash.t - and type value = Roll_repr.t - and type t := Raw_context.t + module Delegate_roll_list : + Indexed_data_storage + with type key = Signature.Public_key_hash.t + and type value = Roll_repr.t + and type t := Raw_context.t (** Use this to iter on a linked list of rolls *) - module Successor : Indexed_data_storage - with type key = Roll_repr.t - and type value = Roll_repr.t - and type t := Raw_context.t + module Successor : + Indexed_data_storage + with type key = Roll_repr.t + and type value = Roll_repr.t + and type t := Raw_context.t (** The tez of a contract that are not assigned to rolls *) - module Delegate_change : Indexed_data_storage - with type key = Signature.Public_key_hash.t - and type value = Tez_repr.t - and type t := Raw_context.t + module Delegate_change : + Indexed_data_storage + with type key = Signature.Public_key_hash.t + and type value = Tez_repr.t + and type t := Raw_context.t (** Index of the randomly selected roll snapshot of a given cycle. *) - module Snapshot_for_cycle : Indexed_data_storage - with type key = Cycle_repr.t - and type value = int - and type t := Raw_context.t + module Snapshot_for_cycle : + Indexed_data_storage + with type key = Cycle_repr.t + and type value = int + and type t := Raw_context.t (** Last roll in the snapshoted roll allocation of a given cycle. *) - module Last_for_snapshot : Indexed_data_storage - with type key = int - and type value = Roll_repr.t - and type t = Raw_context.t * Cycle_repr.t - + module Last_for_snapshot : + Indexed_data_storage + with type key = int + and type value = Roll_repr.t + and type t = Raw_context.t * Cycle_repr.t end module Contract : sig - (** Storage from this submodule must only be accessed through the module `Contract`. *) module Global_counter : sig val get : Raw_context.t -> Z.t tzresult Lwt.t + val set : Raw_context.t -> Z.t -> Raw_context.t tzresult Lwt.t + val init : Raw_context.t -> Z.t -> Raw_context.t tzresult Lwt.t end (** The domain of alive contracts *) val fold : Raw_context.t -> - init:'a -> f:(Contract_repr.t -> 'a -> 'a Lwt.t) -> 'a Lwt.t + init:'a -> + f:(Contract_repr.t -> 'a -> 'a Lwt.t) -> + 'a Lwt.t + val list : Raw_context.t -> Contract_repr.t list Lwt.t (** All the tez possesed by a contract, including rolls and change *) - module Balance : Indexed_data_storage - with type key = Contract_repr.t - and type value = Tez_repr.t - and type t := Raw_context.t + module Balance : + Indexed_data_storage + with type key = Contract_repr.t + and type value = Tez_repr.t + and type t := Raw_context.t (** Frozen balance, see 'delegate_storage.mli' for more explanation. Always update `Delegates_with_frozen_balance` accordingly. *) - module Frozen_deposits : Indexed_data_storage - with type key = Cycle_repr.t - and type value = Tez_repr.t - and type t = Raw_context.t * Contract_repr.t + module Frozen_deposits : + Indexed_data_storage + with type key = Cycle_repr.t + and type value = Tez_repr.t + and type t = Raw_context.t * Contract_repr.t - module Frozen_fees : Indexed_data_storage - with type key = Cycle_repr.t - and type value = Tez_repr.t - and type t = Raw_context.t * Contract_repr.t + module Frozen_fees : + Indexed_data_storage + with type key = Cycle_repr.t + and type value = Tez_repr.t + and type t = Raw_context.t * Contract_repr.t - module Frozen_rewards : Indexed_data_storage - with type key = Cycle_repr.t - and type value = Tez_repr.t - and type t = Raw_context.t * Contract_repr.t + module Frozen_rewards : + Indexed_data_storage + with type key = Cycle_repr.t + and type value = Tez_repr.t + and type t = Raw_context.t * Contract_repr.t (** The manager of a contract *) - module Manager : Indexed_data_storage - with type key = Contract_repr.t - and type value = Manager_repr.t - and type t := Raw_context.t + module Manager : + Indexed_data_storage + with type key = Contract_repr.t + and type value = Manager_repr.t + and type t := Raw_context.t (** The delegate of a contract, if any. *) - module Delegate : Indexed_data_storage - with type key = Contract_repr.t - and type value = Signature.Public_key_hash.t - and type t := Raw_context.t + module Delegate : + Indexed_data_storage + with type key = Contract_repr.t + and type value = Signature.Public_key_hash.t + and type t := Raw_context.t (** All contracts (implicit and originated) that are delegated, if any *) - module Delegated : Data_set_storage - with type elt = Contract_repr.t - and type t = Raw_context.t * Contract_repr.t + module Delegated : + Data_set_storage + with type elt = Contract_repr.t + and type t = Raw_context.t * Contract_repr.t - (** Only for migration from proto_004 *) - module Delegated_004 : Data_set_storage - with type elt = Contract_hash.t - and type t = Raw_context.t * Contract_repr.t - - module Inactive_delegate : Data_set_storage - with type elt = Contract_repr.t - and type t = Raw_context.t + module Inactive_delegate : + Data_set_storage with type elt = Contract_repr.t and type t = Raw_context.t (** The cycle where the delegate should be desactivated. *) - module Delegate_desactivation : Indexed_data_storage - with type key = Contract_repr.t - and type value = Cycle_repr.t - and type t := Raw_context.t + module Delegate_desactivation : + Indexed_data_storage + with type key = Contract_repr.t + and type value = Cycle_repr.t + and type t := Raw_context.t - module Spendable_004 : Data_set_storage - with type elt = Contract_repr.t - and type t := Raw_context.t + module Counter : + Indexed_data_storage + with type key = Contract_repr.t + and type value = Z.t + and type t := Raw_context.t - module Delegatable_004 : Data_set_storage - with type elt = Contract_repr.t - and type t := Raw_context.t - - module Counter : Indexed_data_storage - with type key = Contract_repr.t - and type value = Z.t - and type t := Raw_context.t - - module Code : sig - include Non_iterable_indexed_carbonated_data_storage + module Code : + Non_iterable_indexed_carbonated_data_storage with type key = Contract_repr.t and type value = Script_repr.lazy_expr and type t := Raw_context.t - (** Only used for 005 migration to avoid gas cost. - Allocates a storage bucket at the given key and initializes it ; - returns a {!Storage_error Existing_key} if the bucket exists. *) - val init_free: Raw_context.t -> Contract_repr.t -> Script_repr.lazy_expr -> (Raw_context.t * int) tzresult Lwt.t - - (** Only used for 005 migration to avoid gas cost. - Updates the content of a bucket ; returns A {!Storage_Error - Missing_key} if the value does not exists. *) - val set_free: Raw_context.t -> Contract_repr.t -> Script_repr.lazy_expr -> (Raw_context.t * int) tzresult Lwt.t - end - - module Storage : sig - include Non_iterable_indexed_carbonated_data_storage + module Storage : + Non_iterable_indexed_carbonated_data_storage with type key = Contract_repr.t and type value = Script_repr.lazy_expr and type t := Raw_context.t - (** Only used for 005 migration to avoid gas cost. - Allocates a storage bucket at the given key and initializes it ; - returns a {!Storage_error Existing_key} if the bucket exists. *) - val init_free: Raw_context.t -> Contract_repr.t -> Script_repr.lazy_expr -> (Raw_context.t * int) tzresult Lwt.t - - (** Only used for 005 migration to avoid gas cost. - Updates the content of a bucket ; returns A {!Storage_Error - Missing_key} if the value does not exists. *) - val set_free: Raw_context.t -> Contract_repr.t -> Script_repr.lazy_expr -> (Raw_context.t * int) tzresult Lwt.t - end - (** Current storage space in bytes. Includes code, global storage and big map elements. *) - module Used_storage_space : Indexed_data_storage - with type key = Contract_repr.t - and type value = Z.t - and type t := Raw_context.t + module Used_storage_space : + Indexed_data_storage + with type key = Contract_repr.t + and type value = Z.t + and type t := Raw_context.t (** Maximal space available without needing to burn new fees. *) - module Paid_storage_space : Indexed_data_storage - with type key = Contract_repr.t - and type value = Z.t - and type t := Raw_context.t - + module Paid_storage_space : + Indexed_data_storage + with type key = Contract_repr.t + and type value = Z.t + and type t := Raw_context.t end module Big_map : sig - module Next : sig val incr : Raw_context.t -> (Raw_context.t * Z.t) tzresult Lwt.t + val init : Raw_context.t -> Raw_context.t tzresult Lwt.t end (** The domain of alive big maps *) - val fold : - Raw_context.t -> - init:'a -> f:(Z.t -> 'a -> 'a Lwt.t) -> 'a Lwt.t + val fold : Raw_context.t -> init:'a -> f:(Z.t -> 'a -> 'a Lwt.t) -> 'a Lwt.t + val list : Raw_context.t -> Z.t list Lwt.t val remove_rec : Raw_context.t -> Z.t -> Raw_context.t Lwt.t - val copy : Raw_context.t -> from:Z.t -> to_:Z.t -> Raw_context.t tzresult Lwt.t + val copy : + Raw_context.t -> from:Z.t -> to_:Z.t -> Raw_context.t tzresult Lwt.t type key = Raw_context.t * Z.t val rpc_arg : Z.t RPC_arg.t - module Index : Storage_description.INDEX with type t = Z.t + module Contents : + Non_iterable_indexed_carbonated_data_storage + with type key = Script_expr_hash.t + and type value = Script_repr.expr + and type t := key - module Contents : Non_iterable_indexed_carbonated_data_storage - with type key = Script_expr_hash.t - and type value = Script_repr.expr - and type t := key + module Total_bytes : + Indexed_data_storage + with type key = Z.t + and type value = Z.t + and type t := Raw_context.t - module Total_bytes : Indexed_data_storage - with type key = Z.t - and type value = Z.t - and type t := Raw_context.t - - module Key_type : Indexed_data_storage - with type key = Z.t - and type value = Script_repr.expr - and type t := Raw_context.t - - module Value_type : Indexed_data_storage - with type key = Z.t - and type value = Script_repr.expr - and type t := Raw_context.t + module Key_type : + Indexed_data_storage + with type key = Z.t + and type value = Script_repr.expr + and type t := Raw_context.t + module Value_type : + Indexed_data_storage + with type key = Z.t + and type value = Script_repr.expr + and type t := Raw_context.t end (** Set of all registered delegates. *) -module Delegates : Data_set_storage - with type t := Raw_context.t - and type elt = Signature.Public_key_hash.t +module Delegates : + Data_set_storage + with type t := Raw_context.t + and type elt = Signature.Public_key_hash.t (** Set of all active delegates with rolls. *) -module Active_delegates_with_rolls : Data_set_storage - with type t := Raw_context.t - and type elt = Signature.Public_key_hash.t +module Active_delegates_with_rolls : + Data_set_storage + with type t := Raw_context.t + and type elt = Signature.Public_key_hash.t (** Set of all the delegates with frozen rewards/bonds/fees for a given cycle. *) -module Delegates_with_frozen_balance : Data_set_storage - with type t = Raw_context.t * Cycle_repr.t - and type elt = Signature.Public_key_hash.t +module Delegates_with_frozen_balance : + Data_set_storage + with type t = Raw_context.t * Cycle_repr.t + and type elt = Signature.Public_key_hash.t (** Votes *) module Vote : sig - - module Current_period_kind : Single_data_storage - with type value = Voting_period_repr.kind - and type t := Raw_context.t - - (** Only for migration from 004. - Expected quorum, in centile of percentage *) - module Current_quorum_004 : Single_data_storage - with type value = int32 - and type t := Raw_context.t + module Current_period_kind : + Single_data_storage + with type value = Voting_period_repr.kind + and type t := Raw_context.t (** Participation exponential moving average, in centile of percentage *) - module Participation_ema : Single_data_storage - with type value = int32 - and type t := Raw_context.t + module Participation_ema : + Single_data_storage with type value = int32 and type t := Raw_context.t - module Current_proposal : Single_data_storage - with type value = Protocol_hash.t - and type t := Raw_context.t + module Current_proposal : + Single_data_storage + with type value = Protocol_hash.t + and type t := Raw_context.t (** Sum of all rolls of all delegates. *) - module Listings_size : Single_data_storage - with type value = int32 - and type t := Raw_context.t + module Listings_size : + Single_data_storage with type value = int32 and type t := Raw_context.t (** Contains all delegates with their assigned number of rolls. *) - module Listings : Indexed_data_storage - with type key = Signature.Public_key_hash.t - and type value = int32 - and type t := Raw_context.t + module Listings : + Indexed_data_storage + with type key = Signature.Public_key_hash.t + and type value = int32 + and type t := Raw_context.t (** Set of protocol proposal with corresponding proposer delegate *) - module Proposals : Data_set_storage - with type elt = Protocol_hash.t * Signature.Public_key_hash.t - and type t := Raw_context.t + module Proposals : + Data_set_storage + with type elt = Protocol_hash.t * Signature.Public_key_hash.t + and type t := Raw_context.t (** Keeps for each delegate the number of proposed protocols *) - module Proposals_count : Indexed_data_storage - with type key = Signature.Public_key_hash.t - and type value = int - and type t := Raw_context.t + module Proposals_count : + Indexed_data_storage + with type key = Signature.Public_key_hash.t + and type value = int + and type t := Raw_context.t (** Contains for each delegate its ballot *) - module Ballots : Indexed_data_storage - with type key = Signature.Public_key_hash.t - and type value = Vote_repr.ballot - and type t := Raw_context.t - + module Ballots : + Indexed_data_storage + with type key = Signature.Public_key_hash.t + and type value = Vote_repr.ballot + and type t := Raw_context.t end (** Seed *) module Seed : sig - (** Storage from this submodule must only be accessed through the module `Seed`. *) type unrevealed_nonce = { - nonce_hash: Nonce_hash.t ; - delegate: Signature.Public_key_hash.t ; - rewards: Tez_repr.t ; - fees: Tez_repr.t ; + nonce_hash : Nonce_hash.t; + delegate : Signature.Public_key_hash.t; + rewards : Tez_repr.t; + fees : Tez_repr.t; } type nonce_status = | Unrevealed of unrevealed_nonce | Revealed of Seed_repr.nonce - module Nonce : Non_iterable_indexed_data_storage - with type key := Level_repr.t - and type value := nonce_status - and type t := Raw_context.t + module Nonce : + Non_iterable_indexed_data_storage + with type key := Level_repr.t + and type value := nonce_status + and type t := Raw_context.t module For_cycle : sig - val init : Raw_context.t -> Cycle_repr.t -> Seed_repr.seed -> Raw_context.t tzresult Lwt.t + val init : + Raw_context.t -> + Cycle_repr.t -> + Seed_repr.seed -> + Raw_context.t tzresult Lwt.t + val get : Raw_context.t -> Cycle_repr.t -> Seed_repr.seed tzresult Lwt.t + val delete : Raw_context.t -> Cycle_repr.t -> Raw_context.t tzresult Lwt.t end - end (** Commitments *) -module Commitments : Indexed_data_storage - with type key = Blinded_public_key_hash.t - and type value = Tez_repr.t - and type t := Raw_context.t +module Commitments : + Indexed_data_storage + with type key = Blinded_public_key_hash.t + and type value = Tez_repr.t + and type t := Raw_context.t (** Ramp up security deposits... *) module Ramp_up : sig - module Rewards : Indexed_data_storage - with type key = Cycle_repr.t - and type value = Tez_repr.t * Tez_repr.t (* baking * endorsement *) - and type t := Raw_context.t + with type key = Cycle_repr.t + and type value := Tez_repr.t list * Tez_repr.t list + (* baking rewards per endorsement * endorsement rewards *) + and type t := Raw_context.t module Security_deposits : Indexed_data_storage - with type key = Cycle_repr.t - and type value = Tez_repr.t * Tez_repr.t (* baking * endorsement *) - and type t := Raw_context.t - + with type key = Cycle_repr.t + and type value = Tez_repr.t * Tez_repr.t + (* baking * endorsement *) + and type t := Raw_context.t end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/storage_description.ml b/vendors/ligo-utils/tezos-protocol-alpha/storage_description.ml index 7fa1c1dbb..e9cfb34ce 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/storage_description.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/storage_description.ml @@ -23,59 +23,76 @@ (* *) (*****************************************************************************) -module StringMap = Map.Make(String) +module StringMap = Map.Make (String) type 'key t = 'key description ref and 'key description = | Empty : 'key description - | Value : { get: 'key -> 'a option tzresult Lwt.t ; - encoding: 'a Data_encoding.t } -> 'key description - | NamedDir: 'key t StringMap.t -> 'key description - | IndexedDir: { arg: 'a RPC_arg.t ; - arg_encoding: 'a Data_encoding.t ; - list: 'key -> 'a list tzresult Lwt.t ; - subdir: ('key * 'a) t }-> 'key description + | Value : { + get : 'key -> 'a option tzresult Lwt.t; + encoding : 'a Data_encoding.t; + } + -> 'key description + | NamedDir : 'key t StringMap.t -> 'key description + | IndexedDir : { + arg : 'a RPC_arg.t; + arg_encoding : 'a Data_encoding.t; + list : 'key -> 'a list tzresult Lwt.t; + subdir : ('key * 'a) t; + } + -> 'key description let rec register_named_subcontext : type r. r t -> string list -> r t = - fun dir names -> - match !dir, names with - | _, [] -> dir - | Value _, _ -> invalid_arg "" - | IndexedDir _, _ -> invalid_arg "" - | Empty, name :: names -> - let subdir = ref Empty in - dir := NamedDir (StringMap.singleton name subdir) ; - register_named_subcontext subdir names - | NamedDir map, name :: names -> - let subdir = - match StringMap.find_opt name map with - | Some subdir -> subdir - | None -> - let subdir = ref Empty in - dir := NamedDir (StringMap.add name subdir map) ; - subdir in - register_named_subcontext subdir names + fun dir names -> + match (!dir, names) with + | (_, []) -> + dir + | (Value _, _) -> + invalid_arg "" + | (IndexedDir _, _) -> + invalid_arg "" + | (Empty, name :: names) -> + let subdir = ref Empty in + dir := NamedDir (StringMap.singleton name subdir) ; + register_named_subcontext subdir names + | (NamedDir map, name :: names) -> + let subdir = + match StringMap.find_opt name map with + | Some subdir -> + subdir + | None -> + let subdir = ref Empty in + dir := NamedDir (StringMap.add name subdir map) ; + subdir + in + register_named_subcontext subdir names type (_, _, _) args = - | One : { rpc_arg: 'a RPC_arg.t ; - encoding: 'a Data_encoding.t ; - compare: 'a -> 'a -> int } -> ('key, 'a, 'key * 'a) args - | Pair : ('key, 'a, 'inter_key) args * - ('inter_key, 'b, 'sub_key) args -> ('key, 'a * 'b, 'sub_key) args + | One : { + rpc_arg : 'a RPC_arg.t; + encoding : 'a Data_encoding.t; + compare : 'a -> 'a -> int; + } + -> ('key, 'a, 'key * 'a) args + | Pair : + ('key, 'a, 'inter_key) args * ('inter_key, 'b, 'sub_key) args + -> ('key, 'a * 'b, 'sub_key) args let rec unpack : type a b c. (a, b, c) args -> c -> a * b = function - | One _ -> (fun x -> x) + | One _ -> + fun x -> x | Pair (l, r) -> let unpack_l = unpack l in let unpack_r = unpack r in fun x -> - let c, d = unpack_r x in - let b, a = unpack_l c in + let (c, d) = unpack_r x in + let (b, a) = unpack_l c in (b, (a, d)) let rec pack : type a b c. (a, b, c) args -> a -> b -> c = function - | One _ -> (fun b a -> (b, a)) + | One _ -> + fun b a -> (b, a) | Pair (l, r) -> let pack_l = pack l in let pack_r = pack r in @@ -84,223 +101,239 @@ let rec pack : type a b c. (a, b, c) args -> a -> b -> c = function pack_r c d let rec compare : type a b c. (a, b, c) args -> b -> b -> int = function - | One { compare ; _ } -> compare - | Pair (l, r) -> + | One {compare; _} -> + compare + | Pair (l, r) -> ( let compare_l = compare l in let compare_r = compare r in fun (a1, b1) (a2, b2) -> - match compare_l a1 a2 with - | 0 -> compare_r b1 b2 - | x -> x + match compare_l a1 a2 with 0 -> compare_r b1 b2 | x -> x ) let destutter equal l = match l with - | [] -> [] + | [] -> + [] | (i, _) :: l -> let rec loop acc i = function - | [] -> acc + | [] -> + acc | (j, _) :: l -> - if equal i j then loop acc i l - else loop (j :: acc) j l in + if equal i j then loop acc i l else loop (j :: acc) j l + in loop [i] i l -let rec register_indexed_subcontext - : type r a b. r t -> list:(r -> a list tzresult Lwt.t) -> - (r, a, b) args -> b t = - fun dir ~list path -> - match path with - | Pair (left, right) -> - let compare_left = compare left in - let equal_left x y = Compare.Int.(compare_left x y = 0) in - let list_left r = - list r >>=? fun l -> - return (destutter equal_left l) in - let list_right r = - let a, k = unpack left r in - list a >>=? fun l -> - return - (List.map snd - (List.filter (fun (x, _) -> equal_left x k) l)) in - register_indexed_subcontext - (register_indexed_subcontext dir ~list:list_left left) - ~list:list_right right - | One { rpc_arg = arg ; encoding = arg_encoding ; _ } -> - match !dir with - | Value _ -> invalid_arg "" - | NamedDir _ -> invalid_arg "" - | Empty -> - let subdir = ref Empty in - dir := IndexedDir { arg ; arg_encoding ; list ; subdir }; - subdir - | IndexedDir { arg = inner_arg ; subdir ; _ } -> - match RPC_arg.eq arg inner_arg with - | None -> invalid_arg "" - | Some RPC_arg.Eq -> subdir +let rec register_indexed_subcontext : + type r a b. + r t -> list:(r -> a list tzresult Lwt.t) -> (r, a, b) args -> b t = + fun dir ~list path -> + match path with + | Pair (left, right) -> + let compare_left = compare left in + let equal_left x y = Compare.Int.(compare_left x y = 0) in + let list_left r = list r >>=? fun l -> return (destutter equal_left l) in + let list_right r = + let (a, k) = unpack left r in + list a + >>=? fun l -> + return (List.map snd (List.filter (fun (x, _) -> equal_left x k) l)) + in + register_indexed_subcontext + (register_indexed_subcontext dir ~list:list_left left) + ~list:list_right + right + | One {rpc_arg = arg; encoding = arg_encoding; _} -> ( + match !dir with + | Value _ -> + invalid_arg "" + | NamedDir _ -> + invalid_arg "" + | Empty -> + let subdir = ref Empty in + dir := IndexedDir {arg; arg_encoding; list; subdir} ; + subdir + | IndexedDir {arg = inner_arg; subdir; _} -> ( + match RPC_arg.eq arg inner_arg with + | None -> + invalid_arg "" + | Some RPC_arg.Eq -> + subdir ) ) let register_value : - type a b. a t -> get:(a -> b option tzresult Lwt.t) -> b Data_encoding.t -> unit = - fun dir ~get encoding -> - match !dir with - | Empty -> dir := Value { get ; encoding } - | _ -> invalid_arg "" + type a b. + a t -> get:(a -> b option tzresult Lwt.t) -> b Data_encoding.t -> unit = + fun dir ~get encoding -> + match !dir with Empty -> dir := Value {get; encoding} | _ -> invalid_arg "" let create () = ref Empty -let rec pp : type a. Format.formatter -> a t -> unit = fun ppf dir -> +let rec pp : type a. Format.formatter -> a t -> unit = + fun ppf dir -> match !dir with | Empty -> Format.fprintf ppf "EMPTY" | Value _e -> Format.fprintf ppf "Value" | NamedDir map -> - Format.fprintf ppf "@[%a@]" + Format.fprintf + ppf + "@[%a@]" (Format.pp_print_list pp_item) (StringMap.bindings map) - | IndexedDir { arg ; subdir ; _ } -> + | IndexedDir {arg; subdir; _} -> let name = Format.asprintf "<%s>" (RPC_arg.descr arg).name in pp_item ppf (name, subdir) -and pp_item : type a. Format.formatter -> (string * a t) -> unit = - fun ppf (name, dir) -> - Format.fprintf ppf "@[%s@ %a@]" - name - pp dir - +and pp_item : type a. Format.formatter -> string * a t -> unit = + fun ppf (name, dir) -> Format.fprintf ppf "@[%s@ %a@]" name pp dir module type INDEX = sig type t - val path_length: int - val to_path: t -> string list -> string list - val of_path: string list -> t option - val rpc_arg: t RPC_arg.t - val encoding: t Data_encoding.t - val compare: t -> t -> int + + val path_length : int + + val to_path : t -> string list -> string list + + val of_path : string list -> t option + + val rpc_arg : t RPC_arg.t + + val encoding : t Data_encoding.t + + val compare : t -> t -> int end type _ handler = - Handler : - { encoding: 'a Data_encoding.t ; - get: 'key -> int -> 'a tzresult Lwt.t } -> 'key handler + | Handler : { + encoding : 'a Data_encoding.t; + get : 'key -> int -> 'a tzresult Lwt.t; + } + -> 'key handler type _ opt_handler = - Opt_handler : - { encoding: 'a Data_encoding.t ; - get: 'key -> int -> 'a option tzresult Lwt.t } -> 'key opt_handler + | Opt_handler : { + encoding : 'a Data_encoding.t; + get : 'key -> int -> 'a option tzresult Lwt.t; + } + -> 'key opt_handler let rec combine_object = function - | [] -> Handler { encoding = Data_encoding.unit ; - get = fun _ _ -> return_unit } + | [] -> + Handler {encoding = Data_encoding.unit; get = (fun _ _ -> return_unit)} | (name, Opt_handler handler) :: fields -> - let Handler handlers = combine_object fields in - Handler { encoding = - Data_encoding.merge_objs - Data_encoding.(obj1 (opt name (dynamic_size handler.encoding))) - handlers.encoding ; - get = fun k i -> - handler.get k i >>=? fun v1 -> - handlers.get k i >>=? fun v2 -> - return (v1, v2) } + let (Handler handlers) = combine_object fields in + Handler + { + encoding = + Data_encoding.merge_objs + Data_encoding.(obj1 (opt name (dynamic_size handler.encoding))) + handlers.encoding; + get = + (fun k i -> + handler.get k i + >>=? fun v1 -> handlers.get k i >>=? fun v2 -> return (v1, v2)); + } -type query = { - depth: int ; -} +type query = {depth : int} let depth_query = let open RPC_query in - query (fun depth -> { depth }) + query (fun depth -> {depth}) |+ field "depth" RPC_arg.int 0 (fun t -> t.depth) |> seal let build_directory : type key. key t -> key RPC_directory.t = - fun dir -> - let rpc_dir = ref (RPC_directory.empty : key RPC_directory.t) in - let register : type ikey. (key, ikey) RPC_path.t -> ikey opt_handler -> unit = - fun path (Opt_handler { encoding ; get }) -> - let service = - RPC_service.get_service - ~query: depth_query - ~output: encoding - path in - rpc_dir := - RPC_directory.register !rpc_dir service begin - fun k q () -> - get k (q.depth + 1) >>=? function - | None -> raise Not_found - | Some x -> return x - end in - let rec build_handler : type ikey. ikey t -> (key, ikey) RPC_path.t -> ikey opt_handler = - fun dir path -> - match !dir with - | Empty -> Opt_handler { encoding = Data_encoding.unit ; - get = fun _ _ -> return_none } - | Value { get ; encoding } -> - let handler = - Opt_handler { - encoding ; - get = - fun k i -> if Compare.Int.(i < 0) then return_none else get k - } in - register path handler ; - handler - | NamedDir map -> - let fields = StringMap.bindings map in - let fields = - List.map - (fun (name, dir) -> - (name, build_handler dir RPC_path.(path / name))) - fields in - let Handler handler = combine_object fields in - let handler = - Opt_handler - { encoding = handler.encoding ; - get = fun k i -> - if Compare.Int.(i < 0) then - return_none - else - handler.get k (i-1) >>=? fun v -> - return_some v } in - register path handler ; - handler - | IndexedDir { arg ; arg_encoding ; list ; subdir } -> - let Opt_handler handler = - build_handler subdir RPC_path.(path /: arg) in - let encoding = - let open Data_encoding in - union [ - case (Tag 0) - ~title:"Leaf" - (dynamic_size arg_encoding) - (function (key, None) -> Some key | _ -> None) - (fun key -> (key, None)) ; - case (Tag 1) - ~title:"Dir" - (tup2 - (dynamic_size arg_encoding) - (dynamic_size handler.encoding)) - (function (key, Some value) -> Some (key, value) | _ -> None) - (fun (key, value) -> (key, Some value)) ; - ] in - let get k i = - if Compare.Int.(i < 0) then return_none - else if Compare.Int.(i = 0) then return_some [] - else - list k >>=? fun keys -> - map_s - (fun key -> - if Compare.Int.(i = 1) then - return (key, None) - else - handler.get (k, key) (i-1) >>=? fun value -> - return (key, value)) - keys >>=? fun values -> - return_some values in - let handler = - Opt_handler { - encoding = Data_encoding.(list (dynamic_size encoding)) ; - get ; - } in - register path handler ; - handler in - ignore (build_handler dir RPC_path.open_root : key opt_handler) ; - !rpc_dir - + fun dir -> + let rpc_dir = ref (RPC_directory.empty : key RPC_directory.t) in + let register : type ikey. (key, ikey) RPC_path.t -> ikey opt_handler -> unit + = + fun path (Opt_handler {encoding; get}) -> + let service = + RPC_service.get_service ~query:depth_query ~output:encoding path + in + rpc_dir := + RPC_directory.register !rpc_dir service (fun k q () -> + get k (q.depth + 1) + >>=? function None -> raise Not_found | Some x -> return x) + in + let rec build_handler : + type ikey. ikey t -> (key, ikey) RPC_path.t -> ikey opt_handler = + fun dir path -> + match !dir with + | Empty -> + Opt_handler + {encoding = Data_encoding.unit; get = (fun _ _ -> return_none)} + | Value {get; encoding} -> + let handler = + Opt_handler + { + encoding; + get = + (fun k i -> if Compare.Int.(i < 0) then return_none else get k); + } + in + register path handler ; handler + | NamedDir map -> + let fields = StringMap.bindings map in + let fields = + List.map + (fun (name, dir) -> + (name, build_handler dir RPC_path.(path / name))) + fields + in + let (Handler handler) = combine_object fields in + let handler = + Opt_handler + { + encoding = handler.encoding; + get = + (fun k i -> + if Compare.Int.(i < 0) then return_none + else handler.get k (i - 1) >>=? fun v -> return_some v); + } + in + register path handler ; handler + | IndexedDir {arg; arg_encoding; list; subdir} -> + let (Opt_handler handler) = + build_handler subdir RPC_path.(path /: arg) + in + let encoding = + let open Data_encoding in + union + [ case + (Tag 0) + ~title:"Leaf" + (dynamic_size arg_encoding) + (function (key, None) -> Some key | _ -> None) + (fun key -> (key, None)); + case + (Tag 1) + ~title:"Dir" + (tup2 + (dynamic_size arg_encoding) + (dynamic_size handler.encoding)) + (function (key, Some value) -> Some (key, value) | _ -> None) + (fun (key, value) -> (key, Some value)) ] + in + let get k i = + if Compare.Int.(i < 0) then return_none + else if Compare.Int.(i = 0) then return_some [] + else + list k + >>=? fun keys -> + map_s + (fun key -> + if Compare.Int.(i = 1) then return (key, None) + else + handler.get (k, key) (i - 1) + >>=? fun value -> return (key, value)) + keys + >>=? fun values -> return_some values + in + let handler = + Opt_handler + {encoding = Data_encoding.(list (dynamic_size encoding)); get} + in + register path handler ; handler + in + ignore (build_handler dir RPC_path.open_root : key opt_handler) ; + !rpc_dir diff --git a/vendors/ligo-utils/tezos-protocol-alpha/storage_description.mli b/vendors/ligo-utils/tezos-protocol-alpha/storage_description.mli index 2f6a59fd0..1c900c982 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/storage_description.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/storage_description.mli @@ -27,56 +27,69 @@ type 'key t (** Trivial display of the key-value context layout. *) -val pp: Format.formatter -> 'key t -> unit +val pp : Format.formatter -> 'key t -> unit (** Export an RPC hierarchy for querying the context. There is one service by possible path in the context. Services for "directory" are able to aggregate in one JSON object the whole subtree. *) -val build_directory: 'key t -> 'key RPC_directory.t +val build_directory : 'key t -> 'key RPC_directory.t (** Create a empty context description, keys will be registred by side effects. *) -val create: unit -> 'key t +val create : unit -> 'key t (** Register a single key accessor at a given path. *) -val register_value: +val register_value : 'key t -> get:('key -> 'a option tzresult Lwt.t) -> - 'a Data_encoding.t -> unit + 'a Data_encoding.t -> + unit (** Return a description for a prefixed fragment of the given context. All keys registred in the subcontext will be shared by the external context *) -val register_named_subcontext: 'key t -> string list -> 'key t +val register_named_subcontext : 'key t -> string list -> 'key t (** Description of an index as a sequence of `RPC_arg.t`. *) type (_, _, _) args = - | One : { rpc_arg: 'a RPC_arg.t ; - encoding: 'a Data_encoding.t ; - compare: 'a -> 'a -> int } -> ('key, 'a, 'key * 'a) args - | Pair : ('key, 'a, 'inter_key) args * - ('inter_key, 'b, 'sub_key) args -> ('key, 'a * 'b, 'sub_key) args + | One : { + rpc_arg : 'a RPC_arg.t; + encoding : 'a Data_encoding.t; + compare : 'a -> 'a -> int; + } + -> ('key, 'a, 'key * 'a) args + | Pair : + ('key, 'a, 'inter_key) args * ('inter_key, 'b, 'sub_key) args + -> ('key, 'a * 'b, 'sub_key) args (** Return a description for a indexed sub-context. All keys registred in the subcontext will be shared by the external context. One should provide a function to list all the registred index in the context. *) -val register_indexed_subcontext: +val register_indexed_subcontext : 'key t -> list:('key -> 'arg list tzresult Lwt.t) -> - ('key, 'arg, 'sub_key) args -> 'sub_key t + ('key, 'arg, 'sub_key) args -> + 'sub_key t (** Helpers for manipulating and defining indexes. *) -val pack: ('key, 'a, 'sub_key) args -> 'key -> 'a -> 'sub_key -val unpack: ('key, 'a, 'sub_key) args -> 'sub_key -> 'key * 'a +val pack : ('key, 'a, 'sub_key) args -> 'key -> 'a -> 'sub_key + +val unpack : ('key, 'a, 'sub_key) args -> 'sub_key -> 'key * 'a module type INDEX = sig type t - val path_length: int - val to_path: t -> string list -> string list - val of_path: string list -> t option - val rpc_arg: t RPC_arg.t - val encoding: t Data_encoding.t - val compare: t -> t -> int + + val path_length : int + + val to_path : t -> string list -> string list + + val of_path : string list -> t option + + val rpc_arg : t RPC_arg.t + + val encoding : t Data_encoding.t + + val compare : t -> t -> int end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.ml b/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.ml index 54c3dbbdb..76ed40d4e 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.ml @@ -25,21 +25,32 @@ open Storage_sigs -module Registered = struct let ghost = false end -module Ghost = struct let ghost = true end +module Registered = struct + let ghost = false +end + +module Ghost = struct + let ghost = true +end module Make_encoder (V : VALUE) = struct let of_bytes ~key b = match Data_encoding.Binary.of_bytes V.encoding b with - | None -> error (Raw_context.Storage_error (Corrupted_data key)) - | Some v -> Ok v + | None -> + error (Raw_context.Storage_error (Corrupted_data key)) + | Some v -> + Ok v + let to_bytes v = match Data_encoding.Binary.to_bytes V.encoding v with - | Some b -> b - | None -> MBytes.create 0 + | Some b -> + b + | None -> + MBytes.create 0 end let len_name = "len" + let data_name = "data" let encode_len_value bytes = @@ -53,389 +64,491 @@ let decode_len_value key len = | Some len -> return len -let map_key f = function - | `Key k -> `Key (f k) - | `Dir k -> `Dir (f k) +let map_key f = function `Key k -> `Key (f k) | `Dir k -> `Dir (f k) -module Make_subcontext (R : REGISTER) (C : Raw_context.T) (N : NAME) - : Raw_context.T with type t = C.t = struct +module Make_subcontext (R : REGISTER) (C : Raw_context.T) (N : NAME) : + Raw_context.T with type t = C.t = struct type t = C.t + type context = t + let name_length = List.length N.name + let to_key k = N.name @ k + let of_key k = Misc.remove_elem_from_list name_length k + let mem t k = C.mem t (to_key k) + let dir_mem t k = C.dir_mem t (to_key k) + let get t k = C.get t (to_key k) + let get_option t k = C.get_option t (to_key k) + let init t k v = C.init t (to_key k) v + let set t k v = C.set t (to_key k) v + let init_set t k v = C.init_set t (to_key k) v + let set_option t k v = C.set_option t (to_key k) v + let delete t k = C.delete t (to_key k) + let remove t k = C.remove t (to_key k) + let remove_rec t k = C.remove_rec t (to_key k) + let copy t ~from ~to_ = C.copy t ~from:(to_key from) ~to_:(to_key to_) + let fold t k ~init ~f = - C.fold t (to_key k) ~init - ~f:(fun k acc -> f (map_key of_key k) acc) + C.fold t (to_key k) ~init ~f:(fun k acc -> f (map_key of_key k) acc) + let keys t k = C.keys t (to_key k) >|= fun keys -> List.map of_key keys + let fold_keys t k ~init ~f = C.fold_keys t (to_key k) ~init ~f:(fun k acc -> f (of_key k) acc) + let project = C.project + let absolute_key c k = C.absolute_key c (to_key k) + let consume_gas = C.consume_gas + let check_enough_gas = C.check_enough_gas + let description = - let description = if R.ghost then Storage_description.create () - else C.description in + let description = + if R.ghost then Storage_description.create () else C.description + in Storage_description.register_named_subcontext description N.name end -module Make_single_data_storage (R : REGISTER) (C : Raw_context.T) (N : NAME) (V : VALUE) - : Single_data_storage with type t = C.t - and type value = V.t = struct +module Make_single_data_storage + (R : REGISTER) + (C : Raw_context.T) + (N : NAME) + (V : VALUE) : Single_data_storage with type t = C.t and type value = V.t = +struct type t = C.t + type context = t + type value = V.t - let mem t = - C.mem t N.name - include Make_encoder(V) + + let mem t = C.mem t N.name + + include Make_encoder (V) + let get t = - C.get t N.name >>=? fun b -> + C.get t N.name + >>=? fun b -> let key = C.absolute_key t N.name in Lwt.return (of_bytes ~key b) + let get_option t = - C.get_option t N.name >>= function - | None -> return_none - | Some b -> + C.get_option t N.name + >>= function + | None -> + return_none + | Some b -> ( let key = C.absolute_key t N.name in match of_bytes ~key b with - | Ok v -> return_some v - | Error _ as err -> Lwt.return err + | Ok v -> + return_some v + | Error _ as err -> + Lwt.return err ) + let init t v = - C.init t N.name (to_bytes v) >>=? fun t -> - return (C.project t) - let set t v = - C.set t N.name (to_bytes v) >>=? fun t -> - return (C.project t) + C.init t N.name (to_bytes v) >>=? fun t -> return (C.project t) + + let set t v = C.set t N.name (to_bytes v) >>=? fun t -> return (C.project t) + let init_set t v = - C.init_set t N.name (to_bytes v) >>= fun t -> - Lwt.return (C.project t) + C.init_set t N.name (to_bytes v) >>= fun t -> Lwt.return (C.project t) + let set_option t v = - C.set_option t N.name (Option.map ~f:to_bytes v) >>= fun t -> - Lwt.return (C.project t) - let remove t = - C.remove t N.name >>= fun t -> - Lwt.return (C.project t) - let delete t = - C.delete t N.name >>=? fun t -> - return (C.project t) + C.set_option t N.name (Option.map ~f:to_bytes v) + >>= fun t -> Lwt.return (C.project t) + + let remove t = C.remove t N.name >>= fun t -> Lwt.return (C.project t) + + let delete t = C.delete t N.name >>=? fun t -> return (C.project t) let () = let open Storage_description in - let description = if R.ghost then Storage_description.create () - else C.description in + let description = + if R.ghost then Storage_description.create () else C.description + in register_value ~get:get_option (register_named_subcontext description N.name) V.encoding - end module type INDEX = sig type t - val path_length: int - val to_path: t -> string list -> string list - val of_path: string list -> t option + + val path_length : int + + val to_path : t -> string list -> string list + + val of_path : string list -> t option + type 'a ipath - val args: ('a, t, 'a ipath) Storage_description.args + + val args : ('a, t, 'a ipath) Storage_description.args end -module Pair(I1 : INDEX)(I2 : INDEX) - : INDEX with type t = I1.t * I2.t = struct +module Pair (I1 : INDEX) (I2 : INDEX) : INDEX with type t = I1.t * I2.t = +struct type t = I1.t * I2.t + let path_length = I1.path_length + I2.path_length + let to_path (x, y) l = I1.to_path x (I2.to_path y l) + let of_path l = match Misc.take I1.path_length l with - | None -> None - | Some (l1, l2) -> - match I1.of_path l1, I2.of_path l2 with - | Some x, Some y -> Some (x, y) - | _ -> None + | None -> + None + | Some (l1, l2) -> ( + match (I1.of_path l1, I2.of_path l2) with + | (Some x, Some y) -> + Some (x, y) + | _ -> + None ) + type 'a ipath = 'a I1.ipath I2.ipath + let args = Storage_description.Pair (I1.args, I2.args) end -module Make_data_set_storage (C : Raw_context.T) (I : INDEX) - : Data_set_storage with type t = C.t and type elt = I.t = struct - +module Make_data_set_storage (C : Raw_context.T) (I : INDEX) : + Data_set_storage with type t = C.t and type elt = I.t = struct type t = C.t + type context = t + type elt = I.t let inited = MBytes.of_string "inited" - let mem s i = - C.mem s (I.to_path i []) + let mem s i = C.mem s (I.to_path i []) + let add s i = - C.init_set s (I.to_path i []) inited >>= fun t -> - Lwt.return (C.project t) + C.init_set s (I.to_path i []) inited >>= fun t -> Lwt.return (C.project t) + let del s i = - C.remove s (I.to_path i []) >>= fun t -> - Lwt.return (C.project t) - let set s i = function - | true -> add s i - | false -> del s i - let clear s = - C.remove_rec s [] >>= fun t -> - Lwt.return (C.project t) + C.remove s (I.to_path i []) >>= fun t -> Lwt.return (C.project t) + + let set s i = function true -> add s i | false -> del s i + + let clear s = C.remove_rec s [] >>= fun t -> Lwt.return (C.project t) let fold s ~init ~f = let rec dig i path acc = if Compare.Int.(i <= 1) then - C.fold s path ~init:acc ~f:begin fun k acc -> - match k with - | `Dir _ -> Lwt.return acc - | `Key file -> + C.fold s path ~init:acc ~f:(fun k acc -> + match k with + | `Dir _ -> + Lwt.return acc + | `Key file -> ( match I.of_path file with - | None -> assert false - | Some p -> f p acc - end + | None -> + assert false + | Some p -> + f p acc )) else - C.fold s path ~init:acc ~f:begin fun k acc -> - match k with - | `Dir k -> - dig (i-1) k acc - | `Key _ -> - Lwt.return acc - end in + C.fold s path ~init:acc ~f:(fun k acc -> + match k with + | `Dir k -> + dig (i - 1) k acc + | `Key _ -> + Lwt.return acc) + in dig I.path_length [] init - let elements s = - fold s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) + let elements s = fold s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) let () = let open Storage_description in let unpack = unpack I.args in - register_value - (* TODO fixme 'elements...' *) + register_value (* TODO fixme 'elements...' *) ~get:(fun c -> - let (c, k) = unpack c in - mem c k >>= function - | true -> return_some true - | false -> return_none) + let (c, k) = unpack c in + mem c k >>= function true -> return_some true | false -> return_none) (register_indexed_subcontext ~list:(fun c -> elements c >>= return) - C.description I.args) + C.description + I.args) Data_encoding.bool - end -module Make_indexed_data_storage - (C : Raw_context.T) (I : INDEX) (V : VALUE) - : Indexed_data_storage with type t = C.t - and type key = I.t - and type value = V.t = struct +module Make_indexed_data_storage (C : Raw_context.T) (I : INDEX) (V : VALUE) : + Indexed_data_storage + with type t = C.t + and type key = I.t + and type value = V.t = struct type t = C.t + type context = t + type key = I.t + type value = V.t - include Make_encoder(V) - let mem s i = - C.mem s (I.to_path i []) + + include Make_encoder (V) + + let mem s i = C.mem s (I.to_path i []) + let get s i = - C.get s (I.to_path i []) >>=? fun b -> + C.get s (I.to_path i []) + >>=? fun b -> let key = C.absolute_key s (I.to_path i []) in Lwt.return (of_bytes ~key b) + let get_option s i = - C.get_option s (I.to_path i []) >>= function - | None -> return_none - | Some b -> + C.get_option s (I.to_path i []) + >>= function + | None -> + return_none + | Some b -> ( let key = C.absolute_key s (I.to_path i []) in match of_bytes ~key b with - | Ok v -> return_some v - | Error _ as err -> Lwt.return err + | Ok v -> + return_some v + | Error _ as err -> + Lwt.return err ) + let set s i v = - C.set s (I.to_path i []) (to_bytes v) >>=? fun t -> - return (C.project t) + C.set s (I.to_path i []) (to_bytes v) >>=? fun t -> return (C.project t) + let init s i v = - C.init s (I.to_path i []) (to_bytes v) >>=? fun t -> - return (C.project t) + C.init s (I.to_path i []) (to_bytes v) >>=? fun t -> return (C.project t) + let init_set s i v = - C.init_set s (I.to_path i []) (to_bytes v) >>= fun t -> - Lwt.return (C.project t) + C.init_set s (I.to_path i []) (to_bytes v) + >>= fun t -> Lwt.return (C.project t) + let set_option s i v = - C.set_option s (I.to_path i []) (Option.map ~f:to_bytes v) >>= fun t -> - Lwt.return (C.project t) + C.set_option s (I.to_path i []) (Option.map ~f:to_bytes v) + >>= fun t -> Lwt.return (C.project t) + let remove s i = - C.remove s (I.to_path i []) >>= fun t -> - Lwt.return (C.project t) + C.remove s (I.to_path i []) >>= fun t -> Lwt.return (C.project t) + let delete s i = - C.delete s (I.to_path i []) >>=? fun t -> - return (C.project t) - let clear s = - C.remove_rec s [] >>= fun t -> - Lwt.return (C.project t) + C.delete s (I.to_path i []) >>=? fun t -> return (C.project t) + + let clear s = C.remove_rec s [] >>= fun t -> Lwt.return (C.project t) let fold_keys s ~init ~f = let rec dig i path acc = if Compare.Int.(i <= 1) then - C.fold s path ~init:acc ~f:begin fun k acc -> - match k with - | `Dir _ -> Lwt.return acc - | `Key file -> + C.fold s path ~init:acc ~f:(fun k acc -> + match k with + | `Dir _ -> + Lwt.return acc + | `Key file -> ( match I.of_path file with - | None -> assert false - | Some path -> f path acc - end + | None -> + assert false + | Some path -> + f path acc )) else - C.fold s path ~init:acc ~f:begin fun k acc -> - match k with - | `Dir k -> dig (i-1) k acc - | `Key _ -> Lwt.return acc - end in + C.fold s path ~init:acc ~f:(fun k acc -> + match k with + | `Dir k -> + dig (i - 1) k acc + | `Key _ -> + Lwt.return acc) + in dig I.path_length [] init let fold s ~init ~f = let f path acc = - get s path >>= function + get s path + >>= function | Error _ -> (* FIXME: silently ignore unparsable data *) Lwt.return acc | Ok v -> - f path v acc in + f path v acc + in fold_keys s ~init ~f + let bindings s = - fold s ~init:[] ~f:(fun p v acc -> Lwt.return ((p,v) :: acc)) - let keys s = - fold_keys s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) + fold s ~init:[] ~f:(fun p v acc -> Lwt.return ((p, v) :: acc)) + + let keys s = fold_keys s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) let () = let open Storage_description in let unpack = unpack I.args in register_value ~get:(fun c -> - let (c, k) = unpack c in - get_option c k) + let (c, k) = unpack c in + get_option c k) (register_indexed_subcontext ~list:(fun c -> keys c >>= return) - C.description I.args) + C.description + I.args) V.encoding - end module Make_indexed_carbonated_data_storage - (C : Raw_context.T) (I : INDEX) (V : VALUE) - : Non_iterable_indexed_carbonated_data_storage with type t = C.t - and type key = I.t - and type value = V.t = struct + (C : Raw_context.T) + (I : INDEX) + (V : VALUE) : + Non_iterable_indexed_carbonated_data_storage + with type t = C.t + and type key = I.t + and type value = V.t = struct type t = C.t + type context = t + type key = I.t + type value = V.t - include Make_encoder(V) - let data_key i = - I.to_path i [data_name] - let len_key i = - I.to_path i [len_name] + + include Make_encoder (V) + + let data_key i = I.to_path i [data_name] + + let len_key i = I.to_path i [len_name] + let consume_mem_gas c = Lwt.return (C.consume_gas c (Gas_limit_repr.read_bytes_cost Z.zero)) + let existing_size c i = - C.get_option c (len_key i) >>= function - | None -> return (0, false) - | Some len -> decode_len_value (len_key i) len >>=? fun len -> return (len, true) + C.get_option c (len_key i) + >>= function + | None -> + return (0, false) + | Some len -> + decode_len_value (len_key i) len >>=? fun len -> return (len, true) + let consume_read_gas get c i = - get c (len_key i) >>=? fun len -> - decode_len_value (len_key i) len >>=? fun len -> - Lwt.return (C.consume_gas c (Gas_limit_repr.read_bytes_cost (Z.of_int len))) + get c (len_key i) + >>=? fun len -> + decode_len_value (len_key i) len + >>=? fun len -> + Lwt.return + (C.consume_gas c (Gas_limit_repr.read_bytes_cost (Z.of_int len))) + let consume_serialize_write_gas set c i v = let bytes = to_bytes v in let len = MBytes.length bytes in - Lwt.return (C.consume_gas c (Gas_limit_repr.alloc_mbytes_cost len)) >>=? fun c -> - Lwt.return (C.consume_gas c (Gas_limit_repr.write_bytes_cost (Z.of_int len))) >>=? fun c -> - set c (len_key i) (encode_len_value bytes) >>=? fun c -> - return (c, bytes) + Lwt.return (C.consume_gas c (Gas_limit_repr.alloc_mbytes_cost len)) + >>=? fun c -> + Lwt.return + (C.consume_gas c (Gas_limit_repr.write_bytes_cost (Z.of_int len))) + >>=? fun c -> + set c (len_key i) (encode_len_value bytes) >>=? fun c -> return (c, bytes) + let consume_remove_gas del c i = - Lwt.return (C.consume_gas c (Gas_limit_repr.write_bytes_cost Z.zero)) >>=? fun c -> - del c (len_key i) + Lwt.return (C.consume_gas c (Gas_limit_repr.write_bytes_cost Z.zero)) + >>=? fun c -> del c (len_key i) + let mem s i = - consume_mem_gas s >>=? fun s -> - C.mem s (data_key i) >>= fun exists -> - return (C.project s, exists) + consume_mem_gas s + >>=? fun s -> + C.mem s (data_key i) >>= fun exists -> return (C.project s, exists) + let get s i = - consume_read_gas C.get s i >>=? fun s -> - C.get s (data_key i) >>=? fun b -> + consume_read_gas C.get s i + >>=? fun s -> + C.get s (data_key i) + >>=? fun b -> let key = C.absolute_key s (data_key i) in - Lwt.return (of_bytes ~key b) >>=? fun v -> - return (C.project s, v) + Lwt.return (of_bytes ~key b) >>=? fun v -> return (C.project s, v) + let get_option s i = - consume_mem_gas s >>=? fun s -> - C.mem s (data_key i) >>= fun exists -> - if exists then - get s i >>=? fun (s, v) -> - return (s, Some v) - else - return (C.project s, None) + consume_mem_gas s + >>=? fun s -> + C.mem s (data_key i) + >>= fun exists -> + if exists then get s i >>=? fun (s, v) -> return (s, Some v) + else return (C.project s, None) + let set s i v = - existing_size s i >>=? fun (prev_size, _) -> - consume_serialize_write_gas C.set s i v >>=? fun (s, bytes) -> - C.set s (data_key i) bytes >>=? fun t -> + existing_size s i + >>=? fun (prev_size, _) -> + consume_serialize_write_gas C.set s i v + >>=? fun (s, bytes) -> + C.set s (data_key i) bytes + >>=? fun t -> let size_diff = MBytes.length bytes - prev_size in return (C.project t, size_diff) + let init s i v = - consume_serialize_write_gas C.init s i v >>=? fun (s, bytes) -> - C.init s (data_key i) bytes >>=? fun t -> + consume_serialize_write_gas C.init s i v + >>=? fun (s, bytes) -> + C.init s (data_key i) bytes + >>=? fun t -> let size = MBytes.length bytes in return (C.project t, size) + let init_set s i v = let init_set s i v = C.init_set s i v >>= return in - existing_size s i >>=? fun (prev_size, existed) -> - consume_serialize_write_gas init_set s i v >>=? fun (s, bytes) -> - init_set s (data_key i) bytes >>=? fun t -> + existing_size s i + >>=? fun (prev_size, existed) -> + consume_serialize_write_gas init_set s i v + >>=? fun (s, bytes) -> + init_set s (data_key i) bytes + >>=? fun t -> let size_diff = MBytes.length bytes - prev_size in return (C.project t, size_diff, existed) + let remove s i = let remove s i = C.remove s i >>= return in - existing_size s i >>=? fun (prev_size, existed) -> - consume_remove_gas remove s i >>=? fun s -> - remove s (data_key i) >>=? fun t -> - return (C.project t, prev_size, existed) + existing_size s i + >>=? fun (prev_size, existed) -> + consume_remove_gas remove s i + >>=? fun s -> + remove s (data_key i) >>=? fun t -> return (C.project t, prev_size, existed) + let delete s i = - existing_size s i >>=? fun (prev_size, _) -> - consume_remove_gas C.delete s i >>=? fun s -> - C.delete s (data_key i) >>=? fun t -> - return (C.project t, prev_size) + existing_size s i + >>=? fun (prev_size, _) -> + consume_remove_gas C.delete s i + >>=? fun s -> + C.delete s (data_key i) >>=? fun t -> return (C.project t, prev_size) + let set_option s i v = - match v with - | None -> remove s i - | Some v -> init_set s i v + match v with None -> remove s i | Some v -> init_set s i v let fold_keys_unaccounted s ~init ~f = let rec dig i path acc = if Compare.Int.(i <= 0) then - C.fold s path ~init:acc ~f:begin fun k acc -> - match k with - | `Dir _ -> Lwt.return acc - | `Key file -> + C.fold s path ~init:acc ~f:(fun k acc -> + match k with + | `Dir _ -> + Lwt.return acc + | `Key file -> ( match List.rev file with | last :: _ when Compare.String.(last = len_name) -> Lwt.return acc - | last :: rest when Compare.String.(last = data_name) -> + | last :: rest when Compare.String.(last = data_name) -> ( let file = List.rev rest in - begin match I.of_path file with - | None -> assert false - | Some path -> f path acc - end - | _ -> assert false - end + match I.of_path file with + | None -> + assert false + | Some path -> + f path acc ) + | _ -> + assert false )) else - C.fold s path ~init:acc ~f:begin fun k acc -> - match k with - | `Dir k -> dig (i-1) k acc - | `Key _ -> Lwt.return acc - end in + C.fold s path ~init:acc ~f:(fun k acc -> + match k with + | `Dir k -> + dig (i - 1) k acc + | `Key _ -> + Lwt.return acc) + in dig I.path_length [] init let keys_unaccounted s = @@ -444,88 +557,99 @@ module Make_indexed_carbonated_data_storage let () = let open Storage_description in let unpack = unpack I.args in - register_value - (* TODO export consumed gas ?? *) + register_value (* TODO export consumed gas ?? *) ~get:(fun c -> - let (c, k) = unpack c in - get_option c k >>=? fun (_, v) -> - return v) + let (c, k) = unpack c in + get_option c k >>=? fun (_, v) -> return v) (register_indexed_subcontext ~list:(fun c -> keys_unaccounted c >>= return) - C.description I.args) + C.description + I.args) V.encoding - end - -module Make_indexed_data_snapshotable_storage (C : Raw_context.T) - (Snapshot_index : INDEX) (I : INDEX) (V : VALUE) - : Indexed_data_snapshotable_storage with type t = C.t - and type snapshot = Snapshot_index.t - and type key = I.t - and type value = V.t = struct +module Make_indexed_data_snapshotable_storage + (C : Raw_context.T) + (Snapshot_index : INDEX) + (I : INDEX) + (V : VALUE) : + Indexed_data_snapshotable_storage + with type t = C.t + and type snapshot = Snapshot_index.t + and type key = I.t + and type value = V.t = struct type snapshot = Snapshot_index.t let data_name = ["current"] + let snapshot_name = ["snapshot"] - module C_data = Make_subcontext(Registered)(C)(struct let name = data_name end) - module C_snapshot = Make_subcontext(Registered)(C)(struct let name = snapshot_name end) + module C_data = + Make_subcontext (Registered) (C) + (struct + let name = data_name + end) - include Make_indexed_data_storage(C_data)(I) (V) - module Snapshot = Make_indexed_data_storage(C_snapshot)(Pair(Snapshot_index)(I))(V) + module C_snapshot = + Make_subcontext (Registered) (C) + (struct + let name = snapshot_name + end) + + include Make_indexed_data_storage (C_data) (I) (V) + module Snapshot = + Make_indexed_data_storage (C_snapshot) (Pair (Snapshot_index) (I)) (V) let snapshot_path id = snapshot_name @ Snapshot_index.to_path id [] - let snapshot_exists s id = - C.dir_mem s (snapshot_path id) + let snapshot_exists s id = C.dir_mem s (snapshot_path id) let snapshot s id = - C.copy s ~from:data_name ~to_:(snapshot_path id) >>=? fun t -> - return (C.project t) + C.copy s ~from:data_name ~to_:(snapshot_path id) + >>=? fun t -> return (C.project t) let delete_snapshot s id = - C.remove_rec s (snapshot_path id) >>= fun t -> - Lwt.return (C.project t) - + C.remove_rec s (snapshot_path id) >>= fun t -> Lwt.return (C.project t) end - -module Make_indexed_subcontext (C : Raw_context.T) (I : INDEX) - : Indexed_raw_context with type t = C.t - and type key = I.t - and type 'a ipath = 'a I.ipath = struct - +module Make_indexed_subcontext (C : Raw_context.T) (I : INDEX) : + Indexed_raw_context + with type t = C.t + and type key = I.t + and type 'a ipath = 'a I.ipath = struct type t = C.t + type context = t + type key = I.t + type 'a ipath = 'a I.ipath - let clear t = - C.remove_rec t [] >>= fun t -> - Lwt.return (C.project t) + let clear t = C.remove_rec t [] >>= fun t -> Lwt.return (C.project t) let fold_keys t ~init ~f = let rec dig i path acc = if Compare.Int.(i <= 0) then match I.of_path path with - | None -> assert false - | Some path -> f path acc + | None -> + assert false + | Some path -> + f path acc else - C.fold t path ~init:acc ~f:begin fun k acc -> - match k with - | `Dir k -> dig (i-1) k acc - | `Key _ -> Lwt.return acc - end in + C.fold t path ~init:acc ~f:(fun k acc -> + match k with + | `Dir k -> + dig (i - 1) k acc + | `Key _ -> + Lwt.return acc) + in dig I.path_length [] init - let keys t = - fold_keys t ~init:[] ~f:(fun i acc -> Lwt.return (i :: acc)) + let keys t = fold_keys t ~init:[] ~f:(fun i acc -> Lwt.return (i :: acc)) let list t k = C.fold t k ~init:[] ~f:(fun k acc -> Lwt.return (k :: acc)) - let remove_rec t k = - C.remove_rec t (I.to_path k []) + let remove_rec t k = C.remove_rec t (I.to_path k []) let copy t ~from ~to_ = C.copy t ~from:(I.to_path from []) ~to_:(I.to_path to_ []) @@ -537,379 +661,483 @@ module Make_indexed_subcontext (C : Raw_context.T) (I : INDEX) I.args let unpack = Storage_description.unpack I.args + let pack = Storage_description.pack I.args module Raw_context = struct type t = C.t I.ipath + type context = t + let to_key i k = I.to_path i k + let of_key k = Misc.remove_elem_from_list I.path_length k - let mem c k = let (t, i) = unpack c in C.mem t (to_key i k) - let dir_mem c k = let (t, i) = unpack c in C.dir_mem t (to_key i k) - let get c k = let (t, i) = unpack c in C.get t (to_key i k) - let get_option c k = let (t, i) = unpack c in C.get_option t (to_key i k) + + let mem c k = + let (t, i) = unpack c in + C.mem t (to_key i k) + + let dir_mem c k = + let (t, i) = unpack c in + C.dir_mem t (to_key i k) + + let get c k = + let (t, i) = unpack c in + C.get t (to_key i k) + + let get_option c k = + let (t, i) = unpack c in + C.get_option t (to_key i k) + let init c k v = let (t, i) = unpack c in C.init t (to_key i k) v >>=? fun t -> return (pack t i) + let set c k v = let (t, i) = unpack c in C.set t (to_key i k) v >>=? fun t -> return (pack t i) + let init_set c k v = let (t, i) = unpack c in C.init_set t (to_key i k) v >>= fun t -> Lwt.return (pack t i) + let set_option c k v = let (t, i) = unpack c in C.set_option t (to_key i k) v >>= fun t -> Lwt.return (pack t i) + let delete c k = let (t, i) = unpack c in C.delete t (to_key i k) >>=? fun t -> return (pack t i) + let remove c k = let (t, i) = unpack c in C.remove t (to_key i k) >>= fun t -> Lwt.return (pack t i) + let remove_rec c k = let (t, i) = unpack c in C.remove_rec t (to_key i k) >>= fun t -> Lwt.return (pack t i) + let copy c ~from ~to_ = let (t, i) = unpack c in - C.copy t ~from:(to_key i from) ~to_:(to_key i to_) >>=? fun t -> - return (pack t i) + C.copy t ~from:(to_key i from) ~to_:(to_key i to_) + >>=? fun t -> return (pack t i) + let fold c k ~init ~f = let (t, i) = unpack c in - C.fold t (to_key i k) ~init - ~f:(fun k acc -> f (map_key of_key k) acc) + C.fold t (to_key i k) ~init ~f:(fun k acc -> f (map_key of_key k) acc) + let keys c k = let (t, i) = unpack c in C.keys t (to_key i k) >|= fun keys -> List.map of_key keys + let fold_keys c k ~init ~f = let (t, i) = unpack c in C.fold_keys t (to_key i k) ~init ~f:(fun k acc -> f (of_key k) acc) + let project c = let (t, _) = unpack c in C.project t + let absolute_key c k = let (t, i) = unpack c in C.absolute_key t (to_key i k) + let consume_gas c g = let (t, i) = unpack c in C.consume_gas t g >>? fun t -> ok (pack t i) + let check_enough_gas c g = let (t, _i) = unpack c in C.check_enough_gas t g + let description = description end let resolve t prefix = let rec loop i prefix = function - | [] when Compare.Int.(i = I.path_length) -> begin - match I.of_path prefix with - | None -> assert false - | Some path -> Lwt.return [path] - end + | [] when Compare.Int.(i = I.path_length) -> ( + match I.of_path prefix with + | None -> + assert false + | Some path -> + Lwt.return [path] ) | [] -> - list t prefix >>= fun prefixes -> - Lwt_list.map_s (function - | `Key prefix | `Dir prefix -> loop (i+1) prefix []) prefixes + list t prefix + >>= fun prefixes -> + Lwt_list.map_s + (function `Key prefix | `Dir prefix -> loop (i + 1) prefix []) + prefixes >|= List.flatten | [d] when Compare.Int.(i = I.path_length - 1) -> if Compare.Int.(i >= I.path_length) then invalid_arg "IO.resolve" ; - list t prefix >>= fun prefixes -> - Lwt_list.map_s (function - | `Key prefix | `Dir prefix -> - match Misc.remove_prefix ~prefix:d (List.hd (List.rev prefix)) with - | None -> Lwt.return_nil - | Some _ -> loop (i+1) prefix []) + list t prefix + >>= fun prefixes -> + Lwt_list.map_s + (function + | `Key prefix | `Dir prefix -> ( + match + Misc.remove_prefix ~prefix:d (List.hd (List.rev prefix)) + with + | None -> + Lwt.return_nil + | Some _ -> + loop (i + 1) prefix [] )) prefixes >|= List.flatten | "" :: ds -> - list t prefix >>= fun prefixes -> - Lwt_list.map_s (function - | `Key prefix | `Dir prefix -> loop (i+1) prefix ds) prefixes + list t prefix + >>= fun prefixes -> + Lwt_list.map_s + (function `Key prefix | `Dir prefix -> loop (i + 1) prefix ds) + prefixes >|= List.flatten - | d :: ds -> + | d :: ds -> ( if Compare.Int.(i >= I.path_length) then invalid_arg "IO.resolve" ; - C.dir_mem t (prefix @ [d]) >>= function - | true -> loop (i+1) (prefix @ [d]) ds - | false -> Lwt.return_nil in + C.dir_mem t (prefix @ [d]) + >>= function + | true -> loop (i + 1) (prefix @ [d]) ds | false -> Lwt.return_nil ) + in loop 0 [] prefix module Make_set (R : REGISTER) (N : NAME) = struct type t = C.t + type context = t + type elt = I.t + let inited = MBytes.of_string "inited" + let mem s i = Raw_context.mem (pack s i) N.name + let add s i = - Raw_context.init_set (pack s i) N.name inited >>= fun c -> + Raw_context.init_set (pack s i) N.name inited + >>= fun c -> let (s, _) = unpack c in Lwt.return (C.project s) + let del s i = - Raw_context.remove (pack s i) N.name >>= fun c -> + Raw_context.remove (pack s i) N.name + >>= fun c -> let (s, _) = unpack c in Lwt.return (C.project s) - let set s i = function - | true -> add s i - | false -> del s i + + let set s i = function true -> add s i | false -> del s i + let clear s = - fold_keys s - ~init:s - ~f:begin fun i s -> - Raw_context.remove (pack s i) N.name >>= fun c -> + fold_keys s ~init:s ~f:(fun i s -> + Raw_context.remove (pack s i) N.name + >>= fun c -> let (s, _) = unpack c in - Lwt.return s - end >>= fun t -> - Lwt.return (C.project t) + Lwt.return s) + >>= fun t -> Lwt.return (C.project t) + let fold s ~init ~f = - fold_keys s ~init - ~f:(fun i acc -> - mem s i >>= function - | true -> f i acc - | false -> Lwt.return acc) - let elements s = - fold s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) + fold_keys s ~init ~f:(fun i acc -> + mem s i >>= function true -> f i acc | false -> Lwt.return acc) + + let elements s = fold s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) let () = let open Storage_description in let unpack = unpack I.args in - let description = if R.ghost then Storage_description.create () - else Raw_context.description in + let description = + if R.ghost then Storage_description.create () + else Raw_context.description + in register_value ~get:(fun c -> - let (c, k) = unpack c in - mem c k >>= function - | true -> return_some true - | false -> return_none) + let (c, k) = unpack c in + mem c k + >>= function true -> return_some true | false -> return_none) (register_named_subcontext description N.name) Data_encoding.bool - end module Make_map (N : NAME) (V : VALUE) = struct type t = C.t + type context = t + type key = I.t + type value = V.t - include Make_encoder(V) - let mem s i = - Raw_context.mem (pack s i) N.name + + include Make_encoder (V) + + let mem s i = Raw_context.mem (pack s i) N.name + let get s i = - Raw_context.get (pack s i) N.name >>=? fun b -> + Raw_context.get (pack s i) N.name + >>=? fun b -> let key = Raw_context.absolute_key (pack s i) N.name in Lwt.return (of_bytes ~key b) + let get_option s i = - Raw_context.get_option (pack s i) N.name >>= function - | None -> return_none - | Some b -> + Raw_context.get_option (pack s i) N.name + >>= function + | None -> + return_none + | Some b -> ( let key = Raw_context.absolute_key (pack s i) N.name in match of_bytes ~key b with - | Ok v -> return_some v - | Error _ as err -> Lwt.return err + | Ok v -> + return_some v + | Error _ as err -> + Lwt.return err ) + let set s i v = - Raw_context.set (pack s i) N.name (to_bytes v) >>=? fun c -> + Raw_context.set (pack s i) N.name (to_bytes v) + >>=? fun c -> let (s, _) = unpack c in return (C.project s) + let init s i v = - Raw_context.init (pack s i) N.name (to_bytes v) >>=? fun c -> + Raw_context.init (pack s i) N.name (to_bytes v) + >>=? fun c -> let (s, _) = unpack c in return (C.project s) + let init_set s i v = - Raw_context.init_set (pack s i) N.name (to_bytes v) >>= fun c -> + Raw_context.init_set (pack s i) N.name (to_bytes v) + >>= fun c -> let (s, _) = unpack c in Lwt.return (C.project s) + let set_option s i v = - Raw_context.set_option (pack s i) - N.name (Option.map ~f:to_bytes v) >>= fun c -> + Raw_context.set_option (pack s i) N.name (Option.map ~f:to_bytes v) + >>= fun c -> let (s, _) = unpack c in Lwt.return (C.project s) + let remove s i = - Raw_context.remove (pack s i) N.name >>= fun c -> + Raw_context.remove (pack s i) N.name + >>= fun c -> let (s, _) = unpack c in Lwt.return (C.project s) + let delete s i = - Raw_context.delete (pack s i) N.name >>=? fun c -> + Raw_context.delete (pack s i) N.name + >>=? fun c -> let (s, _) = unpack c in return (C.project s) + let clear s = - fold_keys s ~init:s - ~f:begin fun i s -> - Raw_context.remove (pack s i) N.name >>= fun c -> + fold_keys s ~init:s ~f:(fun i s -> + Raw_context.remove (pack s i) N.name + >>= fun c -> let (s, _) = unpack c in - Lwt.return s - end >>= fun t -> - Lwt.return (C.project t) + Lwt.return s) + >>= fun t -> Lwt.return (C.project t) + let fold s ~init ~f = - fold_keys s ~init - ~f:(fun i acc -> - get s i >>= function - | Error _ -> Lwt.return acc - | Ok v -> f i v acc) + fold_keys s ~init ~f:(fun i acc -> + get s i >>= function Error _ -> Lwt.return acc | Ok v -> f i v acc) + let bindings s = - fold s ~init:[] ~f:(fun p v acc -> Lwt.return ((p,v) :: acc)) + fold s ~init:[] ~f:(fun p v acc -> Lwt.return ((p, v) :: acc)) + let fold_keys s ~init ~f = - fold_keys s ~init - ~f:(fun i acc -> - mem s i >>= function - | false -> Lwt.return acc - | true -> f i acc) - let keys s = - fold_keys s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) + fold_keys s ~init ~f:(fun i acc -> + mem s i >>= function false -> Lwt.return acc | true -> f i acc) + + let keys s = fold_keys s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) let () = let open Storage_description in let unpack = unpack I.args in register_value ~get:(fun c -> - let (c, k) = unpack c in - get_option c k) + let (c, k) = unpack c in + get_option c k) (register_named_subcontext Raw_context.description N.name) V.encoding - end module Make_carbonated_map (N : NAME) (V : VALUE) = struct type t = C.t + type context = t + type key = I.t + type value = V.t - include Make_encoder(V) + + include Make_encoder (V) + let len_name = len_name :: N.name + let data_name = data_name :: N.name + let consume_mem_gas c = - Lwt.return (Raw_context.consume_gas c (Gas_limit_repr.read_bytes_cost Z.zero)) + Lwt.return + (Raw_context.consume_gas c (Gas_limit_repr.read_bytes_cost Z.zero)) + let existing_size c = - Raw_context.get_option c len_name >>= function - | None -> return (0, false) - | Some len -> decode_len_value len_name len >>=? fun len -> return (len, true) + Raw_context.get_option c len_name + >>= function + | None -> + return (0, false) + | Some len -> + decode_len_value len_name len >>=? fun len -> return (len, true) + let consume_read_gas get c = - get c (len_name) >>=? fun len -> - decode_len_value len_name len >>=? fun len -> - Lwt.return (Raw_context.consume_gas c (Gas_limit_repr.read_bytes_cost (Z.of_int len))) + get c len_name + >>=? fun len -> + decode_len_value len_name len + >>=? fun len -> + Lwt.return + (Raw_context.consume_gas + c + (Gas_limit_repr.read_bytes_cost (Z.of_int len))) + let consume_write_gas set c v = let bytes = to_bytes v in let len = MBytes.length bytes in - Lwt.return (Raw_context.consume_gas c (Gas_limit_repr.write_bytes_cost (Z.of_int len))) >>=? fun c -> - set c len_name (encode_len_value bytes) >>=? fun c -> - return (c, bytes) + Lwt.return + (Raw_context.consume_gas + c + (Gas_limit_repr.write_bytes_cost (Z.of_int len))) + >>=? fun c -> + set c len_name (encode_len_value bytes) >>=? fun c -> return (c, bytes) + let consume_remove_gas del c = - Lwt.return (Raw_context.consume_gas c (Gas_limit_repr.write_bytes_cost Z.zero)) >>=? fun c -> - del c len_name + Lwt.return + (Raw_context.consume_gas c (Gas_limit_repr.write_bytes_cost Z.zero)) + >>=? fun c -> del c len_name + let mem s i = - consume_mem_gas (pack s i) >>=? fun c -> - Raw_context.mem c data_name >>= fun res -> - return (Raw_context.project c, res) + consume_mem_gas (pack s i) + >>=? fun c -> + Raw_context.mem c data_name + >>= fun res -> return (Raw_context.project c, res) + let get s i = - consume_read_gas Raw_context.get (pack s i) >>=? fun c -> - Raw_context.get c data_name >>=? fun b -> + consume_read_gas Raw_context.get (pack s i) + >>=? fun c -> + Raw_context.get c data_name + >>=? fun b -> let key = Raw_context.absolute_key c data_name in - Lwt.return (of_bytes ~key b) >>=? fun v -> - return (Raw_context.project c, v) + Lwt.return (of_bytes ~key b) + >>=? fun v -> return (Raw_context.project c, v) + let get_option s i = - consume_mem_gas (pack s i) >>=? fun c -> + consume_mem_gas (pack s i) + >>=? fun c -> let (s, _) = unpack c in - Raw_context.mem (pack s i) data_name >>= fun exists -> - if exists then - get s i >>=? fun (s, v) -> - return (s, Some v) - else - return (C.project s, None) + Raw_context.mem (pack s i) data_name + >>= fun exists -> + if exists then get s i >>=? fun (s, v) -> return (s, Some v) + else return (C.project s, None) + let set s i v = - existing_size (pack s i) >>=? fun (prev_size, _) -> - consume_write_gas Raw_context.set (pack s i) v >>=? fun (c, bytes) -> - Raw_context.set c data_name bytes >>=? fun c -> - let size_diff = MBytes.length bytes - prev_size in - return (Raw_context.project c, size_diff) - let set_free s i v = - let c = pack s i in - let bytes = to_bytes v in - existing_size c >>=? fun (prev_size, _) -> - Raw_context.set c len_name (encode_len_value bytes) >>=? fun c -> - Raw_context.set c data_name bytes >>=? fun c -> + existing_size (pack s i) + >>=? fun (prev_size, _) -> + consume_write_gas Raw_context.set (pack s i) v + >>=? fun (c, bytes) -> + Raw_context.set c data_name bytes + >>=? fun c -> let size_diff = MBytes.length bytes - prev_size in return (Raw_context.project c, size_diff) + let init s i v = - consume_write_gas Raw_context.init (pack s i) v >>=? fun (c, bytes) -> - Raw_context.init c data_name bytes >>=? fun c -> + consume_write_gas Raw_context.init (pack s i) v + >>=? fun (c, bytes) -> + Raw_context.init c data_name bytes + >>=? fun c -> let size = MBytes.length bytes in return (Raw_context.project c, size) - let init_free s i v = - let c = pack s i in - let bytes = to_bytes v in - let size = MBytes.length bytes in - Raw_context.init c len_name (encode_len_value bytes) >>=? fun c -> - Raw_context.init c data_name bytes >>=? fun c -> - return (Raw_context.project c, size) + let init_set s i v = let init_set c k v = Raw_context.init_set c k v >>= return in - existing_size (pack s i) >>=? fun (prev_size, existed) -> - consume_write_gas init_set (pack s i) v >>=? fun (c, bytes) -> - init_set c data_name bytes >>=? fun c -> + existing_size (pack s i) + >>=? fun (prev_size, existed) -> + consume_write_gas init_set (pack s i) v + >>=? fun (c, bytes) -> + init_set c data_name bytes + >>=? fun c -> let size_diff = MBytes.length bytes - prev_size in return (Raw_context.project c, size_diff, existed) + let remove s i = let remove c k = Raw_context.remove c k >>= return in - existing_size (pack s i) >>=? fun (prev_size, existed) -> - consume_remove_gas remove (pack s i) >>=? fun c -> - remove c data_name >>=? fun c -> - return (Raw_context.project c, prev_size, existed) + existing_size (pack s i) + >>=? fun (prev_size, existed) -> + consume_remove_gas remove (pack s i) + >>=? fun c -> + remove c data_name + >>=? fun c -> return (Raw_context.project c, prev_size, existed) + let delete s i = - existing_size (pack s i) >>=? fun (prev_size, _) -> - consume_remove_gas Raw_context.delete (pack s i) >>=? fun c -> - Raw_context.delete c data_name >>=? fun c -> - return (Raw_context.project c, prev_size) + existing_size (pack s i) + >>=? fun (prev_size, _) -> + consume_remove_gas Raw_context.delete (pack s i) + >>=? fun c -> + Raw_context.delete c data_name + >>=? fun c -> return (Raw_context.project c, prev_size) + let set_option s i v = - match v with - | None -> remove s i - | Some v -> init_set s i v + match v with None -> remove s i | Some v -> init_set s i v let () = let open Storage_description in let unpack = unpack I.args in register_value ~get:(fun c -> - let (c, k) = unpack c in - get_option c k >>=? fun (_, v) -> - return v) + let (c, k) = unpack c in + get_option c k >>=? fun (_, v) -> return v) (register_named_subcontext Raw_context.description N.name) V.encoding - end - end module Wrap_indexed_data_storage - (C : Indexed_data_storage) - (K : sig - type t - val wrap: t -> C.key - val unwrap: C.key -> t option - end) = struct + (C : Indexed_data_storage) (K : sig + type t + + val wrap : t -> C.key + + val unwrap : C.key -> t option + end) = +struct type t = C.t + type context = C.t + type key = K.t + type value = C.value + let mem ctxt k = C.mem ctxt (K.wrap k) + let get ctxt k = C.get ctxt (K.wrap k) + let get_option ctxt k = C.get_option ctxt (K.wrap k) + let set ctxt k v = C.set ctxt (K.wrap k) v + let init ctxt k v = C.init ctxt (K.wrap k) v + let init_set ctxt k v = C.init_set ctxt (K.wrap k) v + let set_option ctxt k v = C.set_option ctxt (K.wrap k) v + let delete ctxt k = C.delete ctxt (K.wrap k) + let remove ctxt k = C.remove ctxt (K.wrap k) + let clear ctxt = C.clear ctxt + let fold ctxt ~init ~f = C.fold ctxt ~init ~f:(fun k v acc -> - match K.unwrap k with - | None -> Lwt.return acc - | Some k -> f k v acc) - let bindings s = - fold s ~init:[] ~f:(fun p v acc -> Lwt.return ((p,v) :: acc)) - let fold_keys s ~init ~f = - C.fold_keys s ~init - ~f:(fun k acc -> - match K.unwrap k with - | None -> Lwt.return acc - | Some k -> f k acc) - let keys s = - fold_keys s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) + match K.unwrap k with None -> Lwt.return acc | Some k -> f k v acc) + let bindings s = + fold s ~init:[] ~f:(fun p v acc -> Lwt.return ((p, v) :: acc)) + + let fold_keys s ~init ~f = + C.fold_keys s ~init ~f:(fun k acc -> + match K.unwrap k with None -> Lwt.return acc | Some k -> f k acc) + + let keys s = fold_keys s ~init:[] ~f:(fun p acc -> Lwt.return (p :: acc)) end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.mli b/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.mli index 6217cb9c0..8a4563741 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/storage_functors.mli @@ -28,61 +28,78 @@ open Storage_sigs module Registered : REGISTER + module Ghost : REGISTER -module Make_subcontext (R : REGISTER) (C : Raw_context.T) (N : NAME) - : Raw_context.T with type t = C.t +module Make_subcontext (R : REGISTER) (C : Raw_context.T) (N : NAME) : + Raw_context.T with type t = C.t module Make_single_data_storage - (R : REGISTER) (C : Raw_context.T) (N : NAME) (V : VALUE) - : Single_data_storage with type t = C.t - and type value = V.t + (R : REGISTER) + (C : Raw_context.T) + (N : NAME) + (V : VALUE) : Single_data_storage with type t = C.t and type value = V.t module type INDEX = sig type t - val path_length: int - val to_path: t -> string list -> string list - val of_path: string list -> t option + + val path_length : int + + val to_path : t -> string list -> string list + + val of_path : string list -> t option + type 'a ipath - val args: ('a, t, 'a ipath) Storage_description.args + + val args : ('a, t, 'a ipath) Storage_description.args end -module Pair(I1 : INDEX)(I2 : INDEX) : INDEX with type t = I1.t * I2.t +module Pair (I1 : INDEX) (I2 : INDEX) : INDEX with type t = I1.t * I2.t -module Make_data_set_storage (C : Raw_context.T) (I : INDEX) - : Data_set_storage with type t = C.t and type elt = I.t +module Make_data_set_storage (C : Raw_context.T) (I : INDEX) : + Data_set_storage with type t = C.t and type elt = I.t -module Make_indexed_data_storage - (C : Raw_context.T) (I : INDEX) (V : VALUE) - : Indexed_data_storage with type t = C.t - and type key = I.t - and type value = V.t +module Make_indexed_data_storage (C : Raw_context.T) (I : INDEX) (V : VALUE) : + Indexed_data_storage + with type t = C.t + and type key = I.t + and type value = V.t module Make_indexed_carbonated_data_storage - (C : Raw_context.T) (I : INDEX) (V : VALUE) - : Non_iterable_indexed_carbonated_data_storage with type t = C.t - and type key = I.t - and type value = V.t + (C : Raw_context.T) + (I : INDEX) + (V : VALUE) : + Non_iterable_indexed_carbonated_data_storage + with type t = C.t + and type key = I.t + and type value = V.t -module Make_indexed_data_snapshotable_storage (C : Raw_context.T) - (Snapshot : INDEX) (I : INDEX) (V : VALUE) - : Indexed_data_snapshotable_storage with type t = C.t - and type snapshot = Snapshot.t - and type key = I.t - and type value = V.t +module Make_indexed_data_snapshotable_storage + (C : Raw_context.T) + (Snapshot : INDEX) + (I : INDEX) + (V : VALUE) : + Indexed_data_snapshotable_storage + with type t = C.t + and type snapshot = Snapshot.t + and type key = I.t + and type value = V.t -module Make_indexed_subcontext (C : Raw_context.T) (I : INDEX) - : Indexed_raw_context with type t = C.t - and type key = I.t - and type 'a ipath = 'a I.ipath +module Make_indexed_subcontext (C : Raw_context.T) (I : INDEX) : + Indexed_raw_context + with type t = C.t + and type key = I.t + and type 'a ipath = 'a I.ipath module Wrap_indexed_data_storage - (C : Indexed_data_storage) - (K : sig - type t - val wrap: t -> C.key - val unwrap: C.key -> t option - end) - : Indexed_data_storage with type t = C.t - and type key = K.t - and type value = C.value + (C : Indexed_data_storage) (K : sig + type t + + val wrap : t -> C.key + + val unwrap : C.key -> t option + end) : + Indexed_data_storage + with type t = C.t + and type key = K.t + and type value = C.value diff --git a/vendors/ligo-utils/tezos-protocol-alpha/storage_sigs.ml b/vendors/ligo-utils/tezos-protocol-alpha/storage_sigs.ml index a637af706..0279d6e99 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/storage_sigs.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/storage_sigs.ml @@ -29,58 +29,57 @@ bound to a specific key in the hierarchical (key x value) database). *) module type Single_data_storage = sig - type t + type context = t (** The type of the value *) type value (** Tells if the data is already defined *) - val mem: context -> bool Lwt.t + val mem : context -> bool Lwt.t (** Retrieve the value from the storage bucket ; returns a {!Storage_error} if the key is not set or if the deserialisation fails *) - val get: context -> value tzresult Lwt.t + val get : context -> value tzresult Lwt.t (** Retrieves the value from the storage bucket ; returns [None] if the data is not initialized, or {!Storage_helpers.Storage_error} if the deserialisation fails *) - val get_option: context -> value option tzresult Lwt.t + val get_option : context -> value option tzresult Lwt.t (** Allocates the storage bucket and initializes it ; returns a {!Storage_error Existing_key} if the bucket exists *) - val init: context -> value -> Raw_context.t tzresult Lwt.t + val init : context -> value -> Raw_context.t tzresult Lwt.t (** Updates the content of the bucket ; returns a {!Storage_Error Missing_key} if the value does not exists *) - val set: context -> value -> Raw_context.t tzresult Lwt.t + val set : context -> value -> Raw_context.t tzresult Lwt.t (** Allocates the data and initializes it with a value ; just updates it if the bucket exists *) - val init_set: context -> value -> Raw_context.t Lwt.t + val init_set : context -> value -> Raw_context.t Lwt.t (** When the value is [Some v], allocates the data and initializes it with [v] ; just updates it if the bucket exists. When the valus is [None], delete the storage bucket when the value ; does nothing if the bucket does not exists. *) - val set_option: context -> value option -> Raw_context.t Lwt.t + val set_option : context -> value option -> Raw_context.t Lwt.t (** Delete the storage bucket ; returns a {!Storage_error Missing_key} if the bucket does not exists *) - val delete: context -> Raw_context.t tzresult Lwt.t + val delete : context -> Raw_context.t tzresult Lwt.t (** Removes the storage bucket and its contents ; does nothing if the bucket does not exists *) - val remove: context -> Raw_context.t Lwt.t - + val remove : context -> Raw_context.t Lwt.t end (** Variant of {!Single_data_storage} with gas accounting. *) module type Single_carbonated_data_storage = sig - type t + type context = t (** The type of the value *) @@ -88,39 +87,40 @@ module type Single_carbonated_data_storage = sig (** Tells if the data is already defined. Consumes [Gas_repr.read_bytes_cost Z.zero]. *) - val mem: context -> (Raw_context.t * bool) tzresult Lwt.t + val mem : context -> (Raw_context.t * bool) tzresult Lwt.t (** Retrieve the value from the storage bucket ; returns a {!Storage_error} if the key is not set or if the deserialisation fails. Consumes [Gas_repr.read_bytes_cost ]. *) - val get: context -> (Raw_context.t * value) tzresult Lwt.t + val get : context -> (Raw_context.t * value) tzresult Lwt.t (** Retrieves the value from the storage bucket ; returns [None] if the data is not initialized, or {!Storage_helpers.Storage_error} if the deserialisation fails. Consumes [Gas_repr.read_bytes_cost ] if present or [Gas_repr.read_bytes_cost Z.zero]. *) - val get_option: context -> (Raw_context.t * value option) tzresult Lwt.t + val get_option : context -> (Raw_context.t * value option) tzresult Lwt.t (** Allocates the storage bucket and initializes it ; returns a {!Storage_error Missing_key} if the bucket exists. Consumes [Gas_repr.write_bytes_cost ]. Returns the size. *) - val init: context -> value -> (Raw_context.t * int) tzresult Lwt.t + val init : context -> value -> (Raw_context.t * int) tzresult Lwt.t (** Updates the content of the bucket ; returns a {!Storage_Error Existing_key} if the value does not exists. Consumes [Gas_repr.write_bytes_cost ]. Returns the difference from the old to the new size. *) - val set: context -> value -> (Raw_context.t * int) tzresult Lwt.t + val set : context -> value -> (Raw_context.t * int) tzresult Lwt.t (** Allocates the data and initializes it with a value ; just updates it if the bucket exists. Consumes [Gas_repr.write_bytes_cost ]. Returns the difference from the old (maybe 0) to the new size, and a boolean indicating if a value was already associated to this key. *) - val init_set: context -> value -> (Raw_context.t * int * bool) tzresult Lwt.t + val init_set : + context -> value -> (Raw_context.t * int * bool) tzresult Lwt.t (** When the value is [Some v], allocates the data and initializes it with [v] ; just updates it if the bucket exists. When the @@ -129,27 +129,27 @@ module type Single_carbonated_data_storage = sig Consumes the same gas cost as either {!remove} or {!init_set}. Returns the difference from the old (maybe 0) to the new size, and a boolean indicating if a value was already associated to this key. *) - val set_option: context -> value option -> (Raw_context.t * int * bool) tzresult Lwt.t + val set_option : + context -> value option -> (Raw_context.t * int * bool) tzresult Lwt.t (** Delete the storage bucket ; returns a {!Storage_error Missing_key} if the bucket does not exists. Consumes [Gas_repr.write_bytes_cost Z.zero]. Returns the freed size. *) - val delete: context -> (Raw_context.t * int) tzresult Lwt.t + val delete : context -> (Raw_context.t * int) tzresult Lwt.t (** Removes the storage bucket and its contents ; does nothing if the bucket does not exists. Consumes [Gas_repr.write_bytes_cost Z.zero]. Returns the freed size, and a boolean indicating if a value was already associated to this key. *) - val remove: context -> (Raw_context.t * int * bool) tzresult Lwt.t - + val remove : context -> (Raw_context.t * int * bool) tzresult Lwt.t end (** Restricted version of {!Indexed_data_storage} w/o iterators. *) module type Non_iterable_indexed_data_storage = sig - type t + type context = t (** An abstract type for keys *) @@ -159,51 +159,50 @@ module type Non_iterable_indexed_data_storage = sig type value (** Tells if a given key is already bound to a storage bucket *) - val mem: context -> key -> bool Lwt.t + val mem : context -> key -> bool Lwt.t (** Retrieve a value from the storage bucket at a given key ; returns {!Storage_error Missing_key} if the key is not set ; returns {!Storage_error Corrupted_data} if the deserialisation fails. *) - val get: context -> key -> value tzresult Lwt.t + val get : context -> key -> value tzresult Lwt.t (** Retrieve a value from the storage bucket at a given key ; returns [None] if the value is not set ; returns {!Storage_error Corrupted_data} if the deserialisation fails. *) - val get_option: context -> key -> value option tzresult Lwt.t + val get_option : context -> key -> value option tzresult Lwt.t (** Updates the content of a bucket ; returns A {!Storage_Error Missing_key} if the value does not exists. *) - val set: context -> key -> value -> Raw_context.t tzresult Lwt.t + val set : context -> key -> value -> Raw_context.t tzresult Lwt.t (** Allocates a storage bucket at the given key and initializes it ; returns a {!Storage_error Existing_key} if the bucket exists. *) - val init: context -> key -> value -> Raw_context.t tzresult Lwt.t + val init : context -> key -> value -> Raw_context.t tzresult Lwt.t (** Allocates a storage bucket at the given key and initializes it with a value ; just updates it if the bucket exists. *) - val init_set: context -> key -> value -> Raw_context.t Lwt.t + val init_set : context -> key -> value -> Raw_context.t Lwt.t (** When the value is [Some v], allocates the data and initializes it with [v] ; just updates it if the bucket exists. When the valus is [None], delete the storage bucket when the value ; does nothing if the bucket does not exists. *) - val set_option: context -> key -> value option -> Raw_context.t Lwt.t + val set_option : context -> key -> value option -> Raw_context.t Lwt.t (** Delete a storage bucket and its contents ; returns a {!Storage_error Missing_key} if the bucket does not exists. *) - val delete: context -> key -> Raw_context.t tzresult Lwt.t + val delete : context -> key -> Raw_context.t tzresult Lwt.t (** Removes a storage bucket and its contents ; does nothing if the bucket does not exists. *) - val remove: context -> key -> Raw_context.t Lwt.t - + val remove : context -> key -> Raw_context.t Lwt.t end (** Variant of {!Non_iterable_indexed_data_storage} with gas accounting. *) module type Non_iterable_indexed_carbonated_data_storage = sig - type t + type context = t (** An abstract type for keys *) @@ -214,35 +213,36 @@ module type Non_iterable_indexed_carbonated_data_storage = sig (** Tells if a given key is already bound to a storage bucket. Consumes [Gas_repr.read_bytes_cost Z.zero]. *) - val mem: context -> key -> (Raw_context.t * bool) tzresult Lwt.t + val mem : context -> key -> (Raw_context.t * bool) tzresult Lwt.t (** Retrieve a value from the storage bucket at a given key ; returns {!Storage_error Missing_key} if the key is not set ; returns {!Storage_error Corrupted_data} if the deserialisation fails. Consumes [Gas_repr.read_bytes_cost ]. *) - val get: context -> key -> (Raw_context.t * value) tzresult Lwt.t + val get : context -> key -> (Raw_context.t * value) tzresult Lwt.t (** Retrieve a value from the storage bucket at a given key ; returns [None] if the value is not set ; returns {!Storage_error Corrupted_data} if the deserialisation fails. Consumes [Gas_repr.read_bytes_cost ] if present or [Gas_repr.read_bytes_cost Z.zero]. *) - val get_option: context -> key -> (Raw_context.t * value option) tzresult Lwt.t + val get_option : + context -> key -> (Raw_context.t * value option) tzresult Lwt.t (** Updates the content of a bucket ; returns A {!Storage_Error Missing_key} if the value does not exists. Consumes serialization cost. Consumes [Gas_repr.write_bytes_cost ]. Returns the difference from the old to the new size. *) - val set: context -> key -> value -> (Raw_context.t * int) tzresult Lwt.t + val set : context -> key -> value -> (Raw_context.t * int) tzresult Lwt.t (** Allocates a storage bucket at the given key and initializes it ; returns a {!Storage_error Existing_key} if the bucket exists. Consumes serialization cost. Consumes [Gas_repr.write_bytes_cost ]. Returns the size. *) - val init: context -> key -> value -> (Raw_context.t * int) tzresult Lwt.t + val init : context -> key -> value -> (Raw_context.t * int) tzresult Lwt.t (** Allocates a storage bucket at the given key and initializes it with a value ; just updates it if the bucket exists. @@ -250,7 +250,8 @@ module type Non_iterable_indexed_carbonated_data_storage = sig Consumes [Gas_repr.write_bytes_cost ]. Returns the difference from the old (maybe 0) to the new size, and a boolean indicating if a value was already associated to this key. *) - val init_set: context -> key -> value -> (Raw_context.t * int * bool) tzresult Lwt.t + val init_set : + context -> key -> value -> (Raw_context.t * int * bool) tzresult Lwt.t (** When the value is [Some v], allocates the data and initializes it with [v] ; just updates it if the bucket exists. When the @@ -260,160 +261,152 @@ module type Non_iterable_indexed_carbonated_data_storage = sig Consumes the same gas cost as either {!remove} or {!init_set}. Returns the difference from the old (maybe 0) to the new size, and a boolean indicating if a value was already associated to this key. *) - val set_option: context -> key -> value option -> (Raw_context.t * int * bool) tzresult Lwt.t + val set_option : + context -> + key -> + value option -> + (Raw_context.t * int * bool) tzresult Lwt.t (** Delete a storage bucket and its contents ; returns a {!Storage_error Missing_key} if the bucket does not exists. Consumes [Gas_repr.write_bytes_cost Z.zero]. Returns the freed size. *) - val delete: context -> key -> (Raw_context.t * int) tzresult Lwt.t + val delete : context -> key -> (Raw_context.t * int) tzresult Lwt.t (** Removes a storage bucket and its contents ; does nothing if the bucket does not exists. Consumes [Gas_repr.write_bytes_cost Z.zero]. Returns the freed size, and a boolean indicating if a value was already associated to this key. *) - val remove: context -> key -> (Raw_context.t * int * bool) tzresult Lwt.t - + val remove : context -> key -> (Raw_context.t * int * bool) tzresult Lwt.t end (** The generic signature of indexed data accessors (a set of values of the same type indexed by keys of the same form in the hierarchical (key x value) database). *) module type Indexed_data_storage = sig - include Non_iterable_indexed_data_storage (** Empties all the keys and associated data. *) - val clear: context -> Raw_context.t Lwt.t + val clear : context -> Raw_context.t Lwt.t (** Lists all the keys. *) - val keys: context -> key list Lwt.t + val keys : context -> key list Lwt.t (** Lists all the keys and associated data. *) - val bindings: context -> (key * value) list Lwt.t + val bindings : context -> (key * value) list Lwt.t (** Iterates over all the keys and associated data. *) - val fold: + val fold : context -> init:'a -> f:(key -> value -> 'a -> 'a Lwt.t) -> 'a Lwt.t (** Iterate over all the keys. *) - val fold_keys: - context -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t - + val fold_keys : context -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t end module type Indexed_data_snapshotable_storage = sig type snapshot + type key include Indexed_data_storage with type key := key - module Snapshot : Indexed_data_storage - with type key = (snapshot * key) - and type value = value - and type t = t + module Snapshot : + Indexed_data_storage + with type key = snapshot * key + and type value = value + and type t = t val snapshot_exists : context -> snapshot -> bool Lwt.t - val snapshot : context -> snapshot -> Raw_context.t tzresult Lwt.t - val delete_snapshot : context -> snapshot -> Raw_context.t Lwt.t + val snapshot : context -> snapshot -> Raw_context.t tzresult Lwt.t + + val delete_snapshot : context -> snapshot -> Raw_context.t Lwt.t end (** The generic signature of a data set accessor (a set of values bound to a specific key prefix in the hierarchical (key x value) database). *) module type Data_set_storage = sig - type t + type context = t (** The type of elements. *) type elt (** Tells if a elt is a member of the set *) - val mem: context -> elt -> bool Lwt.t + val mem : context -> elt -> bool Lwt.t (** Adds a elt is a member of the set *) - val add: context -> elt -> Raw_context.t Lwt.t + val add : context -> elt -> Raw_context.t Lwt.t (** Removes a elt of the set ; does nothing if not a member *) - val del: context -> elt -> Raw_context.t Lwt.t + val del : context -> elt -> Raw_context.t Lwt.t (** Adds/Removes a elt of the set *) - val set: context -> elt -> bool -> Raw_context.t Lwt.t + val set : context -> elt -> bool -> Raw_context.t Lwt.t (** Returns the elements of the set, deserialized in a list in no particular order. *) - val elements: context -> elt list Lwt.t + val elements : context -> elt list Lwt.t (** Iterates over the elements of the set. *) - val fold: context -> init:'a -> f:(elt -> 'a -> 'a Lwt.t) -> 'a Lwt.t + val fold : context -> init:'a -> f:(elt -> 'a -> 'a Lwt.t) -> 'a Lwt.t (** Removes all elements in the set *) - val clear: context -> Raw_context.t Lwt.t - + val clear : context -> Raw_context.t Lwt.t end module type NAME = sig - val name: Raw_context.key + val name : Raw_context.key end module type VALUE = sig type t - val encoding: t Data_encoding.t + + val encoding : t Data_encoding.t end -module type REGISTER = sig val ghost : bool end - -module type Non_iterable_indexed_carbonated_data_storage_with_free = sig - include Non_iterable_indexed_carbonated_data_storage - - (** Only used for 005 migration to avoid gas cost. - Allocates a storage bucket at the given key and initializes it ; - returns a {!Storage_error Existing_key} if the bucket exists. *) - val init_free: context -> key -> value -> (Raw_context.t * int) tzresult Lwt.t - - (** Only used for 005 migration to avoid gas cost. - Updates the content of a bucket ; returns A {!Storage_Error - Missing_key} if the value does not exists. *) - val set_free: context -> key -> value -> (Raw_context.t * int) tzresult Lwt.t +module type REGISTER = sig + val ghost : bool end module type Indexed_raw_context = sig - type t + type context = t + type key + type 'a ipath - val clear: context -> Raw_context.t Lwt.t + val clear : context -> Raw_context.t Lwt.t - val fold_keys: - context -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t - val keys: context -> key list Lwt.t + val fold_keys : context -> init:'a -> f:(key -> 'a -> 'a Lwt.t) -> 'a Lwt.t - val resolve: context -> string list -> key list Lwt.t + val keys : context -> key list Lwt.t - val remove_rec: context -> key -> context Lwt.t + val resolve : context -> string list -> key list Lwt.t - val copy: context -> from:key -> to_:key -> context tzresult Lwt.t + val remove_rec : context -> key -> context Lwt.t - module Make_set (R : REGISTER) (N : NAME) + val copy : context -> from:key -> to_:key -> context tzresult Lwt.t - : Data_set_storage with type t = t - and type elt = key + module Make_set (R : REGISTER) (N : NAME) : + Data_set_storage with type t = t and type elt = key - module Make_map (N : NAME) (V : VALUE) - : Indexed_data_storage with type t = t - and type key = key - and type value = V.t + module Make_map (N : NAME) (V : VALUE) : + Indexed_data_storage + with type t = t + and type key = key + and type value = V.t - module Make_carbonated_map (N : NAME) (V : VALUE) - : Non_iterable_indexed_carbonated_data_storage_with_free with type t = t - and type key = key - and type value = V.t + module Make_carbonated_map (N : NAME) (V : VALUE) : + Non_iterable_indexed_carbonated_data_storage + with type t = t + and type key = key + and type value = V.t module Raw_context : Raw_context.T with type t = t ipath - end diff --git a/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.ml index aa8da3282..364d9347f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.ml @@ -23,11 +23,12 @@ (* *) (*****************************************************************************) -include Qty_repr.Make (struct let id = "tez" end) +include Qty_repr.Make (struct + let id = "tez" +end) type t = qty + type tez = qty -let encoding = - Data_encoding.def "mutez" @@ - encoding +let encoding = Data_encoding.def "mutez" @@ encoding diff --git a/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.mli index 80eb6dbed..8b923658f 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/tez_repr.mli @@ -24,6 +24,7 @@ (*****************************************************************************) type t + type tez = t -include (Qty_repr.S with type qty := t) +include Qty_repr.S with type qty := t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/time_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/time_repr.ml index 1709ca358..8a79c9973 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/time_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/time_repr.ml @@ -24,9 +24,11 @@ (*****************************************************************************) include Time + type time = t type error += Timestamp_add (* `Permanent *) + type error += Timestamp_sub (* `Permanent *) let () = @@ -35,34 +37,30 @@ let () = ~id:"timestamp_add" ~title:"Timestamp add" ~description:"Overflow when adding timestamps." - ~pp:(fun ppf () -> - Format.fprintf ppf "Overflow when adding timestamps.") + ~pp:(fun ppf () -> Format.fprintf ppf "Overflow when adding timestamps.") Data_encoding.empty (function Timestamp_add -> Some () | _ -> None) - (fun () -> Timestamp_add); + (fun () -> Timestamp_add) ; register_error_kind `Permanent ~id:"timestamp_sub" ~title:"Timestamp sub" ~description:"Substracting timestamps resulted in negative period." ~pp:(fun ppf () -> - Format.fprintf ppf "Substracting timestamps resulted in negative period.") + Format.fprintf ppf "Substracting timestamps resulted in negative period.") Data_encoding.empty (function Timestamp_sub -> Some () | _ -> None) (fun () -> Timestamp_sub) -let of_seconds s = - try Some (of_seconds (Int64.of_string s)) - with _ -> None +let of_seconds s = try Some (of_seconds (Int64.of_string s)) with _ -> None + let to_seconds = to_seconds + let to_seconds_string s = Int64.to_string (to_seconds s) let pp = pp_hum -let (+?) x y = - try ok (add x (Period_repr.to_seconds y)) - with _exn -> error Timestamp_add +let ( +? ) x y = + try ok (add x (Period_repr.to_seconds y)) with _exn -> error Timestamp_add -let (-?) x y = - record_trace Timestamp_sub - (Period_repr.of_seconds (diff x y)) +let ( -? ) x y = record_trace Timestamp_sub (Period_repr.of_seconds (diff x y)) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/time_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/time_repr.mli index 3cb96922f..e1ef22521 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/time_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/time_repr.mli @@ -23,13 +23,18 @@ (* *) (*****************************************************************************) -include module type of (struct include Time end) +include module type of struct + include Time +end + type time = t -val pp: Format.formatter -> t -> unit -val of_seconds: string -> time option -val to_seconds_string: time -> string +val pp : Format.formatter -> t -> unit -val (+?) : time -> Period_repr.t -> time tzresult -val (-?) : time -> time -> Period_repr.t tzresult +val of_seconds : string -> time option +val to_seconds_string : time -> string + +val ( +? ) : time -> Period_repr.t -> time tzresult + +val ( -? ) : time -> time -> Period_repr.t tzresult diff --git a/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.ml index 64e01f7ca..4fb0b82d9 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.ml @@ -29,22 +29,18 @@ type ballot = Yay | Nay | Pass let ballot_encoding = let of_int8 = function - | 0 -> Yay - | 1 -> Nay - | 2 -> Pass - | _ -> invalid_arg "ballot_of_int8" - in - let to_int8 = function - | Yay -> 0 - | Nay -> 1 - | Pass -> 2 + | 0 -> + Yay + | 1 -> + Nay + | 2 -> + Pass + | _ -> + invalid_arg "ballot_of_int8" in + let to_int8 = function Yay -> 0 | Nay -> 1 | Pass -> 2 in let open Data_encoding in (* union *) splitted - ~binary: (conv to_int8 of_int8 int8) - ~json: (string_enum [ - "yay", Yay ; - "nay", Nay ; - "pass", Pass ; - ]) + ~binary:(conv to_int8 of_int8 int8) + ~json:(string_enum [("yay", Yay); ("nay", Nay); ("pass", Pass)]) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.mli index ad83b08f0..8a7d4a59b 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/vote_repr.mli @@ -29,4 +29,5 @@ type proposal = Protocol_hash.t (** votes can be for, against or neutral. Neutral serves to count towards a quorum *) type ballot = Yay | Nay | Pass -val ballot_encoding: ballot Data_encoding.t + +val ballot_encoding : ballot Data_encoding.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.ml b/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.ml index d5e901321..14aef58cd 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.ml @@ -24,124 +24,133 @@ (*****************************************************************************) let recorded_proposal_count_for_delegate ctxt proposer = - Storage.Vote.Proposals_count.get_option ctxt proposer >>=? function - | None -> return 0 - | Some count -> return count + Storage.Vote.Proposals_count.get_option ctxt proposer + >>=? function None -> return 0 | Some count -> return count let record_proposal ctxt proposal proposer = - recorded_proposal_count_for_delegate ctxt proposer >>=? fun count -> - Storage.Vote.Proposals_count.init_set ctxt proposer (count + 1) >>= fun ctxt -> - Storage.Vote.Proposals.add ctxt (proposal, proposer) >>= fun ctxt -> - return ctxt + recorded_proposal_count_for_delegate ctxt proposer + >>=? fun count -> + Storage.Vote.Proposals_count.init_set ctxt proposer (count + 1) + >>= fun ctxt -> + Storage.Vote.Proposals.add ctxt (proposal, proposer) + >>= fun ctxt -> return ctxt let get_proposals ctxt = - Storage.Vote.Proposals.fold ctxt + Storage.Vote.Proposals.fold + ctxt ~init:(ok Protocol_hash.Map.empty) ~f:(fun (proposal, delegate) acc -> - (* Assuming the same listings is used at votings *) - Storage.Vote.Listings.get ctxt delegate >>=? fun weight -> - Lwt.return begin acc >>? fun acc -> - let previous = - match Protocol_hash.Map.find_opt proposal acc with - | None -> 0l - | Some x -> x - in - ok (Protocol_hash.Map.add proposal (Int32.add weight previous) acc) - end) + (* Assuming the same listings is used at votings *) + Storage.Vote.Listings.get ctxt delegate + >>=? fun weight -> + Lwt.return + ( acc + >>? fun acc -> + let previous = + match Protocol_hash.Map.find_opt proposal acc with + | None -> + 0l + | Some x -> + x + in + ok (Protocol_hash.Map.add proposal (Int32.add weight previous) acc) )) let clear_proposals ctxt = - Storage.Vote.Proposals_count.clear ctxt >>= fun ctxt -> - Storage.Vote.Proposals.clear ctxt + Storage.Vote.Proposals_count.clear ctxt + >>= fun ctxt -> Storage.Vote.Proposals.clear ctxt -type ballots = { - yay: int32 ; - nay: int32 ; - pass: int32 ; -} +type ballots = {yay : int32; nay : int32; pass : int32} let ballots_encoding = let open Data_encoding in conv - (fun { yay ; nay ; pass } -> ( yay , nay , pass )) - (fun ( yay , nay , pass ) -> { yay ; nay ; pass }) - @@ obj3 - (req "yay" int32) - (req "nay" int32) - (req "pass" int32) + (fun {yay; nay; pass} -> (yay, nay, pass)) + (fun (yay, nay, pass) -> {yay; nay; pass}) + @@ obj3 (req "yay" int32) (req "nay" int32) (req "pass" int32) let has_recorded_ballot = Storage.Vote.Ballots.mem + let record_ballot = Storage.Vote.Ballots.init let get_ballots ctxt = - Storage.Vote.Ballots.fold ctxt - ~f:(fun delegate ballot (ballots: ballots tzresult) -> - (* Assuming the same listings is used at votings *) - Storage.Vote.Listings.get ctxt delegate >>=? fun weight -> - let count = Int32.add weight in - Lwt.return begin - ballots >>? fun ballots -> - match ballot with - | Yay -> ok { ballots with yay = count ballots.yay } - | Nay -> ok { ballots with nay = count ballots.nay } - | Pass -> ok { ballots with pass = count ballots.pass } - end) - ~init:(ok { yay = 0l ; nay = 0l; pass = 0l }) + Storage.Vote.Ballots.fold + ctxt + ~f:(fun delegate ballot (ballots : ballots tzresult) -> + (* Assuming the same listings is used at votings *) + Storage.Vote.Listings.get ctxt delegate + >>=? fun weight -> + let count = Int32.add weight in + Lwt.return + ( ballots + >>? fun ballots -> + match ballot with + | Yay -> + ok {ballots with yay = count ballots.yay} + | Nay -> + ok {ballots with nay = count ballots.nay} + | Pass -> + ok {ballots with pass = count ballots.pass} )) + ~init:(ok {yay = 0l; nay = 0l; pass = 0l}) let get_ballot_list = Storage.Vote.Ballots.bindings let clear_ballots = Storage.Vote.Ballots.clear let listings_encoding = - Data_encoding.(list (obj2 - (req "pkh" Signature.Public_key_hash.encoding) - (req "rolls" int32))) + Data_encoding.( + list + (obj2 (req "pkh" Signature.Public_key_hash.encoding) (req "rolls" int32))) let freeze_listings ctxt = - Roll_storage.fold ctxt (ctxt, 0l) - ~f:(fun _roll delegate (ctxt, total) -> - (* TODO use snapshots *) - let delegate = Signature.Public_key.hash delegate in - begin - Storage.Vote.Listings.get_option ctxt delegate >>=? function - | None -> return 0l - | Some count -> return count - end >>=? fun count -> - Storage.Vote.Listings.init_set - ctxt delegate (Int32.succ count) >>= fun ctxt -> - return (ctxt, Int32.succ total)) >>=? fun (ctxt, total) -> - Storage.Vote.Listings_size.init ctxt total >>=? fun ctxt -> - return ctxt + Roll_storage.fold ctxt (ctxt, 0l) ~f:(fun _roll delegate (ctxt, total) -> + (* TODO use snapshots *) + let delegate = Signature.Public_key.hash delegate in + Storage.Vote.Listings.get_option ctxt delegate + >>=? (function None -> return 0l | Some count -> return count) + >>=? fun count -> + Storage.Vote.Listings.init_set ctxt delegate (Int32.succ count) + >>= fun ctxt -> return (ctxt, Int32.succ total)) + >>=? fun (ctxt, total) -> + Storage.Vote.Listings_size.init ctxt total >>=? fun ctxt -> return ctxt let listing_size = Storage.Vote.Listings_size.get + let in_listings = Storage.Vote.Listings.mem + let get_listings = Storage.Vote.Listings.bindings let clear_listings ctxt = - Storage.Vote.Listings.clear ctxt >>= fun ctxt -> - Storage.Vote.Listings_size.remove ctxt >>= fun ctxt -> - return ctxt + Storage.Vote.Listings.clear ctxt + >>= fun ctxt -> + Storage.Vote.Listings_size.remove ctxt >>= fun ctxt -> return ctxt let get_current_period_kind = Storage.Vote.Current_period_kind.get + let set_current_period_kind = Storage.Vote.Current_period_kind.set let get_current_quorum ctxt = - Storage.Vote.Participation_ema.get ctxt >>=? fun participation_ema -> + Storage.Vote.Participation_ema.get ctxt + >>=? fun participation_ema -> let quorum_min = Constants_storage.quorum_min ctxt in let quorum_max = Constants_storage.quorum_max ctxt in let quorum_diff = Int32.sub quorum_max quorum_min in - return Int32.(add quorum_min - (div (mul participation_ema quorum_diff) 100_00l)) + return + Int32.(add quorum_min (div (mul participation_ema quorum_diff) 100_00l)) let get_participation_ema = Storage.Vote.Participation_ema.get + let set_participation_ema = Storage.Vote.Participation_ema.set let get_current_proposal = Storage.Vote.Current_proposal.get + let init_current_proposal = Storage.Vote.Current_proposal.init + let clear_current_proposal = Storage.Vote.Current_proposal.delete let init ctxt = (* participation EMA is in centile of a percentage *) let participation_ema = Constants_storage.quorum_max ctxt in - Storage.Vote.Participation_ema.init ctxt participation_ema >>=? fun ctxt -> - Storage.Vote.Current_period_kind.init ctxt Proposal >>=? fun ctxt -> - return ctxt + Storage.Vote.Participation_ema.init ctxt participation_ema + >>=? fun ctxt -> + Storage.Vote.Current_period_kind.init ctxt Proposal + >>=? fun ctxt -> return ctxt diff --git a/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.mli b/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.mli index 6606bbb83..51dd59f2e 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/vote_storage.mli @@ -26,73 +26,81 @@ (** Manages all the voting related storage in Storage.Vote. *) (** Records a protocol proposal with the delegate that proposed it. *) -val record_proposal: - Raw_context.t -> Protocol_hash.t -> Signature.Public_key_hash.t -> +val record_proposal : + Raw_context.t -> + Protocol_hash.t -> + Signature.Public_key_hash.t -> Raw_context.t tzresult Lwt.t -val recorded_proposal_count_for_delegate: - Raw_context.t -> Signature.Public_key_hash.t -> - int tzresult Lwt.t +val recorded_proposal_count_for_delegate : + Raw_context.t -> Signature.Public_key_hash.t -> int tzresult Lwt.t (** Computes for each proposal how many delegates proposed it. *) -val get_proposals: - Raw_context.t -> int32 Protocol_hash.Map.t tzresult Lwt.t +val get_proposals : Raw_context.t -> int32 Protocol_hash.Map.t tzresult Lwt.t -val clear_proposals: Raw_context.t -> Raw_context.t Lwt.t +val clear_proposals : Raw_context.t -> Raw_context.t Lwt.t (** Counts of the votes *) -type ballots = { - yay: int32 ; - nay: int32 ; - pass: int32 ; -} +type ballots = {yay : int32; nay : int32; pass : int32} val ballots_encoding : ballots Data_encoding.t -val has_recorded_ballot : Raw_context.t -> Signature.Public_key_hash.t -> bool Lwt.t +val has_recorded_ballot : + Raw_context.t -> Signature.Public_key_hash.t -> bool Lwt.t (** Records a vote for a delegate, returns a {!Storage_error Existing_key} if the vote was already registered *) -val record_ballot: - Raw_context.t -> Signature.Public_key_hash.t -> Vote_repr.ballot -> +val record_ballot : + Raw_context.t -> + Signature.Public_key_hash.t -> + Vote_repr.ballot -> Raw_context.t tzresult Lwt.t (** Computes the sum of the current ballots weighted by stake. *) -val get_ballots: Raw_context.t -> ballots tzresult Lwt.t +val get_ballots : Raw_context.t -> ballots tzresult Lwt.t + val get_ballot_list : Raw_context.t -> (Signature.Public_key_hash.t * Vote_repr.ballot) list Lwt.t -val clear_ballots: Raw_context.t -> Raw_context.t Lwt.t -val listings_encoding : (Signature.Public_key_hash.t * int32) list Data_encoding.t +val clear_ballots : Raw_context.t -> Raw_context.t Lwt.t + +val listings_encoding : + (Signature.Public_key_hash.t * int32) list Data_encoding.t (** Populates [!Storage.Vote.Listings] using the currently existing rolls and sets Listings_size. Delegates without rolls are not included in the listing. *) -val freeze_listings: Raw_context.t -> Raw_context.t tzresult Lwt.t -val clear_listings: Raw_context.t -> Raw_context.t tzresult Lwt.t +val freeze_listings : Raw_context.t -> Raw_context.t tzresult Lwt.t + +val clear_listings : Raw_context.t -> Raw_context.t tzresult Lwt.t (** Returns the sum of all rolls of all delegates. *) -val listing_size: Raw_context.t -> int32 tzresult Lwt.t +val listing_size : Raw_context.t -> int32 tzresult Lwt.t (** Verifies the presence of a delegate in the listing. *) -val in_listings: - Raw_context.t -> Signature.Public_key_hash.t -> bool Lwt.t -val get_listings : Raw_context.t -> (Signature.Public_key_hash.t * int32) list Lwt.t +val in_listings : Raw_context.t -> Signature.Public_key_hash.t -> bool Lwt.t -val get_current_quorum: Raw_context.t -> int32 tzresult Lwt.t +val get_listings : + Raw_context.t -> (Signature.Public_key_hash.t * int32) list Lwt.t -val get_participation_ema: Raw_context.t -> int32 tzresult Lwt.t -val set_participation_ema: Raw_context.t -> int32 -> Raw_context.t tzresult Lwt.t +val get_current_quorum : Raw_context.t -> int32 tzresult Lwt.t -val get_current_period_kind: +val get_participation_ema : Raw_context.t -> int32 tzresult Lwt.t + +val set_participation_ema : + Raw_context.t -> int32 -> Raw_context.t tzresult Lwt.t + +val get_current_period_kind : Raw_context.t -> Voting_period_repr.kind tzresult Lwt.t -val set_current_period_kind: + +val set_current_period_kind : Raw_context.t -> Voting_period_repr.kind -> Raw_context.t tzresult Lwt.t -val get_current_proposal: - Raw_context.t -> Protocol_hash.t tzresult Lwt.t -val init_current_proposal: +val get_current_proposal : Raw_context.t -> Protocol_hash.t tzresult Lwt.t + +val init_current_proposal : Raw_context.t -> Protocol_hash.t -> Raw_context.t tzresult Lwt.t -val clear_current_proposal: Raw_context.t -> Raw_context.t tzresult Lwt.t + +val clear_current_proposal : Raw_context.t -> Raw_context.t tzresult Lwt.t (** Sets the initial quorum to 80% and period kind to proposal. *) -val init: Raw_context.t -> Raw_context.t tzresult Lwt.t +val init : Raw_context.t -> Raw_context.t tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.ml b/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.ml index 8124e10a0..42a91a530 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.ml @@ -24,59 +24,68 @@ (*****************************************************************************) type t = int32 + type voting_period = t + include (Compare.Int32 : Compare.S with type t := t) + let encoding = Data_encoding.int32 + let pp ppf level = Format.fprintf ppf "%ld" level + let rpc_arg = let construct voting_period = Int32.to_string voting_period in let destruct str = match Int32.of_string str with - | exception _ -> Error "Cannot parse voting period" - | voting_period -> Ok voting_period in + | exception _ -> + Error "Cannot parse voting period" + | voting_period -> + Ok voting_period + in RPC_arg.make ~descr:"A voting period" - ~name: "voting_period" + ~name:"voting_period" ~construct ~destruct () let root = 0l + let succ = Int32.succ let to_int32 l = l + let of_int32_exn l = - if Compare.Int32.(l >= 0l) - then l + if Compare.Int32.(l >= 0l) then l else invalid_arg "Voting_period_repr.of_int32" -type kind = - | Proposal - | Testing_vote - | Testing - | Promotion_vote +type kind = Proposal | Testing_vote | Testing | Promotion_vote let kind_encoding = let open Data_encoding in - union ~tag_size:`Uint8 [ - case (Tag 0) - ~title:"Proposal" - (constant "proposal") - (function Proposal -> Some () | _ -> None) - (fun () -> Proposal) ; - case (Tag 1) - ~title:"Testing_vote" - (constant "testing_vote") - (function Testing_vote -> Some () | _ -> None) - (fun () -> Testing_vote) ; - case (Tag 2) - ~title:"Testing" - (constant "testing") - (function Testing -> Some () | _ -> None) - (fun () -> Testing) ; - case (Tag 3) - ~title:"Promotion_vote" - (constant "promotion_vote") - (function Promotion_vote -> Some () | _ -> None) - (fun () -> Promotion_vote) ; - ] + union + ~tag_size:`Uint8 + [ case + (Tag 0) + ~title:"Proposal" + (constant "proposal") + (function Proposal -> Some () | _ -> None) + (fun () -> Proposal); + case + (Tag 1) + ~title:"Testing_vote" + (constant "testing_vote") + (function Testing_vote -> Some () | _ -> None) + (fun () -> Testing_vote); + case + (Tag 2) + ~title:"Testing" + (constant "testing") + (function Testing -> Some () | _ -> None) + (fun () -> Testing); + case + (Tag 3) + ~title:"Promotion_vote" + (constant "promotion_vote") + (function Promotion_vote -> Some () | _ -> None) + (fun () -> Promotion_vote) ] diff --git a/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.mli b/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.mli index cabe40c99..e22ecd804 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/voting_period_repr.mli @@ -27,22 +27,29 @@ since the root. *) type t + type voting_period = t -val encoding: voting_period Data_encoding.t -val rpc_arg: voting_period RPC_arg.arg -val pp: Format.formatter -> voting_period -> unit + +val encoding : voting_period Data_encoding.t + +val rpc_arg : voting_period RPC_arg.arg + +val pp : Format.formatter -> voting_period -> unit + include Compare.S with type t := voting_period -val to_int32: voting_period -> int32 -val of_int32_exn: int32 -> voting_period +val to_int32 : voting_period -> int32 -val root: voting_period -val succ: voting_period -> voting_period +val of_int32_exn : int32 -> voting_period + +val root : voting_period + +val succ : voting_period -> voting_period type kind = - | Proposal (** protocols can be proposed *) - | Testing_vote (** a proposal can be voted *) - | Testing (** winning proposal is forked on a testnet *) - | Promotion_vote (** activation can be voted *) + | Proposal (** protocols can be proposed *) + | Testing_vote (** a proposal can be voted *) + | Testing (** winning proposal is forked on a testnet *) + | Promotion_vote (** activation can be voted *) -val kind_encoding: kind Data_encoding.t +val kind_encoding : kind Data_encoding.t diff --git a/vendors/ligo-utils/tezos-protocol-alpha/voting_services.ml b/vendors/ligo-utils/tezos-protocol-alpha/voting_services.ml index 37220bdc8..5d7ea1635 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/voting_services.ml +++ b/vendors/ligo-utils/tezos-protocol-alpha/voting_services.ml @@ -26,98 +26,85 @@ open Alpha_context module S = struct - let path = RPC_path.(open_root / "votes") let ballots = RPC_service.get_service ~description:"Sum of ballots casted so far during a voting period." - ~query: RPC_query.empty - ~output: Vote.ballots_encoding + ~query:RPC_query.empty + ~output:Vote.ballots_encoding RPC_path.(path / "ballots") let ballot_list = RPC_service.get_service ~description:"Ballots casted so far during a voting period." - ~query: RPC_query.empty - ~output: Data_encoding.(list (obj2 - (req "pkh" Signature.Public_key_hash.encoding) - (req "ballot" Vote.ballot_encoding))) + ~query:RPC_query.empty + ~output: + Data_encoding.( + list + (obj2 + (req "pkh" Signature.Public_key_hash.encoding) + (req "ballot" Vote.ballot_encoding))) RPC_path.(path / "ballot_list") let current_period_kind = RPC_service.get_service ~description:"Current period kind." - ~query: RPC_query.empty - ~output: Voting_period.kind_encoding + ~query:RPC_query.empty + ~output:Voting_period.kind_encoding RPC_path.(path / "current_period_kind") let current_quorum = RPC_service.get_service ~description:"Current expected quorum." - ~query: RPC_query.empty - ~output: Data_encoding.int32 + ~query:RPC_query.empty + ~output:Data_encoding.int32 RPC_path.(path / "current_quorum") let listings = RPC_service.get_service - ~description:"List of delegates with their voting weight, in number of rolls." - ~query: RPC_query.empty - ~output: Vote.listings_encoding + ~description: + "List of delegates with their voting weight, in number of rolls." + ~query:RPC_query.empty + ~output:Vote.listings_encoding RPC_path.(path / "listings") let proposals = RPC_service.get_service ~description:"List of proposals with number of supporters." - ~query: RPC_query.empty - ~output: (Protocol_hash.Map.encoding Data_encoding.int32) + ~query:RPC_query.empty + ~output:(Protocol_hash.Map.encoding Data_encoding.int32) RPC_path.(path / "proposals") let current_proposal = RPC_service.get_service ~description:"Current proposal under evaluation." - ~query: RPC_query.empty - ~output: (Data_encoding.option Protocol_hash.encoding) + ~query:RPC_query.empty + ~output:(Data_encoding.option Protocol_hash.encoding) RPC_path.(path / "current_proposal") end let register () = let open Services_registration in + register0 S.ballots (fun ctxt () () -> Vote.get_ballots ctxt) ; + register0 S.ballot_list (fun ctxt () () -> Vote.get_ballot_list ctxt >|= ok) ; + register0 S.current_period_kind (fun ctxt () () -> + Vote.get_current_period_kind ctxt) ; + register0 S.current_quorum (fun ctxt () () -> Vote.get_current_quorum ctxt) ; + register0 S.proposals (fun ctxt () () -> Vote.get_proposals ctxt) ; + register0 S.listings (fun ctxt () () -> Vote.get_listings ctxt >|= ok) ; + register0 S.current_proposal (fun ctxt () () -> + (* this would be better implemented using get_option in get_current_proposal *) + Vote.get_current_proposal ctxt + >>= function + | Ok p -> + return_some p + | Error (Raw_context.Storage_error (Missing_key _) :: _) -> + return_none + | Error _ as e -> + Lwt.return e) - register0 S.ballots begin fun ctxt () () -> - Vote.get_ballots ctxt - end; - - register0 S.ballot_list begin fun ctxt () () -> - Vote.get_ballot_list ctxt >|= ok - end; - - register0 S.current_period_kind begin fun ctxt () () -> - Vote.get_current_period_kind ctxt - end; - - register0 S.current_quorum begin fun ctxt () () -> - Vote.get_current_quorum ctxt - end; - - register0 S.proposals begin fun ctxt () () -> - Vote.get_proposals ctxt - end; - - register0 S.listings begin fun ctxt () () -> - Vote.get_listings ctxt >|= ok - end; - - register0 S.current_proposal begin fun ctxt () () -> - (* this would be better implemented using get_option in get_current_proposal *) - Vote.get_current_proposal ctxt >>= function - | Ok p -> return_some p - | Error (Raw_context.Storage_error (Missing_key _) :: _) -> return_none - | Error _ as e -> Lwt.return e - end - -let ballots ctxt block = - RPC_context.make_call0 S.ballots ctxt block () () +let ballots ctxt block = RPC_context.make_call0 S.ballots ctxt block () () let ballot_list ctxt block = RPC_context.make_call0 S.ballot_list ctxt block () () @@ -128,11 +115,9 @@ let current_period_kind ctxt block = let current_quorum ctxt block = RPC_context.make_call0 S.current_quorum ctxt block () () -let listings ctxt block = - RPC_context.make_call0 S.listings ctxt block () () +let listings ctxt block = RPC_context.make_call0 S.listings ctxt block () () -let proposals ctxt block = - RPC_context.make_call0 S.proposals ctxt block () () +let proposals ctxt block = RPC_context.make_call0 S.proposals ctxt block () () let current_proposal ctxt block = RPC_context.make_call0 S.current_proposal ctxt block () () diff --git a/vendors/ligo-utils/tezos-protocol-alpha/voting_services.mli b/vendors/ligo-utils/tezos-protocol-alpha/voting_services.mli index 0cb4599d7..4c5742e31 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/voting_services.mli +++ b/vendors/ligo-utils/tezos-protocol-alpha/voting_services.mli @@ -25,11 +25,12 @@ open Alpha_context -val ballots : - 'a #RPC_context.simple -> 'a -> Vote.ballots shell_tzresult Lwt.t +val ballots : 'a #RPC_context.simple -> 'a -> Vote.ballots shell_tzresult Lwt.t val ballot_list : - 'a #RPC_context.simple -> 'a -> (Signature.Public_key_hash.t * Vote.ballot) list shell_tzresult Lwt.t + 'a #RPC_context.simple -> + 'a -> + (Signature.Public_key_hash.t * Vote.ballot) list shell_tzresult Lwt.t val current_period_kind : 'a #RPC_context.simple -> 'a -> Voting_period.kind shell_tzresult Lwt.t @@ -38,10 +39,14 @@ val current_quorum : 'a #RPC_context.simple -> 'a -> Int32.t shell_tzresult Lwt.t val listings : - 'a #RPC_context.simple -> 'a -> (Signature.Public_key_hash.t * int32) list shell_tzresult Lwt.t + 'a #RPC_context.simple -> + 'a -> + (Signature.Public_key_hash.t * int32) list shell_tzresult Lwt.t val proposals : - 'a #RPC_context.simple -> 'a -> Int32.t Protocol_hash.Map.t shell_tzresult Lwt.t + 'a #RPC_context.simple -> + 'a -> + Int32.t Protocol_hash.Map.t shell_tzresult Lwt.t val current_proposal : 'a #RPC_context.simple -> 'a -> Protocol_hash.t option shell_tzresult Lwt.t diff --git a/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.ml b/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.ml index 1fc947f5b..fb007acc3 100644 --- a/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.ml +++ b/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2019 Nomadic Labs *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -23,228 +24,303 @@ (* *) (*****************************************************************************) +(* open Protocol_client_context *) open Tezos_micheline open Micheline - module IntMap = Map.Make (Compare.Int) type 'l node = ('l, string) Micheline.node type error += Unexpected_macro_annotation of string + type error += Sequence_expected of string + type error += Invalid_arity of string * int * int let rec check_letters str i j f = - i > j || f (String.get str i) && check_letters str (i + 1) j f + i > j || (f str.[i] && check_letters str (i + 1) j f) let expand_caddadr original = match original with | Prim (loc, str, args, annot) -> let len = String.length str in - if len > 3 - && String.get str 0 = 'C' - && String.get str (len - 1) = 'R' - && check_letters str 1 (len - 2) - (function 'A' | 'D' -> true | _ -> false) then - begin match args with - | [] -> ok () - | _ :: _ -> error (Invalid_arity (str, List.length args, 0)) - end >>? fun () -> - let rec parse i annot acc = - if i = 0 then - Seq (loc, acc) + if + len > 3 + && str.[0] = 'C' + && str.[len - 1] = 'R' + && check_letters str 1 (len - 2) (function + | 'A' | 'D' -> + true + | _ -> + false) + then + ( match args with + | [] -> + ok () + | _ :: _ -> + error (Invalid_arity (str, List.length args, 0)) ) + >>? fun () -> + let path_annot = + List.filter (function "@%" | "@%%" -> true | _ -> false) annot + in + let rec parse i acc = + if i = 0 then Seq (loc, acc) else - let annot = if i = len - 2 then annot else [] in - match String.get str i with - | 'A' -> parse (i - 1) [] (Prim (loc, "CAR", [], annot) :: acc) - | 'D' -> parse (i - 1) [] (Prim (loc, "CDR", [], annot) :: acc) - | _ -> assert false in - ok (Some (parse (len - 2) annot [])) - else - ok None - | _ -> ok None - -let extract_first_annot annot char = - let rec extract_first_annot others = function - | [] -> None, List.rev others - | a :: rest -> - try - if a.[0] = char - then Some a, List.rev_append others rest - else extract_first_annot (a :: others) rest - with Invalid_argument _ -> extract_first_annot (a :: others) rest - in - extract_first_annot [] annot - -let extract_first_field_annot annot = extract_first_annot annot '%' -let extract_first_var_annot annot = extract_first_annot annot '@' + let annot = if i = len - 2 then annot else path_annot in + match str.[i] with + | 'A' -> + parse (i - 1) (Prim (loc, "CAR", [], annot) :: acc) + | 'D' -> + parse (i - 1) (Prim (loc, "CDR", [], annot) :: acc) + | _ -> + assert false + in + ok (Some (parse (len - 2) [])) + else ok None + | _ -> + ok None let extract_field_annots annot = - List.partition (fun a -> + List.partition + (fun a -> match a.[0] with - | '%' -> true - | _ -> false - | exception Invalid_argument _ -> false - ) annot + | '%' -> + true + | _ -> + false + | exception Invalid_argument _ -> + false) + annot let expand_set_caddadr original = match original with | Prim (loc, str, args, annot) -> let len = String.length str in - if len >= 7 - && String.sub str 0 5 = "SET_C" - && String.get str (len - 1) = 'R' - && check_letters str 5 (len - 2) - (function 'A' | 'D' -> true | _ -> false) then - begin match args with - | [] -> ok () - | _ :: _ -> error (Invalid_arity (str, List.length args, 0)) - end >>? fun () -> - begin match extract_field_annots annot with - | [], annot -> ok (None, annot) - | [f], annot -> ok (Some f, annot) - | _, _ -> error (Unexpected_macro_annotation str) - end >>? fun (field_annot, annot) -> + if + len >= 7 + && String.sub str 0 5 = "SET_C" + && str.[len - 1] = 'R' + && check_letters str 5 (len - 2) (function + | 'A' | 'D' -> + true + | _ -> + false) + then + ( match args with + | [] -> + ok () + | _ :: _ -> + error (Invalid_arity (str, List.length args, 0)) ) + >>? fun () -> + ( match extract_field_annots annot with + | ([], annot) -> + ok (None, annot) + | ([f], annot) -> + ok (Some f, annot) + | (_, _) -> + error (Unexpected_macro_annotation str) ) + >>? fun (field_annot, annot) -> let rec parse i acc = - if i = 4 then - acc + if i = 4 then acc else let annot = if i = 5 then annot else [] in - match String.get str i with + match str.[i] with | 'A' -> let acc = - Seq (loc, - [ Prim (loc, "DUP", [], []) ; - Prim (loc, "DIP", - [ Seq (loc, - [ Prim (loc, "CAR", [], [ "@%%" ]) ; - acc ]) ], []) ; - Prim (loc, "CDR", [], [ "@%%" ]) ; - Prim (loc, "SWAP", [], []) ; - Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ]) in + Seq + ( loc, + [ Prim (loc, "DUP", [], []); + Prim + ( loc, + "DIP", + [Seq (loc, [Prim (loc, "CAR", [], ["@%%"]); acc])], + [] ); + Prim (loc, "CDR", [], ["@%%"]); + Prim (loc, "SWAP", [], []); + Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ] ) + in parse (i - 1) acc | 'D' -> let acc = - Seq (loc, - [ Prim (loc, "DUP", [], []) ; - Prim (loc, "DIP", - [ Seq (loc, - [ Prim (loc, "CDR", [], [ "@%%" ]) ; - acc ]) ], []) ; - Prim (loc, "CAR", [], [ "@%%" ]) ; - Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ]) in + Seq + ( loc, + [ Prim (loc, "DUP", [], []); + Prim + ( loc, + "DIP", + [Seq (loc, [Prim (loc, "CDR", [], ["@%%"]); acc])], + [] ); + Prim (loc, "CAR", [], ["@%%"]); + Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ] ) + in parse (i - 1) acc - | _ -> assert false in - match String.get str (len - 2) with + | _ -> + assert false + in + match str.[len - 2] with | 'A' -> - let access_check = match field_annot with - | None -> [] - | Some f -> [ Prim (loc, "DUP", [], []) ; - Prim (loc, "CAR", [], [ f ]) ; - Prim (loc, "DROP", [], []) ; - ] in - let encoding = [ Prim (loc, "CDR", [], [ "@%%" ]) ; - Prim (loc, "SWAP", [], []) ] in - let pair = [ Prim (loc, "PAIR", [], - [ Option.unopt field_annot ~default:"%" ; "%@" ]) ] in + let access_check = + match field_annot with + | None -> + [] + | Some f -> + [ Prim (loc, "DUP", [], []); + Prim (loc, "CAR", [], [f]); + Prim (loc, "DROP", [], []) ] + in + let encoding = + [Prim (loc, "CDR", [], ["@%%"]); Prim (loc, "SWAP", [], [])] + in + let pair = + [ Prim + ( loc, + "PAIR", + [], + [Option.unopt field_annot ~default:"%"; "%@"] ) ] + in let init = Seq (loc, access_check @ encoding @ pair) in ok (Some (parse (len - 3) init)) | 'D' -> - let access_check = match field_annot with - | None -> [] - | Some f -> [ Prim (loc, "DUP", [], []) ; - Prim (loc, "CDR", [], [ f ]) ; - Prim (loc, "DROP", [], []) ; - ] in - let encoding = [ Prim (loc, "CAR", [], [ "@%%" ]) ] in - let pair = [ Prim (loc, "PAIR", [], - [ "%@" ; Option.unopt field_annot ~default:"%" ]) ] in + let access_check = + match field_annot with + | None -> + [] + | Some f -> + [ Prim (loc, "DUP", [], []); + Prim (loc, "CDR", [], [f]); + Prim (loc, "DROP", [], []) ] + in + let encoding = [Prim (loc, "CAR", [], ["@%%"])] in + let pair = + [ Prim + ( loc, + "PAIR", + [], + ["%@"; Option.unopt field_annot ~default:"%"] ) ] + in let init = Seq (loc, access_check @ encoding @ pair) in ok (Some (parse (len - 3) init)) - | _ -> assert false - else - ok None - | _ -> ok None + | _ -> + assert false + else ok None + | _ -> + ok None let expand_map_caddadr original = match original with | Prim (loc, str, args, annot) -> let len = String.length str in - if len >= 7 - && String.sub str 0 5 = "MAP_C" - && String.get str (len - 1) = 'R' - && check_letters str 5 (len - 2) - (function 'A' | 'D' -> true | _ -> false) then - begin match args with - | [ Seq _ as code ] -> ok code - | [ _ ] -> error (Sequence_expected str) - | [] | _ :: _ :: _ -> error (Invalid_arity (str, List.length args, 1)) - end >>? fun code -> - begin match extract_field_annots annot with - | [], annot -> ok (None, annot) - | [f], annot -> ok (Some f, annot) - | _, _ -> error (Unexpected_macro_annotation str) - end >>? fun (field_annot, annot) -> + if + len >= 7 + && String.sub str 0 5 = "MAP_C" + && str.[len - 1] = 'R' + && check_letters str 5 (len - 2) (function + | 'A' | 'D' -> + true + | _ -> + false) + then + ( match args with + | [(Seq _ as code)] -> + ok code + | [_] -> + error (Sequence_expected str) + | [] | _ :: _ :: _ -> + error (Invalid_arity (str, List.length args, 1)) ) + >>? fun code -> + ( match extract_field_annots annot with + | ([], annot) -> + ok (None, annot) + | ([f], annot) -> + ok (Some f, annot) + | (_, _) -> + error (Unexpected_macro_annotation str) ) + >>? fun (field_annot, annot) -> let rec parse i acc = - if i = 4 then - acc + if i = 4 then acc else let annot = if i = 5 then annot else [] in - match String.get str i with + match str.[i] with | 'A' -> let acc = - Seq (loc, - [ Prim (loc, "DUP", [], []) ; - Prim (loc, "DIP", - [ Seq (loc, - [ Prim (loc, "CAR", [], [ "@%%" ]) ; - acc ]) ], []) ; - Prim (loc, "CDR", [], [ "@%%" ]) ; - Prim (loc, "SWAP", [], []) ; - Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ]) in + Seq + ( loc, + [ Prim (loc, "DUP", [], []); + Prim + ( loc, + "DIP", + [Seq (loc, [Prim (loc, "CAR", [], ["@%%"]); acc])], + [] ); + Prim (loc, "CDR", [], ["@%%"]); + Prim (loc, "SWAP", [], []); + Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ] ) + in parse (i - 1) acc | 'D' -> let acc = - Seq (loc, - [ Prim (loc, "DUP", [], []) ; - Prim (loc, "DIP", - [ Seq (loc, - [ Prim (loc, "CDR", [], [ "@%%" ]) ; - acc ]) ], []) ; - Prim (loc, "CAR", [], [ "@%%" ]) ; - Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ]) in + Seq + ( loc, + [ Prim (loc, "DUP", [], []); + Prim + ( loc, + "DIP", + [Seq (loc, [Prim (loc, "CDR", [], ["@%%"]); acc])], + [] ); + Prim (loc, "CAR", [], ["@%%"]); + Prim (loc, "PAIR", [], "%@" :: "%@" :: annot) ] ) + in parse (i - 1) acc - | _ -> assert false in - let cr_annot = match field_annot with - | None -> [] - | Some f -> [ "@" ^ String.sub f 1 (String.length f - 1) ] in - match String.get str (len - 2) with + | _ -> + assert false + in + let cr_annot = + match field_annot with + | None -> + [] + | Some f -> + ["@" ^ String.sub f 1 (String.length f - 1)] + in + match str.[len - 2] with | 'A' -> let init = - Seq (loc, - [ Prim (loc, "DUP", [], []) ; - Prim (loc, "CDR", [], [ "@%%" ]) ; - Prim (loc, "DIP", - [ Seq (loc, [ Prim (loc, "CAR", [], cr_annot) ; code ]) ], []) ; - Prim (loc, "SWAP", [], []) ; - Prim (loc, "PAIR", [], - [ Option.unopt field_annot ~default:"%" ; "%@"]) ]) in + Seq + ( loc, + [ Prim (loc, "DUP", [], []); + Prim (loc, "CDR", [], ["@%%"]); + Prim + ( loc, + "DIP", + [Seq (loc, [Prim (loc, "CAR", [], cr_annot); code])], + [] ); + Prim (loc, "SWAP", [], []); + Prim + ( loc, + "PAIR", + [], + [Option.unopt field_annot ~default:"%"; "%@"] ) ] ) + in ok (Some (parse (len - 3) init)) | 'D' -> let init = - Seq (loc, - [ Prim (loc, "DUP", [], []) ; - Prim (loc, "CDR", [], cr_annot) ; - code ; - Prim (loc, "SWAP", [], []) ; - Prim (loc, "CAR", [], [ "@%%" ]) ; - Prim (loc, "PAIR", [], - [ "%@" ; Option.unopt field_annot ~default:"%" ]) ]) in + Seq + ( loc, + [ Prim (loc, "DUP", [], []); + Prim (loc, "CDR", [], cr_annot); + code; + Prim (loc, "SWAP", [], []); + Prim (loc, "CAR", [], ["@%%"]); + Prim + ( loc, + "PAIR", + [], + ["%@"; Option.unopt field_annot ~default:"%"] ) ] ) + in ok (Some (parse (len - 3) init)) - | _ -> assert false - else - ok None - | _ -> ok None + | _ -> + assert false + else ok None + | _ -> + ok None exception Not_a_roman @@ -252,881 +328,1178 @@ let decimal_of_roman roman = (* http://rosettacode.org/wiki/Roman_numerals/Decode#OCaml *) let arabic = ref 0 in let lastval = ref 0 in - for i = (String.length roman) - 1 downto 0 do + for i = String.length roman - 1 downto 0 do let n = match roman.[i] with - | 'M' -> 1000 - | 'D' -> 500 - | 'C' -> 100 - | 'L' -> 50 - | 'X' -> 10 - | 'V' -> 5 - | 'I' -> 1 - | _ -> raise_notrace Not_a_roman + | 'M' -> + 1000 + | 'D' -> + 500 + | 'C' -> + 100 + | 'L' -> + 50 + | 'X' -> + 10 + | 'V' -> + 5 + | 'I' -> + 1 + | _ -> + raise_notrace Not_a_roman in - if Compare.Int.(n < !lastval) - then arabic := !arabic - n - else arabic := !arabic + n; + if Compare.Int.(n < !lastval) then arabic := !arabic - n + else arabic := !arabic + n ; lastval := n - done; + done ; !arabic -let expand_dxiiivp original = +let dip ~loc ?(annot = []) depth instr = + assert (depth >= 0) ; + if depth = 1 then Prim (loc, "DIP", [instr], annot) + else Prim (loc, "DIP", [Int (loc, Z.of_int depth); instr], annot) + +let expand_deprecated_dxiiivp original = + (* transparently expands deprecated macro [DI...IP] to instruction [DIP n] *) match original with | Prim (loc, str, args, annot) -> let len = String.length str in - if len > 3 - && String.get str 0 = 'D' - && String.get str (len - 1) = 'P' then + if len > 3 && str.[0] = 'D' && str.[len - 1] = 'P' then try let depth = decimal_of_roman (String.sub str 1 (len - 2)) in - let rec make i acc = - if i = 0 then - acc - else - make (i - 1) - (Seq (loc, [ Prim (loc, "DIP", [ acc ], annot) ])) in match args with - | [ Seq (_, _) as arg ] -> ok @@ Some (make depth arg) - | [ _ ] -> error (Sequence_expected str) - | [] | _ :: _ :: _ -> error (Invalid_arity (str, List.length args, 1)) + | [(Seq (_, _) as arg)] -> + ok @@ Some (dip ~loc ~annot depth arg) + | [_] -> + error (Sequence_expected str) + | [] | _ :: _ :: _ -> + error (Invalid_arity (str, List.length args, 1)) with Not_a_roman -> ok None else ok None - | _ -> ok None + | _ -> + ok None exception Not_a_pair -let rec dip ~loc depth instr = - if depth <= 0 - then instr - else dip ~loc (depth - 1) (Prim (loc, "DIP", [ Seq (loc, [ instr ]) ], [])) - -type pair_item = - | A - | I - | P of int * pair_item * pair_item +type pair_item = A | I | P of int * pair_item * pair_item let parse_pair_substr str ~len start = let rec parse ?left i = - if i = len - 1 then - raise_notrace Not_a_pair - else if String.get str i = 'P' then - let next_i, l = parse ~left:true (i + 1) in - let next_i, r = parse ~left:false next_i in - next_i, P (i, l, r) - else if String.get str i = 'A' && left = Some true then - i + 1, A - else if String.get str i = 'I' && left <> Some true then - i + 1, I - else - raise_notrace Not_a_pair in - let last, ast = parse start in - if last <> len - 1 then - raise_notrace Not_a_pair - else - ast + if i = len - 1 then raise_notrace Not_a_pair + else if str.[i] = 'P' then + let (next_i, l) = parse ~left:true (i + 1) in + let (next_i, r) = parse ~left:false next_i in + (next_i, P (i, l, r)) + else if str.[i] = 'A' && left = Some true then (i + 1, A) + else if str.[i] = 'I' && left <> Some true then (i + 1, I) + else raise_notrace Not_a_pair + in + let (last, ast) = parse start in + if last <> len - 1 then raise_notrace Not_a_pair else ast let unparse_pair_item ast = - let rec unparse ast acc = match ast with - | P (_, l, r) -> unparse r (unparse l ("P" :: acc)) - | A -> "A" :: acc - | I -> "I" :: acc in + let rec unparse ast acc = + match ast with + | P (_, l, r) -> + unparse r (unparse l ("P" :: acc)) + | A -> + "A" :: acc + | I -> + "I" :: acc + in List.rev ("R" :: unparse ast []) |> String.concat "" let pappaiir_annots_pos ast annot = let rec find_annots_pos p_pos ast annots acc = - match ast, annots with - | _, [] -> annots, acc - | P (i, left, right), _ -> - let annots, acc = find_annots_pos i left annots acc in + match (ast, annots) with + | (_, []) -> + (annots, acc) + | (P (i, left, right), _) -> + let (annots, acc) = find_annots_pos i left annots acc in find_annots_pos i right annots acc - | A, a :: annots -> - let pos = match IntMap.find_opt p_pos acc with - | None -> [ a ], [] - | Some (_, cdr) -> [ a ], cdr in - annots, IntMap.add p_pos pos acc - | I, a :: annots -> - let pos = match IntMap.find_opt p_pos acc with - | None -> [], [ a ] - | Some (car, _) -> car, [ a ] in - annots, IntMap.add p_pos pos acc in + | (A, a :: annots) -> + let pos = + match IntMap.find_opt p_pos acc with + | None -> + ([a], []) + | Some (_, cdr) -> + ([a], cdr) + in + (annots, IntMap.add p_pos pos acc) + | (I, a :: annots) -> + let pos = + match IntMap.find_opt p_pos acc with + | None -> + ([], [a]) + | Some (car, _) -> + (car, [a]) + in + (annots, IntMap.add p_pos pos acc) + in snd (find_annots_pos 0 ast annot IntMap.empty) let expand_pappaiir original = match original with | Prim (loc, str, args, annot) -> let len = String.length str in - if len > 4 - && String.get str 0 = 'P' - && String.get str (len - 1) = 'R' - && check_letters str 1 (len - 2) - (function 'P' | 'A' | 'I' -> true | _ -> false) then + if + len > 4 + && str.[0] = 'P' + && str.[len - 1] = 'R' + && check_letters str 1 (len - 2) (function + | 'P' | 'A' | 'I' -> + true + | _ -> + false) + then try - let field_annots, annot = extract_field_annots annot in + let (field_annots, annot) = extract_field_annots annot in let ast = parse_pair_substr str ~len 0 in let field_annots_pos = pappaiir_annots_pos ast field_annots in let rec parse p (depth, acc) = match p with | P (i, left, right) -> let annot = - match i, IntMap.find_opt i field_annots_pos with - | 0, None -> annot - | _, None -> [] - | 0, Some ([], cdr_annot) -> "%" :: cdr_annot @ annot - | _, Some ([], cdr_annot) -> "%" :: cdr_annot - | 0, Some (car_annot, cdr_annot) -> car_annot @ cdr_annot @ annot - | _, Some (car_annot, cdr_annot) -> car_annot @ cdr_annot + match (i, IntMap.find_opt i field_annots_pos) with + | (0, None) -> + annot + | (_, None) -> + [] + | (0, Some ([], cdr_annot)) -> + ("%" :: cdr_annot) @ annot + | (_, Some ([], cdr_annot)) -> + "%" :: cdr_annot + | (0, Some (car_annot, cdr_annot)) -> + car_annot @ cdr_annot @ annot + | (_, Some (car_annot, cdr_annot)) -> + car_annot @ cdr_annot in - let acc = dip ~loc depth (Prim (loc, "PAIR", [], annot)) :: acc in - (depth, acc) - |> parse left - |> parse right - | A | I -> (depth + 1, acc) + let acc = + if depth = 0 then Prim (loc, "PAIR", [], annot) :: acc + else + dip ~loc depth (Seq (loc, [Prim (loc, "PAIR", [], annot)])) + :: acc + in + (depth, acc) |> parse left |> parse right + | A | I -> + (depth + 1, acc) in - let _, expanded = parse ast (0, []) in - begin match args with - | [] -> ok () - | _ :: _ -> error (Invalid_arity (str, List.length args, 0)) - end >>? fun () -> - ok (Some (Seq (loc, expanded))) + let (_, expanded) = parse ast (0, []) in + ( match args with + | [] -> + ok () + | _ :: _ -> + error (Invalid_arity (str, List.length args, 0)) ) + >>? fun () -> ok (Some (Seq (loc, expanded))) with Not_a_pair -> ok None - else - ok None - | _ -> ok None + else ok None + | _ -> + ok None let expand_unpappaiir original = match original with | Prim (loc, str, args, annot) -> let len = String.length str in - if len >= 6 - && String.sub str 0 3 = "UNP" - && String.get str (len - 1) = 'R' - && check_letters str 3 (len - 2) - (function 'P' | 'A' | 'I' -> true | _ -> false) then + if + len >= 6 + && String.sub str 0 3 = "UNP" + && str.[len - 1] = 'R' + && check_letters str 3 (len - 2) (function + | 'P' | 'A' | 'I' -> + true + | _ -> + false) + then try let unpair car_annot cdr_annot = - Seq (loc, [ Prim (loc, "DUP", [], []) ; - Prim (loc, "CAR", [], car_annot) ; - dip ~loc 1 (Prim (loc, "CDR", [], cdr_annot)) ; - ]) in + Seq + ( loc, + [ Prim (loc, "DUP", [], []); + Prim (loc, "CAR", [], car_annot); + dip ~loc 1 (Seq (loc, [Prim (loc, "CDR", [], cdr_annot)])) ] + ) + in let ast = parse_pair_substr str ~len 2 in let annots_pos = pappaiir_annots_pos ast annot in let rec parse p (depth, acc) = match p with | P (i, left, right) -> - let car_annot, cdr_annot = + let (car_annot, cdr_annot) = match IntMap.find_opt i annots_pos with - | None -> [], [] - | Some (car_annot, cdr_annot) -> car_annot, cdr_annot in - let acc = dip ~loc depth (unpair car_annot cdr_annot) :: acc in - (depth, acc) - |> parse left - |> parse right - | A | I -> (depth + 1, acc) in - let _, rev_expanded = parse ast (0, []) in + | None -> + ([], []) + | Some (car_annot, cdr_annot) -> + (car_annot, cdr_annot) + in + let acc = + if depth = 0 then unpair car_annot cdr_annot :: acc + else + dip ~loc depth (Seq (loc, [unpair car_annot cdr_annot])) + :: acc + in + (depth, acc) |> parse left |> parse right + | A | I -> + (depth + 1, acc) + in + let (_, rev_expanded) = parse ast (0, []) in let expanded = Seq (loc, List.rev rev_expanded) in - begin match args with - | [] -> ok () - | _ :: _ -> error (Invalid_arity (str, List.length args, 0)) - end >>? fun () -> - ok (Some expanded) + ( match args with + | [] -> + ok () + | _ :: _ -> + error (Invalid_arity (str, List.length args, 0)) ) + >>? fun () -> ok (Some expanded) with Not_a_pair -> ok None - else - ok None - | _ -> ok None + else ok None + | _ -> + ok None exception Not_a_dup -let expand_duuuuup original = +let dupn loc nloc n annot = + assert (n > 1) ; + if n = 2 then + (* keep the old expansion, shorter for [DUP 2] *) + Seq + ( loc, + [ Prim (loc, "DIP", [Seq (loc, [Prim (nloc, "DUP", [], annot)])], []); + Prim (loc, "SWAP", [], []) ] ) + else + Seq + ( loc, + [ Prim + ( loc, + "DIP", + [ Int (loc, Z.of_int (n - 1)); + Seq (loc, [Prim (loc, "DUP", [], annot)]) ], + [] ); + Prim (loc, "DIG", [Int (nloc, Z.of_int n)], []) ] ) + +let expand_dupn original = + match original with + | Prim (loc, "DUP", [Int (nloc, n)], annot) -> + ok (Some (dupn loc nloc (Z.to_int n) annot)) + | _ -> + ok None + +let expand_deprecated_duuuuup original = + (* transparently expands deprecated macro [DU...UP] to [{ DIP n { DUP } ; DIG n }] *) match original with | Prim (loc, str, args, annot) -> let len = String.length str in - if len > 3 - && String.get str 0 = 'D' - && String.get str (len - 1) = 'P' - && check_letters str 1 (len - 2) ((=) 'U') then - begin match args with - | [] -> ok () - | _ :: _ -> error (Invalid_arity (str, List.length args, 0)) - end >>? fun () -> + if + len > 3 + && str.[0] = 'D' + && str.[len - 1] = 'P' + && check_letters str 1 (len - 2) (( = ) 'U') + then + ( match args with + | [] -> + ok () + | _ :: _ -> + error (Invalid_arity (str, List.length args, 0)) ) + >>? fun () -> try - let rec parse i acc = - if i = 1 then acc - else if String.get str i = 'U' then - parse (i - 1) - (Seq (loc, [ Prim (loc, "DIP", [ acc ], []) ; - Prim (loc, "SWAP", [], []) ])) - else - raise_notrace Not_a_dup in - ok (Some (parse (len - 2) (Seq (loc, [ Prim (loc, "DUP", [], annot) ])))) + let rec parse i = + if i = 1 then dupn loc loc (len - 2) annot + else if str.[i] = 'U' then parse (i - 1) + else raise_notrace Not_a_dup + in + ok (Some (parse (len - 2))) with Not_a_dup -> ok None - else - ok None - | _ -> ok None + else ok None + | _ -> + ok None let expand_compare original = let cmp loc is annot = let is = match List.rev_map (fun i -> Prim (loc, i, [], [])) is with - | Prim (loc, i, args, _) :: r -> List.rev (Prim (loc, i, args, annot) :: r) - | is -> List.rev is + | Prim (loc, i, args, _) :: r -> + List.rev (Prim (loc, i, args, annot) :: r) + | is -> + List.rev is in - ok (Some (Seq (loc, is))) in + ok (Some (Seq (loc, is))) + in let ifcmp loc is l r annot = let is = - List.map (fun i -> Prim (loc, i, [], [])) is @ - [ Prim (loc, "IF", [ l ; r ], annot) ] in - ok (Some (Seq (loc, is))) in + List.map (fun i -> Prim (loc, i, [], [])) is + @ [Prim (loc, "IF", [l; r], annot)] + in + ok (Some (Seq (loc, is))) + in match original with | Prim (loc, "CMPEQ", [], annot) -> - cmp loc [ "COMPARE" ; "EQ" ] annot + cmp loc ["COMPARE"; "EQ"] annot | Prim (loc, "CMPNEQ", [], annot) -> - cmp loc [ "COMPARE" ; "NEQ" ] annot + cmp loc ["COMPARE"; "NEQ"] annot | Prim (loc, "CMPLT", [], annot) -> - cmp loc [ "COMPARE" ; "LT" ] annot + cmp loc ["COMPARE"; "LT"] annot | Prim (loc, "CMPGT", [], annot) -> - cmp loc [ "COMPARE" ; "GT" ] annot + cmp loc ["COMPARE"; "GT"] annot | Prim (loc, "CMPLE", [], annot) -> - cmp loc [ "COMPARE" ; "LE" ] annot + cmp loc ["COMPARE"; "LE"] annot | Prim (loc, "CMPGE", [], annot) -> - cmp loc [ "COMPARE" ; "GE" ] annot - | Prim (_, ("CMPEQ" | "CMPNEQ" | "CMPLT" - | "CMPGT" | "CMPLE" | "CMPGE" as str), args, []) -> + cmp loc ["COMPARE"; "GE"] annot + | Prim + ( _, + (("CMPEQ" | "CMPNEQ" | "CMPLT" | "CMPGT" | "CMPLE" | "CMPGE") as str), + args, + [] ) -> error (Invalid_arity (str, List.length args, 0)) - | Prim (loc, "IFCMPEQ", [ l ; r ], annot) -> - ifcmp loc [ "COMPARE" ; "EQ" ] l r annot - | Prim (loc, "IFCMPNEQ", [ l ; r ], annot) -> - ifcmp loc [ "COMPARE" ; "NEQ" ] l r annot - | Prim (loc, "IFCMPLT", [ l ; r ], annot) -> - ifcmp loc [ "COMPARE" ; "LT" ] l r annot - | Prim (loc, "IFCMPGT", [ l ; r ], annot) -> - ifcmp loc [ "COMPARE" ; "GT" ] l r annot - | Prim (loc, "IFCMPLE", [ l ; r ], annot) -> - ifcmp loc [ "COMPARE" ; "LE" ] l r annot - | Prim (loc, "IFCMPGE", [ l ; r ], annot) -> - ifcmp loc [ "COMPARE" ; "GE" ] l r annot - | Prim (loc, "IFEQ", [ l ; r ], annot) -> - ifcmp loc [ "EQ" ] l r annot - | Prim (loc, "IFNEQ", [ l ; r ], annot) -> - ifcmp loc [ "NEQ" ] l r annot - | Prim (loc, "IFLT", [ l ; r ], annot) -> - ifcmp loc [ "LT" ] l r annot - | Prim (loc, "IFGT", [ l ; r ], annot) -> - ifcmp loc [ "GT" ] l r annot - | Prim (loc, "IFLE", [ l ; r ], annot) -> - ifcmp loc [ "LE" ] l r annot - | Prim (loc, "IFGE", [ l ; r ], annot) -> - ifcmp loc [ "GE" ] l r annot - | Prim (_, ("IFCMPEQ" | "IFCMPNEQ" | "IFCMPLT" - | "IFCMPGT" | "IFCMPLE" | "IFCMPGE" - | "IFEQ" | "IFNEQ" | "IFLT" - | "IFGT" | "IFLE" | "IFGE" as str), args, []) -> + | Prim (loc, "IFCMPEQ", [l; r], annot) -> + ifcmp loc ["COMPARE"; "EQ"] l r annot + | Prim (loc, "IFCMPNEQ", [l; r], annot) -> + ifcmp loc ["COMPARE"; "NEQ"] l r annot + | Prim (loc, "IFCMPLT", [l; r], annot) -> + ifcmp loc ["COMPARE"; "LT"] l r annot + | Prim (loc, "IFCMPGT", [l; r], annot) -> + ifcmp loc ["COMPARE"; "GT"] l r annot + | Prim (loc, "IFCMPLE", [l; r], annot) -> + ifcmp loc ["COMPARE"; "LE"] l r annot + | Prim (loc, "IFCMPGE", [l; r], annot) -> + ifcmp loc ["COMPARE"; "GE"] l r annot + | Prim (loc, "IFEQ", [l; r], annot) -> + ifcmp loc ["EQ"] l r annot + | Prim (loc, "IFNEQ", [l; r], annot) -> + ifcmp loc ["NEQ"] l r annot + | Prim (loc, "IFLT", [l; r], annot) -> + ifcmp loc ["LT"] l r annot + | Prim (loc, "IFGT", [l; r], annot) -> + ifcmp loc ["GT"] l r annot + | Prim (loc, "IFLE", [l; r], annot) -> + ifcmp loc ["LE"] l r annot + | Prim (loc, "IFGE", [l; r], annot) -> + ifcmp loc ["GE"] l r annot + | Prim + ( _, + ( ( "IFCMPEQ" + | "IFCMPNEQ" + | "IFCMPLT" + | "IFCMPGT" + | "IFCMPLE" + | "IFCMPGE" + | "IFEQ" + | "IFNEQ" + | "IFLT" + | "IFGT" + | "IFLE" + | "IFGE" ) as str ), + args, + [] ) -> error (Invalid_arity (str, List.length args, 2)) - | Prim (_, ("IFCMPEQ" | "IFCMPNEQ" | "IFCMPLT" - | "IFCMPGT" | "IFCMPLE" | "IFCMPGE" - | "IFEQ" | "IFNEQ" | "IFLT" - | "IFGT" | "IFLE" | "IFGE" as str), [], _ :: _) -> + | Prim + ( _, + ( ( "IFCMPEQ" + | "IFCMPNEQ" + | "IFCMPLT" + | "IFCMPGT" + | "IFCMPLE" + | "IFCMPGE" + | "IFEQ" + | "IFNEQ" + | "IFLT" + | "IFGT" + | "IFLE" + | "IFGE" ) as str ), + [], + _ :: _ ) -> error (Unexpected_macro_annotation str) - | _ -> ok None + | _ -> + ok None let expand_asserts original = let may_rename loc = function - | [] -> Seq (loc, []) - | annot -> Seq (loc, [ Prim (loc, "RENAME", [], annot) ]) + | [] -> + Seq (loc, []) + | annot -> + Seq (loc, [Prim (loc, "RENAME", [], annot)]) in - let fail_false ?(annot=[]) loc = - [may_rename loc annot; Seq (loc, [ Prim (loc, "FAIL", [], []) ])] + let fail_false ?(annot = []) loc = + [may_rename loc annot; Seq (loc, [Prim (loc, "FAIL", [], [])])] in - let fail_true ?(annot=[]) loc = - [Seq (loc, [ Prim (loc, "FAIL", [], []) ]); may_rename loc annot] + let fail_true ?(annot = []) loc = + [Seq (loc, [Prim (loc, "FAIL", [], [])]); may_rename loc annot] in match original with | Prim (loc, "ASSERT", [], []) -> - ok @@ Some (Seq (loc, [ Prim (loc, "IF", fail_false loc, []) ])) + ok @@ Some (Seq (loc, [Prim (loc, "IF", fail_false loc, [])])) | Prim (loc, "ASSERT_NONE", [], []) -> - ok @@ Some (Seq (loc, [ Prim (loc, "IF_NONE", fail_false loc, []) ])) + ok @@ Some (Seq (loc, [Prim (loc, "IF_NONE", fail_false loc, [])])) | Prim (loc, "ASSERT_SOME", [], annot) -> - ok @@ Some (Seq (loc, [ Prim (loc, "IF_NONE", fail_true ~annot loc, []) ])) + ok @@ Some (Seq (loc, [Prim (loc, "IF_NONE", fail_true ~annot loc, [])])) | Prim (loc, "ASSERT_LEFT", [], annot) -> - ok @@ Some (Seq (loc, [ Prim (loc, "IF_LEFT", fail_false ~annot loc, []) ])) + ok + @@ Some (Seq (loc, [Prim (loc, "IF_LEFT", fail_false ~annot loc, [])])) | Prim (loc, "ASSERT_RIGHT", [], annot) -> - ok @@ Some (Seq (loc, [ Prim (loc, "IF_LEFT", fail_true ~annot loc, []) ])) - | Prim (_, ("ASSERT" | "ASSERT_NONE" | "ASSERT_SOME" - | "ASSERT_LEFT" | "ASSERT_RIGHT" as str), args, []) -> + ok @@ Some (Seq (loc, [Prim (loc, "IF_LEFT", fail_true ~annot loc, [])])) + | Prim + ( _, + ( ( "ASSERT" + | "ASSERT_NONE" + | "ASSERT_SOME" + | "ASSERT_LEFT" + | "ASSERT_RIGHT" ) as str ), + args, + [] ) -> error (Invalid_arity (str, List.length args, 0)) - | Prim (_, ( "ASSERT" | "ASSERT_NONE" as str), [], _ :: _) -> + | Prim (_, (("ASSERT" | "ASSERT_NONE") as str), [], _ :: _) -> error (Unexpected_macro_annotation str) | Prim (loc, s, args, annot) - when String.(length s > 7 && equal (sub s 0 7) "ASSERT_") -> - begin match args with - | [] -> ok () - | _ :: _ -> error (Invalid_arity (s, List.length args, 0)) - end >>? fun () -> - begin match annot with - | _ :: _ -> (error (Unexpected_macro_annotation s)) - | [] -> ok () - end >>? fun () -> - begin - let remaining = String.(sub s 7 (length s - 7)) in - let remaining_prim = Prim (loc, remaining, [], []) in - match remaining with - | "EQ" | "NEQ" | "LT" | "LE" | "GE" | "GT" -> - ok @@ Some (Seq (loc, [ remaining_prim ; - Prim (loc, "IF", fail_false loc, []) ])) - | _ -> - begin - expand_compare remaining_prim >|? function - | None -> None - | Some seq -> - Some (Seq (loc, [ seq ; - Prim (loc, "IF", fail_false loc, []) ])) - end - end - | _ -> ok None - + when String.(length s > 7 && equal (sub s 0 7) "ASSERT_") -> ( + ( match args with + | [] -> + ok () + | _ :: _ -> + error (Invalid_arity (s, List.length args, 0)) ) + >>? fun () -> + ( match annot with + | _ :: _ -> + error (Unexpected_macro_annotation s) + | [] -> + ok () ) + >>? fun () -> + let remaining = String.(sub s 7 (length s - 7)) in + let remaining_prim = Prim (loc, remaining, [], []) in + match remaining with + | "EQ" | "NEQ" | "LT" | "LE" | "GE" | "GT" -> + ok + @@ Some + (Seq + (loc, [remaining_prim; Prim (loc, "IF", fail_false loc, [])])) + | _ -> ( + expand_compare remaining_prim + >|? function + | None -> + None + | Some seq -> + Some (Seq (loc, [seq; Prim (loc, "IF", fail_false loc, [])])) ) ) + | _ -> + ok None let expand_if_some = function - | Prim (loc, "IF_SOME", [ right ; left ], annot) -> - ok @@ Some (Seq (loc, [ Prim (loc, "IF_NONE", [ left ; right ], annot) ])) + | Prim (loc, "IF_SOME", [right; left], annot) -> + ok @@ Some (Seq (loc, [Prim (loc, "IF_NONE", [left; right], annot)])) | Prim (_, "IF_SOME", args, _annot) -> error (Invalid_arity ("IF_SOME", List.length args, 2)) - | _ -> ok @@ None + | _ -> + ok @@ None let expand_if_right = function - | Prim (loc, "IF_RIGHT", [ right ; left ], annot) -> - ok @@ Some (Seq (loc, [ Prim (loc, "IF_LEFT", [ left ; right ], annot) ])) + | Prim (loc, "IF_RIGHT", [right; left], annot) -> + ok @@ Some (Seq (loc, [Prim (loc, "IF_LEFT", [left; right], annot)])) | Prim (_, "IF_RIGHT", args, _annot) -> error (Invalid_arity ("IF_RIGHT", List.length args, 2)) - | _ -> ok @@ None + | _ -> + ok @@ None let expand_fail = function | Prim (loc, "FAIL", [], []) -> - ok @@ Some (Seq (loc, [ - Prim (loc, "UNIT", [], []) ; - Prim (loc, "FAILWITH", [], []) ; - ])) - | _ -> ok @@ None + ok + @@ Some + (Seq + ( loc, + [Prim (loc, "UNIT", [], []); Prim (loc, "FAILWITH", [], [])] )) + | _ -> + ok @@ None let expand original = let rec try_expansions = function - | [] -> ok @@ original - | expander :: expanders -> - expander original >>? function - | None -> try_expansions expanders - | Some rewritten -> ok rewritten in + | [] -> + ok @@ original + | expander :: expanders -> ( + expander original + >>? function + | None -> try_expansions expanders | Some rewritten -> ok rewritten ) + in try_expansions - [ expand_caddadr ; - expand_set_caddadr ; - expand_map_caddadr ; - expand_dxiiivp ; + [ expand_caddadr; + expand_set_caddadr; + expand_map_caddadr; + expand_deprecated_dxiiivp; (* expand_paaiair ; *) - expand_pappaiir ; + expand_pappaiir; (* expand_unpaaiair ; *) - expand_unpappaiir ; - expand_duuuuup ; - expand_compare ; - expand_asserts ; - expand_if_some ; - expand_if_right ; - expand_fail ; - ] + expand_unpappaiir; + expand_deprecated_duuuuup; + expand_dupn; + expand_compare; + expand_asserts; + expand_if_some; + expand_if_right; + expand_fail ] let expand_rec expr = let rec error_map (expanded, errors) f = function - | [] -> (List.rev expanded, List.rev errors) + | [] -> + (List.rev expanded, List.rev errors) | hd :: tl -> let (new_expanded, new_errors) = f hd in error_map (new_expanded :: expanded, List.rev_append new_errors errors) - f tl in + f + tl + in let error_map = error_map ([], []) in let rec expand_rec expr = match expand expr with - | Ok expanded -> - begin - match expanded with - | Seq (loc, items) -> - let items, errors = error_map expand_rec items in - (Seq (loc, items), errors) - | Prim (loc, name, args, annot) -> - let args, errors = error_map expand_rec args in - (Prim (loc, name, args, annot), errors) - | Int _ | String _ | Bytes _ as atom -> (atom, []) end - | Error errors -> (expr, errors) in + | Ok expanded -> ( + match expanded with + | Seq (loc, items) -> + let (items, errors) = error_map expand_rec items in + (Seq (loc, items), errors) + | Prim (loc, name, args, annot) -> + let (args, errors) = error_map expand_rec args in + (Prim (loc, name, args, annot), errors) + | (Int _ | String _ | Bytes _) as atom -> + (atom, []) ) + | Error errors -> + (expr, errors) + in expand_rec expr let unexpand_caddadr expanded = let rec rsteps acc = function - | [] -> Some acc - | Prim (_, "CAR" , [], []) :: rest -> + | [] -> + Some acc + | Prim (_, "CAR", [], []) :: rest -> rsteps ("A" :: acc) rest - | Prim (_, "CDR" , [], []) :: rest -> + | Prim (_, "CDR", [], []) :: rest -> rsteps ("D" :: acc) rest - | _ -> None in + | _ -> + None + in match expanded with - | Seq (loc, (Prim (_, "CAR" , [], []) :: _ as nodes)) - | Seq (loc, (Prim (_, "CDR" , [], []) :: _ as nodes)) -> - begin match rsteps [] nodes with - | Some steps -> - let name = String.concat "" ("C" :: List.rev ("R" :: steps)) in - Some (Prim (loc, name, [], [])) - | None -> None - end - | _ -> None + | Seq (loc, (Prim (_, "CAR", [], []) :: _ as nodes)) + | Seq (loc, (Prim (_, "CDR", [], []) :: _ as nodes)) -> ( + match rsteps [] nodes with + | Some steps -> + let name = String.concat "" ("C" :: List.rev ("R" :: steps)) in + Some (Prim (loc, name, [], [])) + | None -> + None ) + | _ -> + None let unexpand_set_caddadr expanded = let rec steps acc annots = function - | Seq (loc, - [ Prim (_, "CDR", [], _) ; - Prim (_, "SWAP", [], _) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq + ( loc, + [ Prim (_, "CDR", [], _); + Prim (_, "SWAP", [], _); + Prim (_, "PAIR", [], _) ] ) -> Some (loc, "A" :: acc, annots) - | Seq (loc, - [ Prim (_, "DUP", [], []) ; - Prim (_, "CAR", [], [ field_annot ]) ; - Prim (_, "DROP", [], []) ; - Prim (_, "CDR", [], _) ; - Prim (_, "SWAP", [], []) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq + ( loc, + [ Prim (_, "DUP", [], []); + Prim (_, "CAR", [], [field_annot]); + Prim (_, "DROP", [], []); + Prim (_, "CDR", [], _); + Prim (_, "SWAP", [], []); + Prim (_, "PAIR", [], _) ] ) -> Some (loc, "A" :: acc, field_annot :: annots) - | Seq (loc, - [ Prim (_, "CAR", [], _) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq (loc, [Prim (_, "CAR", [], _); Prim (_, "PAIR", [], _)]) -> Some (loc, "D" :: acc, annots) - | Seq (loc, - [ Prim (_, "DUP", [], []) ; - Prim (_, "CDR", [], [ field_annot ]) ; - Prim (_, "DROP", [], []) ; - Prim (_, "CAR", [], _) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq + ( loc, + [ Prim (_, "DUP", [], []); + Prim (_, "CDR", [], [field_annot]); + Prim (_, "DROP", [], []); + Prim (_, "CAR", [], _); + Prim (_, "PAIR", [], _) ] ) -> Some (loc, "D" :: acc, field_annot :: annots) - | Seq (_, - [ Prim (_, "DUP", [], []) ; - Prim (_, "DIP", - [ Seq (_, - [ Prim (_, "CAR", [], _) ; - sub ]) ], []) ; - Prim (_, "CDR", [], _) ; - Prim (_, "SWAP", [], []) ; - Prim (_, "PAIR", [], pair_annots) ]) -> - let _, pair_annots = extract_field_annots pair_annots in + | Seq + ( _, + [ Prim (_, "DUP", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CAR", [], _); sub])], []); + Prim (_, "CDR", [], _); + Prim (_, "SWAP", [], []); + Prim (_, "PAIR", [], pair_annots) ] ) -> + let (_, pair_annots) = extract_field_annots pair_annots in steps ("A" :: acc) (List.rev_append pair_annots annots) sub - | Seq (_, - [ Prim (_, "DUP", [], []) ; - Prim (_, "DIP", - [ Seq (_, - [ Prim (_, "CDR", [], _) ; - sub ]) ], []) ; - Prim (_, "CAR", [], _) ; - Prim (_, "PAIR", [], pair_annots) ]) -> - let _, pair_annots = extract_field_annots pair_annots in + | Seq + ( _, + [ Prim (_, "DUP", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CDR", [], _); sub])], []); + Prim (_, "CAR", [], _); + Prim (_, "PAIR", [], pair_annots) ] ) -> + let (_, pair_annots) = extract_field_annots pair_annots in steps ("D" :: acc) (List.rev_append pair_annots annots) sub - | _ -> None in + | _ -> + None + in match steps [] [] expanded with | Some (loc, steps, annots) -> let name = String.concat "" ("SET_C" :: List.rev ("R" :: steps)) in Some (Prim (loc, name, [], List.rev annots)) - | None -> None + | None -> + None let unexpand_map_caddadr expanded = let rec steps acc annots = function - | Seq (loc, - [ Prim (_, "DUP", [], []) ; - Prim (_, "CDR", [], _) ; - Prim (_, "SWAP", [], []) ; - Prim (_, "DIP", - [ Seq (_, - [ Prim (_, "CAR", [], []) ; - code ]) ], []) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq + ( loc, + [ Prim (_, "DUP", [], []); + Prim (_, "CDR", [], _); + Prim (_, "SWAP", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CAR", [], []); code])], []); + Prim (_, "PAIR", [], _) ] ) -> Some (loc, "A" :: acc, annots, code) - | Seq (loc, - [ Prim (_, "DUP", [], []) ; - Prim (_, "CDR", [], _) ; - Prim (_, "SWAP", [], []) ; - Prim (_, "DIP", - [ Seq (_, - [ Prim (_, "CAR", [], [ field_annot ]) ; - code ]) ], []) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq + ( loc, + [ Prim (_, "DUP", [], []); + Prim (_, "CDR", [], _); + Prim (_, "SWAP", [], []); + Prim + ( _, + "DIP", + [Seq (_, [Prim (_, "CAR", [], [field_annot]); code])], + [] ); + Prim (_, "PAIR", [], _) ] ) -> Some (loc, "A" :: acc, field_annot :: annots, code) - | Seq (loc, - [ Prim (_, "DUP", [], []) ; - Prim (_, "CDR", [], []) ; - code ; - Prim (_, "SWAP", [], []) ; - Prim (_, "CAR", [], _) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq + ( loc, + [ Prim (_, "DUP", [], []); + Prim (_, "CDR", [], []); + code; + Prim (_, "SWAP", [], []); + Prim (_, "CAR", [], _); + Prim (_, "PAIR", [], _) ] ) -> Some (loc, "D" :: acc, annots, code) - | Seq (loc, - [ Prim (_, "DUP", [], []) ; - Prim (_, "CDR", [], [ field_annot ]) ; - code ; - Prim (_, "SWAP", [], []) ; - Prim (_, "CAR", [], _) ; - Prim (_, "PAIR", [], _) ]) -> + | Seq + ( loc, + [ Prim (_, "DUP", [], []); + Prim (_, "CDR", [], [field_annot]); + code; + Prim (_, "SWAP", [], []); + Prim (_, "CAR", [], _); + Prim (_, "PAIR", [], _) ] ) -> Some (loc, "D" :: acc, field_annot :: annots, code) - | Seq (_, - [ Prim (_, "DUP", [], []) ; - Prim (_, "DIP", - [ Seq (_, - [ Prim (_, "CAR", [], _) ; - sub ]) ], []) ; - Prim (_, "CDR", [], _) ; - Prim (_, "SWAP", [], []) ; - Prim (_, "PAIR", [], pair_annots) ]) -> - let _, pair_annots = extract_field_annots pair_annots in + | Seq + ( _, + [ Prim (_, "DUP", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CAR", [], _); sub])], []); + Prim (_, "CDR", [], _); + Prim (_, "SWAP", [], []); + Prim (_, "PAIR", [], pair_annots) ] ) -> + let (_, pair_annots) = extract_field_annots pair_annots in steps ("A" :: acc) (List.rev_append pair_annots annots) sub - | Seq (_, - [ Prim (_, "DUP", [], []) ; - Prim (_, "DIP", - [ Seq (_, - [ Prim (_, "CDR", [], []) ; - sub ]) ], []) ; - Prim (_, "CAR", [], []) ; - Prim (_, "PAIR", [], pair_annots) ]) -> - let _, pair_annots = extract_field_annots pair_annots in + | Seq + ( _, + [ Prim (_, "DUP", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CDR", [], []); sub])], []); + Prim (_, "CAR", [], []); + Prim (_, "PAIR", [], pair_annots) ] ) -> + let (_, pair_annots) = extract_field_annots pair_annots in steps ("D" :: acc) (List.rev_append pair_annots annots) sub - | _ -> None in + | _ -> + None + in match steps [] [] expanded with | Some (loc, steps, annots, code) -> let name = String.concat "" ("MAP_C" :: List.rev ("R" :: steps)) in - Some (Prim (loc, name, [ code ], List.rev annots)) - | None -> None + Some (Prim (loc, name, [code], List.rev annots)) + | None -> + None -let roman_of_decimal decimal = - (* http://rosettacode.org/wiki/Roman_numerals/Encode#OCaml *) - let digit x y z = function - | 1 -> [ x ] - | 2 -> [ x ; x ] - | 3 -> [ x ; x ; x ] - | 4 -> [ x ; y ] - | 5 -> [ y ] - | 6 -> [ y ; x ] - | 7 -> [ y ; x ; x ] - | 8 -> [ y ; x ; x ; x ] - | 9 -> [ x ; z ] - | _ -> assert false in - let rec to_roman x = - if x = 0 then [] - else if x < 0 then - invalid_arg "Negative roman numeral" - else if x >= 1000 then - "M" :: to_roman (x - 1000) - else if x >= 100 then - digit "C" "D" "M" (x / 100) @ to_roman (x mod 100) - else if x >= 10 then - digit "X" "L" "C" (x / 10) @ to_roman (x mod 10) - else - digit "I" "V" "X" x in - String.concat "" (to_roman decimal) - -let dxiiivp_roman_of_decimal decimal = - let roman = roman_of_decimal decimal in - if String.length roman = 1 then - (* too short for D*P, fall back to IIIII... *) - String.concat "" (List.init decimal (fun _ -> "I")) - else - roman - -let unexpand_dxiiivp expanded = +let unexpand_deprecated_dxiiivp expanded = + (* transparently turn the old expansion of deprecated [DI...IP] to [DIP n] *) match expanded with - | Seq (loc, - [ Prim (_, "DIP", - [ Seq (_, [ Prim (_, "DIP", [ _ ], []) ]) as sub ], - []) ]) -> + | Seq + ( loc, + [Prim (_, "DIP", [(Seq (_, [Prim (_, "DIP", [_], [])]) as sub)], [])] + ) -> let rec count acc = function - | Seq (_, [ Prim (_, "DIP", [ sub ], []) ]) -> count (acc + 1) sub - | sub -> (acc, sub) in - let depth, sub = count 1 sub in - let name = "D" ^ dxiiivp_roman_of_decimal depth ^ "P" in - Some (Prim (loc, name, [ sub ], [])) - | _ -> None + | Seq (_, [Prim (_, "DIP", [sub], [])]) -> + count (acc + 1) sub + | sub -> + (acc, sub) + in + let (depth, sub) = count 1 sub in + Some (Prim (loc, "DIP", [Int (loc, Z.of_int depth); sub], [])) + | _ -> + None -let unexpand_duuuuup expanded = - let rec help expanded = - match expanded with - | Seq (loc, [ Prim (_, "DUP", [], []) ]) -> Some (loc, 1) - | Seq (_, [ Prim (_, "DIP", [expanded'], []); - Prim (_, "SWAP", [], []) ]) -> - begin - match help expanded' with - | None -> None - | Some (loc, n) -> Some (loc, n + 1) - end - | _ -> None - in let rec dupn = function - | 0 -> "P" - | n -> "U" ^ (dupn (n - 1)) in - match help expanded with - | None -> None - | Some (loc, n) -> Some (Prim (loc, "D" ^ (dupn n), [], [])) +let unexpand_dupn expanded = + match expanded with + | Seq + ( loc, + [ Prim + (_, "DIP", [Int (_, np); Seq (_, [Prim (_, "DUP", [], annot)])], []); + Prim (_, "DIG", [Int (nloc, ng)], []) ] ) + when Z.equal np (Z.pred ng) -> + Some (Prim (loc, "DUP", [Int (nloc, ng)], annot)) + | _ -> + None -let rec normalize_pair_item ?(right=false) = function - | P (i, a, b) -> P (i, normalize_pair_item a, normalize_pair_item ~right:true b) - | A when right -> I - | A -> A - | I -> I +let unexpand_deprecated_duuuuup expanded = + (* transparently turn the old expansion of deprecated [DU...UP] to [DUP n] *) + let rec expand n = function + | Seq (loc, [Prim (nloc, "DUP", [], annot)]) -> + if n = 1 then None + else Some (Prim (loc, "DUP", [Int (nloc, Z.of_int n)], annot)) + | Seq (_, [Prim (_, "DIP", [expanded'], []); Prim (_, "SWAP", [], [])]) -> + expand (n + 1) expanded' + | _ -> + None + in + expand 1 expanded + +let rec normalize_pair_item ?(right = false) = function + | P (i, a, b) -> + P (i, normalize_pair_item a, normalize_pair_item ~right:true b) + | A when right -> + I + | A -> + A + | I -> + I let unexpand_pappaiir expanded = match expanded with - | Seq (_, [ Prim (_, "PAIR", [], []) ]) -> Some expanded - | Seq (loc, (_ :: _ as nodes)) -> - let rec exec stack nodes = match nodes, stack with - | [], _ -> stack - | Prim (_, "DIP", [ Seq (_, sub) ], []) :: rest, a :: rstack -> + | Seq (_, [Prim (_, "PAIR", [], [])]) -> + Some expanded + | Seq (loc, (_ :: _ as nodes)) -> ( + let rec exec stack nodes = + match (nodes, stack) with + | ([], _) -> + stack + (* support new expansion using [DIP n] *) + | ( Prim (ploc, "DIP", [Int (loc, n); Seq (sloc, sub)], []) :: rest, + a :: rstack ) + when Z.to_int n > 1 -> + exec + ( a + :: exec + rstack + [ Prim + (ploc, "DIP", [Int (loc, Z.pred n); Seq (sloc, sub)], []) + ] ) + rest + | (Prim (_, "DIP", [Int (_, n); Seq (_, sub)], []) :: rest, a :: rstack) + when Z.to_int n = 1 -> exec (a :: exec rstack sub) rest - | Prim (_, "DIP", [ Seq (_, sub) ], []) :: rest, [] -> + | (Prim (ploc, "DIP", [Int (loc, n); Seq (sloc, sub)], []) :: rest, []) + when Z.to_int n > 1 -> + exec + ( A + :: exec + [] + [ Prim + (ploc, "DIP", [Int (loc, Z.pred n); Seq (sloc, sub)], []) + ] ) + rest + | (Prim (_, "DIP", [Int (_, n); Seq (_, sub)], []) :: rest, []) + when Z.to_int n = 1 -> exec (A :: exec [] sub) rest - | Prim (_, "PAIR", [], []) :: rest, a :: b :: rstack -> + (* support old expansion using [DIP] *) + | (Prim (_, "DIP", [Seq (_, sub)], []) :: rest, a :: rstack) -> + exec (a :: exec rstack sub) rest + | (Prim (_, "DIP", [Seq (_, sub)], []) :: rest, []) -> + exec (A :: exec [] sub) rest + | (Prim (_, "PAIR", [], []) :: rest, a :: b :: rstack) -> exec (P (0, a, b) :: rstack) rest - | Prim (_, "PAIR", [], []) :: rest, [ a ] -> - exec [ P (0, a, I) ] rest - | Prim (_, "PAIR", [], []) :: rest, [] -> - exec [ P (0, A, I) ] rest - | _ -> raise_notrace Not_a_pair in - begin match exec [] nodes with - | [] -> None - | res :: _ -> - let res = normalize_pair_item res in - let name = unparse_pair_item res in - Some (Prim (loc, name, [], [])) - | exception Not_a_pair -> None - end - | _ -> None + | (Prim (_, "PAIR", [], []) :: rest, [a]) -> + exec [P (0, a, I)] rest + | (Prim (_, "PAIR", [], []) :: rest, []) -> + exec [P (0, A, I)] rest + | _ -> + raise_notrace Not_a_pair + in + match exec [] nodes with + | [] -> + None + | res :: _ -> + let res = normalize_pair_item res in + let name = unparse_pair_item res in + Some (Prim (loc, name, [], [])) + | exception Not_a_pair -> + None ) + | _ -> + None let unexpand_unpappaiir expanded = match expanded with - | Seq (loc, (_ :: _ as nodes)) -> - let rec exec stack nodes = match nodes, stack with - | [], _ -> stack - | Prim (_, "DIP", [ Seq (_, sub) ], []) :: rest, a :: rstack -> + | Seq (loc, (_ :: _ as nodes)) -> ( + let rec exec stack nodes = + match (nodes, stack) with + | ([], _) -> + stack + (* support new expansion using [DIP n] *) + | ( Prim (ploc, "DIP", [Int (loc, n); Seq (sloc, sub)], []) :: rest, + a :: rstack ) + when Z.to_int n > 1 -> + exec + ( a + :: exec + rstack + [ Prim + (ploc, "DIP", [Int (loc, Z.pred n); Seq (sloc, sub)], []) + ] ) + rest + | (Prim (_, "DIP", [Int (_, n); Seq (_, sub)], []) :: rest, a :: rstack) + when Z.to_int n = 1 -> exec (a :: exec rstack sub) rest - | Prim (_, "DIP", [ Seq (_, sub) ], []) :: rest, [] -> + | (Prim (ploc, "DIP", [Int (loc, n); Seq (sloc, sub)], []) :: rest, []) + when Z.to_int n > 1 -> + exec + ( A + :: exec + [] + [ Prim + (ploc, "DIP", [Int (loc, Z.pred n); Seq (sloc, sub)], []) + ] ) + rest + | (Prim (_, "DIP", [Int (_, n); Seq (_, sub)], []) :: rest, []) + when Z.to_int n = 1 -> exec (A :: exec [] sub) rest - | Seq (_, [ Prim (_, "DUP", [], []) ; - Prim (_, "CAR", [], []) ; - Prim (_, "DIP", - [ Seq (_, [ Prim (_, "CDR", [], []) ]) ], - []) ]) :: rest, - a :: b :: rstack -> + (* support old expansion using [DIP] *) + | (Prim (_, "DIP", [Seq (_, sub)], []) :: rest, a :: rstack) -> + exec (a :: exec rstack sub) rest + | (Prim (_, "DIP", [Seq (_, sub)], []) :: rest, []) -> + exec (A :: exec [] sub) rest + | ( Seq + ( _, + [ Prim (_, "DUP", [], []); + Prim (_, "CAR", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CDR", [], [])])], []) ] + ) + :: rest, + a :: b :: rstack ) -> exec (P (0, a, b) :: rstack) rest - | Seq (_, [ Prim (_, "DUP", [], []) ; - Prim (_, "CAR", [], []) ; - Prim (_, "DIP", - [ Seq (_, [ Prim (_, "CDR", [], []) ]) ], - []) ]) :: rest, - [ a ] -> - exec [ P (0, a, I) ] rest - | Seq (_, [ Prim (_, "DUP", [], []) ; - Prim (_, "CAR", [], []) ; - Prim (_, "DIP", - [ Seq (_, [ Prim (_, "CDR", [], []) ]) ], - []) ]) :: rest, - [] -> - exec [ P (0, A, I) ] rest - | _ -> raise_notrace Not_a_pair in - begin match exec [] (List.rev nodes) with - | [] -> None - | res :: _ -> - let res = normalize_pair_item res in - let name = "UN" ^ unparse_pair_item res in - Some (Prim (loc, name, [], [])) - | exception Not_a_pair -> None - end - | _ -> None - + | ( Seq + ( _, + [ Prim (_, "DUP", [], []); + Prim (_, "CAR", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CDR", [], [])])], []) ] + ) + :: rest, + [a] ) -> + exec [P (0, a, I)] rest + | ( Seq + ( _, + [ Prim (_, "DUP", [], []); + Prim (_, "CAR", [], []); + Prim (_, "DIP", [Seq (_, [Prim (_, "CDR", [], [])])], []) ] + ) + :: rest, + [] ) -> + exec [P (0, A, I)] rest + | _ -> + raise_notrace Not_a_pair + in + match exec [] (List.rev nodes) with + | [] -> + None + | res :: _ -> + let res = normalize_pair_item res in + let name = "UN" ^ unparse_pair_item res in + Some (Prim (loc, name, [], [])) + | exception Not_a_pair -> + None ) + | _ -> + None let unexpand_compare expanded = match expanded with - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "EQ", [], annot) ]) -> + | Seq (loc, [Prim (_, "COMPARE", [], _); Prim (_, "EQ", [], annot)]) -> Some (Prim (loc, "CMPEQ", [], annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "NEQ", [], annot) ]) -> + | Seq (loc, [Prim (_, "COMPARE", [], _); Prim (_, "NEQ", [], annot)]) -> Some (Prim (loc, "CMPNEQ", [], annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "LT", [], annot) ]) -> + | Seq (loc, [Prim (_, "COMPARE", [], _); Prim (_, "LT", [], annot)]) -> Some (Prim (loc, "CMPLT", [], annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "GT", [], annot) ]) -> + | Seq (loc, [Prim (_, "COMPARE", [], _); Prim (_, "GT", [], annot)]) -> Some (Prim (loc, "CMPGT", [], annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "LE", [], annot) ]) -> + | Seq (loc, [Prim (_, "COMPARE", [], _); Prim (_, "LE", [], annot)]) -> Some (Prim (loc, "CMPLE", [], annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "GE", [], annot) ]) -> + | Seq (loc, [Prim (_, "COMPARE", [], _); Prim (_, "GE", [], annot)]) -> Some (Prim (loc, "CMPGE", [], annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "EQ", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq + ( loc, + [ Prim (_, "COMPARE", [], _); + Prim (_, "EQ", [], _); + Prim (_, "IF", args, annot) ] ) -> Some (Prim (loc, "IFCMPEQ", args, annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "NEQ", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq + ( loc, + [ Prim (_, "COMPARE", [], _); + Prim (_, "NEQ", [], _); + Prim (_, "IF", args, annot) ] ) -> Some (Prim (loc, "IFCMPNEQ", args, annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "LT", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq + ( loc, + [ Prim (_, "COMPARE", [], _); + Prim (_, "LT", [], _); + Prim (_, "IF", args, annot) ] ) -> Some (Prim (loc, "IFCMPLT", args, annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "GT", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq + ( loc, + [ Prim (_, "COMPARE", [], _); + Prim (_, "GT", [], _); + Prim (_, "IF", args, annot) ] ) -> Some (Prim (loc, "IFCMPGT", args, annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "LE", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq + ( loc, + [ Prim (_, "COMPARE", [], _); + Prim (_, "LE", [], _); + Prim (_, "IF", args, annot) ] ) -> Some (Prim (loc, "IFCMPLE", args, annot)) - | Seq (loc, [ Prim (_, "COMPARE", [], _) ; - Prim (_, "GE", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq + ( loc, + [ Prim (_, "COMPARE", [], _); + Prim (_, "GE", [], _); + Prim (_, "IF", args, annot) ] ) -> Some (Prim (loc, "IFCMPGE", args, annot)) - | Seq (loc, [ Prim (_, "EQ", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq (loc, [Prim (_, "EQ", [], _); Prim (_, "IF", args, annot)]) -> Some (Prim (loc, "IFEQ", args, annot)) - | Seq (loc, [ Prim (_, "NEQ", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq (loc, [Prim (_, "NEQ", [], _); Prim (_, "IF", args, annot)]) -> Some (Prim (loc, "IFNEQ", args, annot)) - | Seq (loc, [ Prim (_, "LT", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq (loc, [Prim (_, "LT", [], _); Prim (_, "IF", args, annot)]) -> Some (Prim (loc, "IFLT", args, annot)) - | Seq (loc, [ Prim (_, "GT", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq (loc, [Prim (_, "GT", [], _); Prim (_, "IF", args, annot)]) -> Some (Prim (loc, "IFGT", args, annot)) - | Seq (loc, [ Prim (_, "LE", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq (loc, [Prim (_, "LE", [], _); Prim (_, "IF", args, annot)]) -> Some (Prim (loc, "IFLE", args, annot)) - | Seq (loc, [ Prim (_, "GE", [], _) ; - Prim (_, "IF", args, annot) ]) -> + | Seq (loc, [Prim (_, "GE", [], _); Prim (_, "IF", args, annot)]) -> Some (Prim (loc, "IFGE", args, annot)) - | _ -> None + | _ -> + None let unexpand_asserts expanded = match expanded with - | Seq (loc, [ Prim (_, "IF", [ Seq (_, []) ; - Seq (_, [ - Seq (_, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF", + [ Seq (_, []); + Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT", [], [])) - | Seq (loc, [ Seq (_, [ Prim(_, "COMPARE", [], []) ; Prim (_, comparison, [], []) ]) ; - Prim (_, "IF", [ Seq (_, []) ; - Seq (_, [ - Seq (_, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ], - []) ]) -> + | Seq + ( loc, + [ Seq (_, [Prim (_, "COMPARE", [], []); Prim (_, comparison, [], [])]); + Prim + ( _, + "IF", + [ Seq (_, []); + Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_CMP" ^ comparison, [], [])) - | Seq (loc, [ Prim (_, comparison, [], []) ; - Prim (_, "IF", [ Seq (_, []) ; - Seq (_, [ - Seq (_, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ], - []) ]) -> + | Seq + ( loc, + [ Prim (_, comparison, [], []); + Prim + ( _, + "IF", + [ Seq (_, []); + Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_" ^ comparison, [], [])) - | Seq (loc, [ Prim (_, "IF_NONE", [ Seq (_, [ Prim (_, "RENAME", [], annot) ]) ; - Seq (_, [ - Seq (_, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_NONE", + [ Seq (_, [Prim (_, "RENAME", [], annot)]); + Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_NONE", [], annot)) - | Seq (loc, [ Prim (_, "IF_NONE", [ Seq (_, []) ; - Seq (_, [ - Seq (_, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_NONE", + [ Seq (_, []); + Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_NONE", [], [])) - | Seq (loc, [ Prim (_, "IF_NONE", [ Seq (_, [ Seq (_, [ Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ; - Seq (_, [])], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_NONE", + [ Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ); + Seq (_, []) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_SOME", [], [])) - | Seq (loc, [ Prim (_, "IF_NONE", [ Seq (_, [ Seq (_, [ Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ; - Seq (_, [ Prim (_, "RENAME", [], annot) ])], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_NONE", + [ Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ); + Seq (_, [Prim (_, "RENAME", [], annot)]) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_SOME", [], annot)) - | Seq (loc, [ Prim (_, "IF_LEFT", [ Seq (_, []) ; - Seq (_, [ - Seq (_, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_LEFT", + [ Seq (_, []); + Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_LEFT", [], [])) - | Seq (loc, [ Prim (_, "IF_LEFT", [ Seq (_, [ Prim (_, "RENAME", [], annot) ]) ; - Seq (_, [ - Seq (_, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_LEFT", + [ Seq (_, [Prim (_, "RENAME", [], annot)]); + Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_LEFT", [], annot)) - | Seq (loc, [ Prim (_, "IF_LEFT", [ Seq (_, [ Seq (_, [ Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ; - Seq (_, []) ], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_LEFT", + [ Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ); + Seq (_, []) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_RIGHT", [], [])) - | Seq (loc, [ Prim (_, "IF_LEFT", [ Seq (_, [ Seq (_, [ Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ]) ]) ; - Seq (_, [ Prim (_, "RENAME", [], annot) ]) ], - []) ]) -> + | Seq + ( loc, + [ Prim + ( _, + "IF_LEFT", + [ Seq + ( _, + [ Seq + ( _, + [ Prim (_, "UNIT", [], []); + Prim (_, "FAILWITH", [], []) ] ) ] ); + Seq (_, [Prim (_, "RENAME", [], annot)]) ], + [] ) ] ) -> Some (Prim (loc, "ASSERT_RIGHT", [], annot)) - | _ -> None - + | _ -> + None let unexpand_if_some = function - | Seq (loc, [ Prim (_, "IF_NONE", [ left ; right ], annot) ]) -> - Some (Prim (loc, "IF_SOME", [ right ; left ], annot)) - | _ -> None + | Seq (loc, [Prim (_, "IF_NONE", [left; right], annot)]) -> + Some (Prim (loc, "IF_SOME", [right; left], annot)) + | _ -> + None let unexpand_if_right = function - | Seq (loc, [ Prim (_, "IF_LEFT", [ left ; right ], annot) ]) -> - Some (Prim (loc, "IF_RIGHT", [ right ; left ], annot)) - | _ -> None + | Seq (loc, [Prim (_, "IF_LEFT", [left; right], annot)]) -> + Some (Prim (loc, "IF_RIGHT", [right; left], annot)) + | _ -> + None let unexpand_fail = function - | Seq (loc, [ - Prim (_, "UNIT", [], []) ; - Prim (_, "FAILWITH", [], []) ; - ]) -> + | Seq (loc, [Prim (_, "UNIT", [], []); Prim (_, "FAILWITH", [], [])]) -> Some (Prim (loc, "FAIL", [], [])) - | _ -> None + | _ -> + None let unexpand original = let try_unexpansions unexpanders = match List.fold_left (fun acc f -> - match acc with - | None -> f original - | Some rewritten -> Some rewritten) - None unexpanders with - | None -> original - | Some rewritten -> rewritten in + match acc with + | None -> + f original + | Some rewritten -> + Some rewritten) + None + unexpanders + with + | None -> + original + | Some rewritten -> + rewritten + in try_unexpansions - [ unexpand_asserts ; - unexpand_caddadr ; - unexpand_set_caddadr ; - unexpand_map_caddadr ; - unexpand_dxiiivp ; - unexpand_pappaiir ; - unexpand_unpappaiir ; - unexpand_duuuuup ; - unexpand_compare ; - unexpand_if_some ; - unexpand_if_right ; + [ unexpand_asserts; + unexpand_caddadr; + unexpand_set_caddadr; + unexpand_map_caddadr; + unexpand_deprecated_dxiiivp; + unexpand_pappaiir; + unexpand_unpappaiir; + unexpand_deprecated_duuuuup; + unexpand_dupn; + unexpand_compare; + unexpand_if_some; + unexpand_if_right; unexpand_fail ] -let rec unexpand_rec expr = - match unexpand expr with +(* + If an argument of Prim is a sequence, we do not want to unexpand + its root in case the source already contains an expanded macro. In + which case unexpansion would remove surrounding braces and generate + ill-formed code. + + For example, DIIP { DIP { DUP }; SWAP } is not unexpandable but + DIIP {{ DIP { DUP }; SWAP }} (note the double braces) is unexpanded + to DIIP { DUUP }. + + unexpand_rec_but_root is the same as unexpand_rec but does not try + to unexpand at root *) + +let rec unexpand_rec expr = unexpand_rec_but_root (unexpand expr) + +and unexpand_rec_but_root = function | Seq (loc, items) -> Seq (loc, List.map unexpand_rec items) | Prim (loc, name, args, annot) -> - Prim (loc, name, List.map unexpand_rec args, annot) - | Int _ | String _ | Bytes _ as atom -> atom + Prim (loc, name, List.map unexpand_rec_but_root args, annot) + | (Int _ | String _ | Bytes _) as atom -> + atom let () = let open Data_encoding in @@ -1134,15 +1507,12 @@ let () = `Permanent ~id:"michelson.macros.unexpected_annotation" ~title:"Unexpected annotation" - ~description:"A macro had an annotation, but no annotation was permitted on this macro." - ~pp:(fun ppf -> - Format.fprintf ppf - "Unexpected annotation on macro %s.") - (obj1 - (req "macro_name" string)) - (function - | Unexpected_macro_annotation str -> Some str - | _ -> None) + ~description: + "A macro had an annotation, but no annotation was permitted on this \ + macro." + ~pp:(fun ppf -> Format.fprintf ppf "Unexpected annotation on macro %s.") + (obj1 (req "macro_name" string)) + (function Unexpected_macro_annotation str -> Some str | _ -> None) (fun s -> Unexpected_macro_annotation s) ; register_error_kind `Permanent @@ -1150,13 +1520,12 @@ let () = ~title:"Macro expects a sequence" ~description:"An macro expects a sequence, but a sequence was not provided" ~pp:(fun ppf name -> - Format.fprintf ppf - "Macro %s expects a sequence, but did not receive one." name) - (obj1 - (req "macro_name" string)) - (function - | Sequence_expected name -> Some name - | _ -> None) + Format.fprintf + ppf + "Macro %s expects a sequence, but did not receive one." + name) + (obj1 (req "macro_name" string)) + (function Sequence_expected name -> Some name | _ -> None) (fun name -> Sequence_expected name) ; register_error_kind `Permanent @@ -1164,13 +1533,16 @@ let () = ~title:"Wrong number of arguments to macro" ~description:"A wrong number of arguments was provided to a macro" ~pp:(fun ppf (name, got, exp) -> - Format.fprintf ppf - "Macro %s expects %d arguments, was given %d." name got exp) + Format.fprintf + ppf + "Macro %s expects %d arguments, was given %d." + name + exp + got) (obj3 (req "macro_name" string) (req "given_number_of_arguments" uint16) (req "expected_number_of_arguments" uint16)) (function - | Invalid_arity (name, got, exp) -> Some (name, got, exp) - | _ -> None) + | Invalid_arity (name, got, exp) -> Some (name, got, exp) | _ -> None) (fun (name, got, exp) -> Invalid_arity (name, got, exp)) diff --git a/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.mli b/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.mli index 4a614cbc0..352a59b00 100644 --- a/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.mli +++ b/vendors/ligo-utils/tezos-utils/michelson-parser/michelson_v1_macros.mli @@ -28,35 +28,59 @@ open Tezos_micheline type 'l node = ('l, string) Micheline.node type error += Unexpected_macro_annotation of string + type error += Sequence_expected of string + type error += Invalid_arity of string * int * int val expand : 'l node -> 'l node tzresult + val expand_rec : 'l node -> 'l node * error list val expand_caddadr : 'l node -> 'l node option tzresult + val expand_set_caddadr : 'l node -> 'l node option tzresult + val expand_map_caddadr : 'l node -> 'l node option tzresult -val expand_dxiiivp : 'l node -> 'l node option tzresult + +val expand_deprecated_dxiiivp : 'l node -> 'l node option tzresult + val expand_pappaiir : 'l node -> 'l node option tzresult -val expand_duuuuup : 'l node -> 'l node option tzresult + +val expand_deprecated_duuuuup : 'l node -> 'l node option tzresult + val expand_compare : 'l node -> 'l node option tzresult + val expand_asserts : 'l node -> 'l node option tzresult + val expand_unpappaiir : 'l node -> 'l node option tzresult + val expand_if_some : 'l node -> 'l node option tzresult + val expand_if_right : 'l node -> 'l node option tzresult val unexpand : 'l node -> 'l node + val unexpand_rec : 'l node -> 'l node val unexpand_caddadr : 'l node -> 'l node option + val unexpand_set_caddadr : 'l node -> 'l node option + val unexpand_map_caddadr : 'l node -> 'l node option -val unexpand_dxiiivp : 'l node -> 'l node option + +val unexpand_deprecated_dxiiivp : 'l node -> 'l node option + val unexpand_pappaiir : 'l node -> 'l node option -val unexpand_duuuuup : 'l node -> 'l node option + +val unexpand_deprecated_duuuuup : 'l node -> 'l node option + val unexpand_compare : 'l node -> 'l node option + val unexpand_asserts : 'l node -> 'l node option + val unexpand_unpappaiir : 'l node -> 'l node option + val unexpand_if_some : 'l node -> 'l node option + val unexpand_if_right : 'l node -> 'l node option From 395b4890ebd6c018136748c45fd4576383aeb583 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Wed, 12 Feb 2020 19:00:40 +0100 Subject: [PATCH 095/119] update the `dune.inc` magic trick --- .../ligo-utils/tezos-protocol-alpha/dune.inc | 46 +++++++++---------- ...tezos-embedded-protocol-006-PsCARTHA.opam} | 6 +-- ....opam => tezos-protocol-006-PsCARTHA.opam} | 4 +- 3 files changed, 28 insertions(+), 28 deletions(-) rename vendors/ligo-utils/tezos-protocol-alpha/{tezos-embedded-protocol-005-PsBabyM1.opam => tezos-embedded-protocol-006-PsCARTHA.opam} (89%) rename vendors/ligo-utils/tezos-protocol-alpha/{tezos-protocol-005-PsBabyM1.opam => tezos-protocol-006-PsCARTHA.opam} (92%) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/dune.inc b/vendors/ligo-utils/tezos-protocol-alpha/dune.inc index cf411a5e3..1d0ec5fae 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/dune.inc +++ b/vendors/ligo-utils/tezos-protocol-alpha/dune.inc @@ -11,7 +11,7 @@ (targets environment.ml) (action (write-file %{targets} - "module Name = struct let name = \"005-PsBabyM1\" end + "module Name = struct let name = \"006-PsCARTHA\" end include Tezos_protocol_environment.MakeV1(Name)() module CamlinternalFormatBasics = struct include CamlinternalFormatBasics end "))) @@ -22,7 +22,7 @@ module CamlinternalFormatBasics = struct include CamlinternalFormatBasics end (:src_dir TEZOS_PROTOCOL)) (action (with-stdout-to %{targets} - (chdir %{workspace_root} (run %{bin:tezos-embedded-protocol-packer} "%{src_dir}" "005_PsBabyM1"))))) + (chdir %{workspace_root} (run %{bin:tezos-embedded-protocol-packer} "%{src_dir}" "006_PsCARTHA"))))) (rule (targets functor.ml) @@ -37,67 +37,67 @@ module CamlinternalFormatBasics = struct include CamlinternalFormatBasics end (deps misc.mli misc.ml storage_description.mli storage_description.ml state_hash.ml nonce_hash.ml script_expr_hash.ml contract_hash.ml blinded_public_key_hash.mli blinded_public_key_hash.ml qty_repr.ml tez_repr.mli tez_repr.ml period_repr.mli period_repr.ml time_repr.mli time_repr.ml constants_repr.ml fitness_repr.ml raw_level_repr.mli raw_level_repr.ml voting_period_repr.mli voting_period_repr.ml cycle_repr.mli cycle_repr.ml level_repr.mli level_repr.ml seed_repr.mli seed_repr.ml gas_limit_repr.mli gas_limit_repr.ml script_int_repr.mli script_int_repr.ml script_timestamp_repr.mli script_timestamp_repr.ml michelson_v1_primitives.mli michelson_v1_primitives.ml script_repr.mli script_repr.ml legacy_script_support_repr.mli legacy_script_support_repr.ml contract_repr.mli contract_repr.ml roll_repr.mli roll_repr.ml vote_repr.mli vote_repr.ml block_header_repr.mli block_header_repr.ml operation_repr.mli operation_repr.ml manager_repr.mli manager_repr.ml commitment_repr.mli commitment_repr.ml parameters_repr.mli parameters_repr.ml raw_context.mli raw_context.ml storage_sigs.ml storage_functors.mli storage_functors.ml storage.mli storage.ml constants_storage.ml level_storage.mli level_storage.ml nonce_storage.mli nonce_storage.ml seed_storage.mli seed_storage.ml roll_storage.mli roll_storage.ml delegate_storage.mli delegate_storage.ml contract_storage.mli contract_storage.ml bootstrap_storage.mli bootstrap_storage.ml fitness_storage.ml vote_storage.mli vote_storage.ml commitment_storage.mli commitment_storage.ml init_storage.ml fees_storage.mli fees_storage.ml alpha_context.mli alpha_context.ml script_typed_ir.ml script_tc_errors.ml michelson_v1_gas.mli michelson_v1_gas.ml script_ir_annot.mli script_ir_annot.ml script_ir_translator.mli script_ir_translator.ml script_tc_errors_registration.ml script_interpreter.mli script_interpreter.ml baking.mli baking.ml amendment.mli amendment.ml apply_results.mli apply_results.ml apply.ml services_registration.ml constants_services.mli constants_services.ml contract_services.mli contract_services.ml delegate_services.mli delegate_services.ml helpers_services.mli helpers_services.ml voting_services.mli voting_services.ml alpha_services.mli alpha_services.ml main.mli main.ml) (action (write-file %{targets} - "module Environment = Tezos_protocol_environment_005_PsBabyM1.Environment -let hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS\" + "module Environment = Tezos_protocol_environment_006_PsCARTHA.Environment +let hash = Tezos_crypto.Protocol_hash.of_b58check_exn \"PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb\" let name = Environment.Name.name -include Tezos_raw_protocol_005_PsBabyM1 -include Tezos_raw_protocol_005_PsBabyM1.Main +include Tezos_raw_protocol_006_PsCARTHA +include Tezos_raw_protocol_006_PsCARTHA.Main "))) (library - (name tezos_protocol_environment_005_PsBabyM1) - (public_name tezos-protocol-005-PsBabyM1.environment) + (name tezos_protocol_environment_006_PsCARTHA) + (public_name tezos-protocol-006-PsCARTHA.environment) (library_flags (:standard -linkall)) (libraries tezos-protocol-environment) (modules Environment)) (library - (name tezos_raw_protocol_005_PsBabyM1) - (public_name tezos-protocol-005-PsBabyM1.raw) - (libraries tezos_protocol_environment_005_PsBabyM1) + (name tezos_raw_protocol_006_PsCARTHA) + (public_name tezos-protocol-006-PsCARTHA.raw) + (libraries tezos_protocol_environment_006_PsCARTHA) (library_flags (:standard -linkall)) (flags (:standard -nopervasives -nostdlib -w +a-4-6-7-9-29-32-40..42-44-45-48 -warn-error -a+8 - -open Tezos_protocol_environment_005_PsBabyM1__Environment + -open Tezos_protocol_environment_006_PsCARTHA__Environment -open Pervasives -open Error_monad)) (modules Misc Storage_description State_hash Nonce_hash Script_expr_hash Contract_hash Blinded_public_key_hash Qty_repr Tez_repr Period_repr Time_repr Constants_repr Fitness_repr Raw_level_repr Voting_period_repr Cycle_repr Level_repr Seed_repr Gas_limit_repr Script_int_repr Script_timestamp_repr Michelson_v1_primitives Script_repr Legacy_script_support_repr Contract_repr Roll_repr Vote_repr Block_header_repr Operation_repr Manager_repr Commitment_repr Parameters_repr Raw_context Storage_sigs Storage_functors Storage Constants_storage Level_storage Nonce_storage Seed_storage Roll_storage Delegate_storage Contract_storage Bootstrap_storage Fitness_storage Vote_storage Commitment_storage Init_storage Fees_storage Alpha_context Script_typed_ir Script_tc_errors Michelson_v1_gas Script_ir_annot Script_ir_translator Script_tc_errors_registration Script_interpreter Baking Amendment Apply_results Apply Services_registration Constants_services Contract_services Delegate_services Helpers_services Voting_services Alpha_services Main)) (install (section lib) - (package tezos-protocol-005-PsBabyM1) + (package tezos-protocol-006-PsCARTHA) (files (TEZOS_PROTOCOL as raw/TEZOS_PROTOCOL))) (library - (name tezos_protocol_005_PsBabyM1) - (public_name tezos-protocol-005-PsBabyM1) + (name tezos_protocol_006_PsCARTHA) + (public_name tezos-protocol-006-PsCARTHA) (libraries tezos-protocol-environment tezos-protocol-environment-sigs - tezos_raw_protocol_005_PsBabyM1) + tezos_raw_protocol_006_PsCARTHA) (flags -w "+a-4-6-7-9-29-40..42-44-45-48" -warn-error "-a+8" -nopervasives) (modules Protocol)) (library - (name tezos_protocol_005_PsBabyM1_functor) - (public_name tezos-protocol-005-PsBabyM1.functor) + (name tezos_protocol_006_PsCARTHA_functor) + (public_name tezos-protocol-006-PsCARTHA.functor) (libraries tezos-protocol-environment tezos-protocol-environment-sigs - tezos_raw_protocol_005_PsBabyM1) + tezos_raw_protocol_006_PsCARTHA) (flags -w "+a-4-6-7-9-29-40..42-44-45-48" -warn-error "-a+8" -nopervasives) (modules Functor)) (library - (name tezos_embedded_protocol_005_PsBabyM1) - (public_name tezos-embedded-protocol-005-PsBabyM1) + (name tezos_embedded_protocol_006_PsCARTHA) + (public_name tezos-embedded-protocol-006-PsCARTHA) (library_flags (:standard -linkall)) - (libraries tezos-protocol-005-PsBabyM1 + (libraries tezos-protocol-006-PsCARTHA tezos-protocol-updater tezos-protocol-environment) (flags (:standard -w +a-4-6-7-9-29-32-40..42-44-45-48 @@ -106,4 +106,4 @@ include Tezos_raw_protocol_005_PsBabyM1.Main (alias (name runtest_sandbox) - (deps .tezos_protocol_005_PsBabyM1.objs/native/tezos_protocol_005_PsBabyM1.cmx)) + (deps .tezos_protocol_006_PsCARTHA.objs/native/tezos_protocol_006_PsCARTHA.cmx)) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/tezos-embedded-protocol-005-PsBabyM1.opam b/vendors/ligo-utils/tezos-protocol-alpha/tezos-embedded-protocol-006-PsCARTHA.opam similarity index 89% rename from vendors/ligo-utils/tezos-protocol-alpha/tezos-embedded-protocol-005-PsBabyM1.opam rename to vendors/ligo-utils/tezos-protocol-alpha/tezos-embedded-protocol-006-PsCARTHA.opam index d1468da55..02c8d046d 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/tezos-embedded-protocol-005-PsBabyM1.opam +++ b/vendors/ligo-utils/tezos-protocol-alpha/tezos-embedded-protocol-006-PsCARTHA.opam @@ -8,9 +8,9 @@ license: "MIT" depends: [ "tezos-tooling" { with-test } "ocamlfind" { build } - "dune" { build & >= "1.7" } + "dune" { >= "1.7" } "tezos-base" - "tezos-protocol-005-PsBabyM1" + "tezos-protocol-006-PsCARTHA" "tezos-protocol-compiler" "tezos-protocol-updater" ] @@ -19,7 +19,7 @@ build: [ "%{tezos-protocol-compiler:lib}%/replace" "%{tezos-protocol-compiler:lib}%/dune_protocol.template" "dune" - "005_PsBabyM1" + "006_PsCARTHA" ] ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name "-j" jobs] {with-test} diff --git a/vendors/ligo-utils/tezos-protocol-alpha/tezos-protocol-005-PsBabyM1.opam b/vendors/ligo-utils/tezos-protocol-alpha/tezos-protocol-006-PsCARTHA.opam similarity index 92% rename from vendors/ligo-utils/tezos-protocol-alpha/tezos-protocol-005-PsBabyM1.opam rename to vendors/ligo-utils/tezos-protocol-alpha/tezos-protocol-006-PsCARTHA.opam index d1497019b..08f2c0c57 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/tezos-protocol-005-PsBabyM1.opam +++ b/vendors/ligo-utils/tezos-protocol-alpha/tezos-protocol-006-PsCARTHA.opam @@ -8,7 +8,7 @@ license: "MIT" depends: [ "tezos-tooling" { with-test } "ocamlfind" { build } - "dune" { build & >= "1.7" } + "dune" { >= "1.7" } "tezos-base" "tezos-protocol-compiler" ] @@ -17,7 +17,7 @@ build: [ "%{tezos-protocol-compiler:lib}%/replace" "%{tezos-protocol-compiler:lib}%/dune_protocol.template" "dune" - "005_PsBabyM1" + "006_PsCARTHA" ] ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name "-j" jobs] {with-test} From e63f2407c2ff4301ed54f07851f4fd9de6848784 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 13 Feb 2020 14:09:45 +0100 Subject: [PATCH 096/119] carthage update: * update dune & opam files * update modules in source --- src/main/run/of_michelson.ml | 4 ++-- vendors/ligo-utils/memory-proto-alpha/dune | 2 +- .../memory-proto-alpha/memory_proto_alpha.ml | 4 ++-- .../memory-proto-alpha/tezos-memory-proto-alpha.opam | 2 +- vendors/ligo-utils/proto-alpha-utils/dune | 4 ++-- .../ligo-utils/proto-alpha-utils/init_proto_alpha.ml | 2 +- .../proto-alpha-utils/proto-alpha-utils.opam | 2 +- .../ligo-utils/tezos-protocol-alpha-parameters/dune | 12 ++++++------ .../tezos-protocol-alpha-parameters/dune-project | 2 +- ...m => tezos-protocol-006-PsCARTHA-parameters.opam} | 7 ++++--- .../ligo-utils/tezos-protocol-alpha/TEZOS_PROTOCOL | 2 +- vendors/ligo-utils/tezos-protocol-alpha/dune-project | 2 +- 12 files changed, 23 insertions(+), 22 deletions(-) rename vendors/ligo-utils/tezos-protocol-alpha-parameters/{tezos-protocol-005-PsBabyM1-parameters.opam => tezos-protocol-006-PsCARTHA-parameters.opam} (73%) diff --git a/src/main/run/of_michelson.ml b/src/main/run/of_michelson.ml index b8222d44c..4a9b7e1c3 100644 --- a/src/main/run/of_michelson.ml +++ b/src/main/run/of_michelson.ml @@ -97,7 +97,7 @@ let fetch_lambda_types (contract_ty:ex_ty) = | _ -> simple_fail "failed to fetch lambda types" let run_contract ?options (exp:Michelson.t) (exp_type:ex_ty) (input_michelson:Michelson.t) : run_res result = - let open! Tezos_raw_protocol_005_PsBabyM1 in + let open! Tezos_raw_protocol_006_PsCARTHA in let%bind (Ex_ty input_ty, Ex_ty output_ty) = fetch_lambda_types exp_type in let%bind input = Trace.trace_tzresult_lwt (simple_error "error parsing input") @@ @@ -127,7 +127,7 @@ let run_contract ?options (exp:Michelson.t) (exp_type:ex_ty) (input_michelson:Mi | _ -> fail @@ Errors.unknown_failwith_type () ) let run_expression ?options (exp:Michelson.t) (exp_type:ex_ty) : run_res result = - let open! Tezos_raw_protocol_005_PsBabyM1 in + let open! Tezos_raw_protocol_006_PsCARTHA in let (Ex_ty exp_type') = exp_type in let exp = Michelson.strip_annots exp in let top_level = Script_ir_translator.Lambda diff --git a/vendors/ligo-utils/memory-proto-alpha/dune b/vendors/ligo-utils/memory-proto-alpha/dune index 0df6b91ad..207473d50 100644 --- a/vendors/ligo-utils/memory-proto-alpha/dune +++ b/vendors/ligo-utils/memory-proto-alpha/dune @@ -3,6 +3,6 @@ (public_name tezos-memory-proto-alpha) (libraries tezos-protocol-environment - tezos-protocol-005-PsBabyM1 + tezos-protocol-006-PsCARTHA ) ) diff --git a/vendors/ligo-utils/memory-proto-alpha/memory_proto_alpha.ml b/vendors/ligo-utils/memory-proto-alpha/memory_proto_alpha.ml index 2e07e7109..5e2bc88e2 100644 --- a/vendors/ligo-utils/memory-proto-alpha/memory_proto_alpha.ml +++ b/vendors/ligo-utils/memory-proto-alpha/memory_proto_alpha.ml @@ -1,9 +1,9 @@ module Name = struct let name = "alpha" end -module Alpha_environment = Tezos_protocol_005_PsBabyM1.Protocol.Environment +module Alpha_environment = Tezos_protocol_006_PsCARTHA.Protocol.Environment type alpha_error = Alpha_environment.Error_monad.error type 'a alpha_tzresult = 'a Alpha_environment.Error_monad.tzresult module Alpha_error_monad = Alpha_environment.Error_monad -module Proto = Tezos_protocol_005_PsBabyM1 +module Proto = Tezos_protocol_006_PsCARTHA include Proto diff --git a/vendors/ligo-utils/memory-proto-alpha/tezos-memory-proto-alpha.opam b/vendors/ligo-utils/memory-proto-alpha/tezos-memory-proto-alpha.opam index 1ec466604..e6ca037cc 100644 --- a/vendors/ligo-utils/memory-proto-alpha/tezos-memory-proto-alpha.opam +++ b/vendors/ligo-utils/memory-proto-alpha/tezos-memory-proto-alpha.opam @@ -10,7 +10,7 @@ bug-reports: "https://gitlab.com/ligolang/tezos/issues" depends: [ "dune" "tezos-protocol-environment" - "tezos-protocol-005-PsBabyM1" + "tezos-protocol-006-PsCARTHA" ] build: [ ["dune" "build" "-p" name] diff --git a/vendors/ligo-utils/proto-alpha-utils/dune b/vendors/ligo-utils/proto-alpha-utils/dune index 3f8f6b3a1..df6b9a511 100644 --- a/vendors/ligo-utils/proto-alpha-utils/dune +++ b/vendors/ligo-utils/proto-alpha-utils/dune @@ -4,10 +4,10 @@ (libraries tezos-error-monad tezos-stdlib-unix - tezos-protocol-005-PsBabyM1-parameters + tezos-protocol-006-PsCARTHA-parameters tezos-memory-proto-alpha simple-utils tezos-utils ) - (flags (:standard -open Simple_utils )) + (flags (:standard -open Simple_utils)) ) diff --git a/vendors/ligo-utils/proto-alpha-utils/init_proto_alpha.ml b/vendors/ligo-utils/proto-alpha-utils/init_proto_alpha.ml index 8239c6c21..1e0a04566 100644 --- a/vendors/ligo-utils/proto-alpha-utils/init_proto_alpha.ml +++ b/vendors/ligo-utils/proto-alpha-utils/init_proto_alpha.ml @@ -105,7 +105,7 @@ module Context_init = struct Pervasives.failwith "Must have one account with a roll to bake"; (* Check there is at least one roll *) - let constants : Constants_repr.parametric = Tezos_protocol_005_PsBabyM1_parameters.Default_parameters.constants_test in + let constants : Constants_repr.parametric = Tezos_protocol_006_PsCARTHA_parameters.Default_parameters.constants_test in check_constants_consistency constants >>=? fun () -> let hash = diff --git a/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam b/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam index e0cf3abfd..d7c1638b6 100644 --- a/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam +++ b/vendors/ligo-utils/proto-alpha-utils/proto-alpha-utils.opam @@ -41,7 +41,7 @@ depends: [ "tezos-data-encoding" "tezos-protocol-environment" "tezos-protocol-alpha" - "tezos-protocol-005-PsBabyM1-parameters" + "tezos-protocol-006-PsCARTHA" "michelson-parser" "simple-utils" "tezos-utils" diff --git a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune b/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune index efccb5e51..2db13dc83 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune +++ b/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune @@ -1,22 +1,22 @@ (library - (name tezos_protocol_005_PsBabyM1_parameters) - (public_name tezos-protocol-005-PsBabyM1-parameters) + (name tezos_protocol_006_PsCARTHA_parameters) + (public_name tezos-protocol-006-PsCARTHA-parameters) (modules :standard \ gen) (libraries tezos-base tezos-protocol-environment - tezos-protocol-005-PsBabyM1) + tezos-protocol-006-PsCARTHA) (flags (:standard -open Tezos_base__TzPervasives - -open Tezos_protocol_005_PsBabyM1 + -open Tezos_protocol_006_PsCARTHA -linkall)) ) (executable (name gen) (libraries tezos-base - tezos-protocol-005-PsBabyM1-parameters) + tezos-protocol-006-PsCARTHA-parameters) (modules gen) (flags (:standard -open Tezos_base__TzPervasives - -open Tezos_protocol_005_PsBabyM1_parameters + -open Tezos_protocol_006_PsCARTHA_parameters -linkall))) (rule diff --git a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project b/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project index 6910ef322..6e6688d7b 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project +++ b/vendors/ligo-utils/tezos-protocol-alpha-parameters/dune-project @@ -1,2 +1,2 @@ (lang dune 1.11) -(name tezos-protocol-005-PsBabyM1-parameters) +(name tezos-protocol-006-PsCARTHA-parameters) diff --git a/vendors/ligo-utils/tezos-protocol-alpha-parameters/tezos-protocol-005-PsBabyM1-parameters.opam b/vendors/ligo-utils/tezos-protocol-alpha-parameters/tezos-protocol-006-PsCARTHA-parameters.opam similarity index 73% rename from vendors/ligo-utils/tezos-protocol-alpha-parameters/tezos-protocol-005-PsBabyM1-parameters.opam rename to vendors/ligo-utils/tezos-protocol-alpha-parameters/tezos-protocol-006-PsCARTHA-parameters.opam index 839f7ca54..af4e5f7e0 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha-parameters/tezos-protocol-005-PsBabyM1-parameters.opam +++ b/vendors/ligo-utils/tezos-protocol-alpha-parameters/tezos-protocol-006-PsCARTHA-parameters.opam @@ -8,12 +8,13 @@ license: "MIT" depends: [ "tezos-tooling" { with-test } "ocamlfind" { build } - "dune" { build & >= "1.7" } + "dune" { >= "1.7" } "tezos-base" "tezos-protocol-environment" - "tezos-protocol-005-PsBabyM1" + "tezos-protocol-006-PsCARTHA" ] build: [ - [ "dune" "build" "-p" name "-j" jobs ] + ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} ] synopsis: "Tezos/Protocol: parameters" diff --git a/vendors/ligo-utils/tezos-protocol-alpha/TEZOS_PROTOCOL b/vendors/ligo-utils/tezos-protocol-alpha/TEZOS_PROTOCOL index 92c00fb26..3154380de 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/TEZOS_PROTOCOL +++ b/vendors/ligo-utils/tezos-protocol-alpha/TEZOS_PROTOCOL @@ -1,5 +1,5 @@ { - "hash": "PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS", + "hash": "PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb", "modules": [ "Misc", "Storage_description", diff --git a/vendors/ligo-utils/tezos-protocol-alpha/dune-project b/vendors/ligo-utils/tezos-protocol-alpha/dune-project index d4d600dc7..d011e9a22 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/dune-project +++ b/vendors/ligo-utils/tezos-protocol-alpha/dune-project @@ -1,2 +1,2 @@ (lang dune 1.11) -(name tezos-embedded-protocol-005-PsBabyM1) +(name tezos-embedded-protocol-006-PsCARTHA) From f9d2daf7f3ad306c00303c1f5bf9acd31ab7a2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 17 Feb 2020 14:26:01 +0100 Subject: [PATCH 097/119] Run dev pipeline for *-run-dev branches --- .gitlab-ci.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c5f606e45..3678d54ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -112,6 +112,7 @@ local-dune-job: only: - merge_requests - dev + - /^.*-run-dev$/ # Run a docker build without publishing to the registry build-current-docker-image: @@ -136,10 +137,10 @@ build-and-publish-latest-docker-image: - sh scripts/build_docker_image.sh - sh scripts/test_cli.sh - echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin - - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next + - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if "$CI_COMMIT_REF_NAME" = "dev" then echo next else echo next-attempt) rules: # Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository - - if: '$CI_COMMIT_REF_NAME == "dev" && $CI_PROJECT_PATH == "ligolang/ligo"' + - if: '$CI_COMMIT_REF_NAME =~ /^(dev|.*-run-dev)$/ && $CI_PROJECT_PATH == "ligolang/ligo"' when: always # It'd be a good idea to generate those jobs dynamically, @@ -155,6 +156,7 @@ build-and-package-debian-9: <<: *build_binary only: - dev + - /^.*-run-dev$/ build-and-package-debian-10: <<: *docker @@ -171,6 +173,7 @@ build-and-package-debian-10: only: - merge_requests - dev + - /^.*-run-dev$/ build-and-package-ubuntu-18-04: <<: *docker @@ -183,6 +186,7 @@ build-and-package-ubuntu-18-04: <<: *build_binary only: - dev + - /^.*-run-dev$/ build-and-package-ubuntu-19-04: <<: *docker @@ -195,6 +199,7 @@ build-and-package-ubuntu-19-04: <<: *build_binary only: - dev + - /^.*-run-dev$/ # Pages are deployed from dev, be careful not to override 'next' # in case something gets merged into 'dev' while releasing. @@ -204,6 +209,12 @@ pages: - if: '$CI_COMMIT_REF_NAME == "dev" && $CI_PROJECT_PATH == "ligolang/ligo"' when: always +pages-attempt: + <<: *website_build + rules: + - if: '$CI_COMMIT_REF_NAME =~ /^.*-run-dev$/ && $CI_PROJECT_PATH == "ligolang/ligo"' + when: always + # WEBIDE jobs run-webide-unit-tests: @@ -264,4 +275,3 @@ deploy-handoff: rules: - if: '$CI_COMMIT_REF_NAME == "dev"' when: always - From 9f7b39afd3f5093e958bab23526c36b5127416a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Tue, 18 Feb 2020 11:37:02 +0100 Subject: [PATCH 098/119] Fix typo in script --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3678d54ae..05373e16c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -137,7 +137,7 @@ build-and-publish-latest-docker-image: - sh scripts/build_docker_image.sh - sh scripts/test_cli.sh - echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin - - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if "$CI_COMMIT_REF_NAME" = "dev" then echo next else echo next-attempt) + - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if "$CI_COMMIT_REF_NAME" = "dev" then echo next; else echo next-attempt; fi) rules: # Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository - if: '$CI_COMMIT_REF_NAME =~ /^(dev|.*-run-dev)$/ && $CI_PROJECT_PATH == "ligolang/ligo"' From fd28da98a044071362dfe4d915007903ff5f6c0e Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Fri, 14 Feb 2020 12:07:45 +0100 Subject: [PATCH 099/119] comparable pairs in the backend --- src/passes/8-compiler/compiler_type.ml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/passes/8-compiler/compiler_type.ml b/src/passes/8-compiler/compiler_type.ml index 9e7d874b0..c4874ef38 100644 --- a/src/passes/8-compiler/compiler_type.ml +++ b/src/passes/8-compiler/compiler_type.ml @@ -20,6 +20,7 @@ module Ty = struct let address_k = Address_key None let timestamp_k = Timestamp_key None let bytes_k = Bytes_key None + let pair_k a b = Pair_key ((a,None),(b,None),None) (* let timestamp_k = Timestamp_key None *) let unit = Unit_t None @@ -77,12 +78,30 @@ module Ty = struct | TC_key_hash -> return key_hash_k | TC_chain_id -> fail (not_comparable "chain_id") - let comparable_type : type_value -> ex_comparable_ty result = fun tv -> + let comparable_leaf : type a. (a, _) comparable_struct -> (a , leaf) comparable_struct result = + fun a -> + match a with + | Pair_key _ -> fail (not_comparable "pair (use (a,(b,c)) instead of (a,b,c))") + | Int_key annot -> ok (Int_key annot) + | Nat_key annot -> ok (Nat_key annot) + | String_key annot -> ok (String_key annot) + | Bytes_key annot -> ok (Bytes_key annot) + | Mutez_key annot -> ok (Mutez_key annot) + | Bool_key annot -> ok (Bool_key annot) + | Key_hash_key annot -> ok (Key_hash_key annot) + | Timestamp_key annot -> ok (Timestamp_key annot) + | Address_key annot -> ok (Address_key annot) + + let rec comparable_type : type_value -> ex_comparable_ty result = fun tv -> match tv with | T_base b -> comparable_type_base b | T_function _ -> fail (not_comparable "function") | T_or _ -> fail (not_comparable "or") - | T_pair _ -> fail (not_comparable "pair") + | T_pair ((_,a),(_,b)) -> + let%bind (Ex_comparable_ty a') = comparable_type a in + let%bind (Ex_comparable_ty b') = comparable_type b in + let%bind a'' = comparable_leaf a' in + ok @@ Ex_comparable_ty (pair_k a'' b') | T_map _ -> fail (not_comparable "map") | T_big_map _ -> fail (not_comparable "big_map") | T_list _ -> fail (not_comparable "list") From b594f855942cbb75c49d81f7e5abb03a5fcbd91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Tue, 18 Feb 2020 12:27:14 +0100 Subject: [PATCH 100/119] Fix typo in script (again) --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05373e16c..fb3c89ed4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -137,7 +137,7 @@ build-and-publish-latest-docker-image: - sh scripts/build_docker_image.sh - sh scripts/test_cli.sh - echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin - - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if "$CI_COMMIT_REF_NAME" = "dev" then echo next; else echo next-attempt; fi) + - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if "$CI_COMMIT_REF_NAME" = "dev"; then echo next; else echo next-attempt; fi) rules: # Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository - if: '$CI_COMMIT_REF_NAME =~ /^(dev|.*-run-dev)$/ && $CI_PROJECT_PATH == "ligolang/ligo"' From 38c99eca53e6b36df3e5f3e42a4ae201914bd4f2 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Tue, 18 Feb 2020 12:31:19 +0100 Subject: [PATCH 101/119] carthage: add tests for comparable pairs --- src/bin/expect_tests/typer_error_tests.ml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 041fb2e93..4aa7b95e8 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -114,4 +114,25 @@ let%expect_test _ = * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ * Ask a question on our Discord: https://discord.gg/9rhYaEt * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new - * Check the changelog by running 'ligo changelog' |}] ; + * Check the changelog by running 'ligo changelog' |}] + +(* + This test is here to ensure compatibility with comparable pairs introduced in carthage + note that only "comb pairs" are allowed to be compared (would be beter if any pair would be comparable ?) +*) +let%expect_test _ = + run_ligo_good [ "interpret" ; "Set.literal [ (1,(2,3)) ; (2,(3,4)) ]" ; "--syntax=cameligo" ] ; + [%expect {| + set[( 2 , ( 3 , 4 ) ) , ( 1 , ( 2 , 3 ) )] |}]; + + run_ligo_bad [ "interpret" ; "Set.literal [ (1,2,3) ; (2,3,4) ]" ; "--syntax=cameligo" ] ; + [%expect {| + ligo: not a comparable type: pair (use (a,(b,c)) instead of (a,b,c)) + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}]; \ No newline at end of file From e262f9e103ba09dc4f36785da136317eda0f606a Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Wed, 4 Dec 2019 13:34:20 -0600 Subject: [PATCH 102/119] Demonstrate a couple simple_for_collect bugs --- src/test/contracts/loop_bugs.ligo | 20 ++++++++++++++++++++ src/test/integration_tests.ml | 12 ++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/test/contracts/loop_bugs.ligo diff --git a/src/test/contracts/loop_bugs.ligo b/src/test/contracts/loop_bugs.ligo new file mode 100644 index 000000000..1a18a6758 --- /dev/null +++ b/src/test/contracts/loop_bugs.ligo @@ -0,0 +1,20 @@ +function shadowing_in_body (var nee : unit) : string is block { + var st : string := ""; + var list1 : list(string) := list "to"; "to" end; + for x in list list1 block { + const x : string = "ta"; + st := st ^ x; + } +} with st +(* should be "tata" *) + +function shadowing_assigned_in_body (var nee : unit) : string is block { + var st : string := ""; + var list1 : list(string) := list "to"; "to" end; + for x in list list1 block { + st := st ^ x; + var st : string := "ta"; + st := st ^ x; + } +} with st +(* should be "toto" ??? *) diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index f79d3e8e3..6238fb836 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -2253,6 +2253,17 @@ let no_semicolon_religo () : unit result = in ok () +let loop_bugs_ligo () : unit result = + let%bind program = type_file "./contracts/loop_bugs.ligo" in + let input = e_unit () in + let%bind () = + let expected = e_string "tata" in + expect_eq program "shadowing_in_body" input expected in + let%bind () = + let expected = e_string "toto" in + expect_eq program "shadowing_assigned_in_body" input expected in + ok () + let main = test_suite "Integration (End to End)" [ test "bytes unpack" bytes_unpack ; test "bytes unpack (mligo)" bytes_unpack_mligo ; @@ -2421,4 +2432,5 @@ let main = test_suite "Integration (End to End)" [ test "tuple type (mligo)" tuple_type_mligo ; test "tuple type (religo)" tuple_type_religo ; test "no semicolon (religo)" no_semicolon_religo ; + test "loop_bugs (ligo)" loop_bugs_ligo ; ] From c468cb94a141e748390354249fe2b2abe8eca208 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Tue, 18 Feb 2020 14:14:39 +0100 Subject: [PATCH 103/119] remove unused code --- src/passes/2-simplify/pascaligo.ml | 49 ------------------------------ 1 file changed, 49 deletions(-) diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index 901bf7818..0a550b917 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -3,7 +3,6 @@ open Ast_simplified module Raw = Parser.Pascaligo.AST module SMap = Map.String -module SSet = Set.Make (String) module ParserLog = Parser_pascaligo.ParserLog open Combinators @@ -14,54 +13,6 @@ let pseq_to_list = function None -> [] | Some lst -> npseq_to_list lst let get_value : 'a Raw.reg -> 'a = fun x -> x.value -let is_compiler_generated name = String.contains (Var.to_name name) '#' - -let _detect_local_declarations (for_body : expression) = - let%bind aux = Self_ast_simplified.fold_expression - (fun (nlist, cur_loop : expression_variable list * bool) (ass_exp : expression) -> - if cur_loop then - match ass_exp.expression_content with - | E_let_in {let_binder;mut=false;rhs = _;let_result = _} -> - let (name,_) = let_binder in - ok (name::nlist, cur_loop) - | E_constant {cons_name=C_MAP_FOLD;arguments= _} - | E_constant {cons_name=C_SET_FOLD;arguments= _} - | E_constant {cons_name=C_LIST_FOLD;arguments= _} -> ok @@ (nlist, false) - | _ -> ok (nlist, cur_loop) - else - ok @@ (nlist, cur_loop) - ) - ([], true) - for_body in - ok @@ fst aux - -let _detect_free_variables (for_body : expression) (local_decl_names : expression_variable list) = - let%bind captured_names = Self_ast_simplified.fold_expression - (fun (prev : expression_variable list) (ass_exp : expression) -> - match ass_exp.expression_content with - | E_constant {cons_name=n;arguments=[a;b]} - when n=C_OR || n=C_AND || n=C_LT || n=C_GT || - n=C_LE || n=C_GE || n=C_EQ || n=C_NEQ -> ( - match (a.expression_content,b.expression_content) with - | E_variable na , E_variable nb -> - let ret = [] in - let ret = if not (is_compiler_generated na) then - na::ret else ret in - let ret = if not (is_compiler_generated nb) then - nb::ret else ret in - ok (ret@prev) - | E_variable n , _ - | _ , E_variable n -> - if not (is_compiler_generated n) then - ok (n::prev) else ok prev - | _ -> ok prev) - | _ -> ok prev ) - [] - for_body in - let captured_names = List.map (fun (s) -> Var.to_name s) captured_names in - let local_decl_names = List.map (fun (s) -> Var.to_name s) local_decl_names in - ok @@ SSet.elements - @@ SSet.diff (SSet.of_list captured_names) (SSet.of_list local_decl_names) and repair_mutable_variable (for_body : expression) (element_names : expression_variable list) (env : expression_variable) = let%bind captured_names = Self_ast_simplified.fold_map_expression From 9de45285b27290e566e0c2ba134289ce8cf0b2a6 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Tue, 18 Feb 2020 14:19:11 +0100 Subject: [PATCH 104/119] remove Var.show --- src/passes/2-simplify/pascaligo.ml | 8 ++++---- vendors/ligo-utils/simple-utils/var.ml | 5 ----- vendors/ligo-utils/simple-utils/var.mli | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index 0a550b917..fd979b5fa 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -28,7 +28,7 @@ and repair_mutable_variable (for_body : expression) (element_names : expression_ ok (true,(decl_var, free_var), e_let_in let_binder false false rhs let_result) else( let free_var = if (List.mem name free_var) then free_var else name::free_var in - let expr = e_let_in (env,None) false false (e_update (e_variable env) (Var.show name) (e_variable name)) let_result in + let expr = e_let_in (env,None) false false (e_update (e_variable env) (Var.to_name name) (e_variable name)) let_result in ok (true,(decl_var, free_var), e_let_in let_binder false false rhs expr) ) | E_variable name -> @@ -62,7 +62,7 @@ and repair_mutable_variable_for_collect (for_body : expression) (element_names : let free_var = if (List.mem name free_var) then free_var else name::free_var in let expr = e_let_in (env,None) false false ( e_update (e_variable env) ("0") - (e_update (e_accessor (e_variable env) "0") (Var.show name) (e_variable name)) + (e_update (e_accessor (e_variable env) "0") (Var.to_name name) (e_variable name)) ) let_result in ok (true,(decl_var, free_var), e_let_in let_binder false false rhs expr) @@ -86,12 +86,12 @@ and store_mutable_variable (free_vars : expression_variable list) = if (List.length free_vars == 0) then e_unit () else - let aux var = (Var.show var, e_variable var) in + let aux var = (Var.to_name var, e_variable var) in e_record_ez (List.map aux free_vars) and restore_mutable_variable (expr : expression) (free_vars : expression_variable list) (env :expression_variable) = let aux (f:expression -> expression) (ev:expression_variable) = - ok @@ fun expr -> f (e_let_in (ev,None) true false (e_accessor (e_variable env) (Var.show ev)) expr) + ok @@ fun expr -> f (e_let_in (ev,None) true false (e_accessor (e_variable env) (Var.to_name ev)) expr) in let%bind ef = bind_fold_list aux (fun e -> e) free_vars in ok @@ fun expr'_opt -> match expr'_opt with diff --git a/vendors/ligo-utils/simple-utils/var.ml b/vendors/ligo-utils/simple-utils/var.ml index 05b44d62c..490d3430f 100644 --- a/vendors/ligo-utils/simple-utils/var.ml +++ b/vendors/ligo-utils/simple-utils/var.ml @@ -40,11 +40,6 @@ let to_name var = | None -> var.name | Some _ -> raise Tried_to_unfreshen_variable -let show v = - match v.counter with - | None -> Format.sprintf "%s" v.name - | Some i -> Format.sprintf "%s#%d" v.name i - let fresh ?name () = let name = Option.unopt ~default:"" name in let counter = incr global_counter ; Some !global_counter in diff --git a/vendors/ligo-utils/simple-utils/var.mli b/vendors/ligo-utils/simple-utils/var.mli index 934de4b19..6d4936761 100644 --- a/vendors/ligo-utils/simple-utils/var.mli +++ b/vendors/ligo-utils/simple-utils/var.mli @@ -31,7 +31,6 @@ val of_name : string -> 'a t (* TODO don't use this, this should not exist. *) val to_name : 'a t -> string -val show : 'a t -> string (* Generate a variable, using a counter value from a _global_ counter. If the name is not provided, it will be empty. *) From 2c677c2b7326b0ad1c4599d2dfef4a9081a2d426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Tue, 18 Feb 2020 16:18:51 +0100 Subject: [PATCH 105/119] Fix typo in script (third) --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb3c89ed4..1c003fd77 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -137,7 +137,7 @@ build-and-publish-latest-docker-image: - sh scripts/build_docker_image.sh - sh scripts/test_cli.sh - echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin - - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if "$CI_COMMIT_REF_NAME" = "dev"; then echo next; else echo next-attempt; fi) + - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if test "$CI_COMMIT_REF_NAME" = "dev"; then echo next; else echo next-attempt; fi) rules: # Only deploy docker when from the dev branch AND on the canonical ligolang/ligo repository - if: '$CI_COMMIT_REF_NAME =~ /^(dev|.*-run-dev)$/ && $CI_PROJECT_PATH == "ligolang/ligo"' From eee6dbaeb21d7a6391552ac15c03ccd588750fd2 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Wed, 19 Feb 2020 14:18:06 +0100 Subject: [PATCH 106/119] make while_loop, for_int and for_collect more similar --- src/bin/expect_tests/contract_tests.ml | 115 +++++++++++-------------- src/passes/2-simplify/pascaligo.ml | 95 ++++++++++++-------- src/stages/common/PP.ml | 2 +- src/stages/mini_c/PP.ml | 2 +- 4 files changed, 112 insertions(+), 102 deletions(-) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 2a3c4bd8d..b3ccd0aa0 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -10,10 +10,10 @@ let%expect_test _ = [%expect {| 1747 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig.ligo" ; "main" ] ; - [%expect {| 1358 bytes |}] ; + [%expect {| 1324 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ; - [%expect {| 3294 bytes |}] ; + [%expect {| 3231 bytes |}] ; run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ; [%expect {| 642 bytes |}] ; @@ -371,17 +371,16 @@ let%expect_test _ = SWAP ; DIP { DROP 2 } } { PUSH string "Invalid signature" ; FAILWITH } ; - DIP { DROP ; DUP } ; - SWAP ; + DIP 2 { DUP } ; + DIG 2 ; DIP { DUP } ; SWAP ; - DIP { DROP 2 } } + DIP { DROP 3 } } { DUP } ; - DIP { DROP } ; - DIP 3 { DUP } ; - DIG 3 ; - DIP 3 { DUP } ; - DIG 3 ; + DIP 4 { DUP } ; + DIG 4 ; + DIP 4 { DUP } ; + DIG 4 ; SWAP ; CDR ; SWAP ; @@ -389,13 +388,12 @@ let%expect_test _ = CAR ; DIP { DUP } ; PAIR ; - DIP { DROP 3 } } + DIP { DROP 4 } } { DUP } ; - DIP { DROP } ; - DIP 4 { DUP } ; - DIG 4 ; DIP 5 { DUP } ; DIG 5 ; + DIP 6 { DUP } ; + DIG 6 ; CAR ; DIP 2 { DUP } ; DIG 2 ; @@ -423,7 +421,7 @@ let%expect_test _ = SWAP ; PAIR ; CAR ; - DIP { DROP 6 } } ; + DIP { DROP 7 } } ; DIP 3 { DUP } ; DIG 3 ; DIP { DUP } ; @@ -450,14 +448,12 @@ let%expect_test _ = DIP { DUP } ; SWAP ; DIP { DROP 2 } } ; - DIP { DROP } ; - DIP 2 { DUP } ; - DIG 2 ; + DIP 3 { DUP } ; + DIG 3 ; CAR ; DIP { DUP } ; PAIR ; - DIP { DROP 2 } } ; - DIP { DROP } ; + DIP { DROP 3 } } ; DUP ; CAR ; CAR ; @@ -465,7 +461,7 @@ let%expect_test _ = EXEC ; DIP { DUP ; CDR } ; PAIR ; - DIP { DROP 6 } } } |} ] + DIP { DROP 7 } } } |} ] let%expect_test _ = run_ligo_good [ "compile-contract" ; contract "multisig-v2.ligo" ; "main" ] ; @@ -589,14 +585,13 @@ let%expect_test _ = DIP { DUP } ; SWAP ; DIP { DROP 2 } } ; - DIP { DROP } ; - DIP 2 { DUP } ; - DIG 2 ; + DIP 3 { DUP } ; + DIG 3 ; CAR ; DIP { DUP } ; PAIR ; - DIP 2 { DUP } ; - DIG 2 ; + DIP 3 { DUP } ; + DIG 3 ; PUSH bool True ; SENDER ; UPDATE ; @@ -604,8 +599,7 @@ let%expect_test _ = CDR ; SWAP ; PAIR ; - DIP { DROP 2 } } ; - DIP { DROP } ; + DIP { DROP 3 } } ; DUP ; CAR ; DIP { DUP } ; @@ -624,11 +618,11 @@ let%expect_test _ = GT ; IF { PUSH string "Maximum number of proposal reached" ; FAILWITH } { PUSH unit Unit } ; - DIP 7 { DUP } ; - DIG 7 ; + DIP 8 { DUP } ; + DIG 8 ; DIP { DIP 3 { DUP } ; DIG 3 } ; PAIR ; - DIP { DIP 6 { DUP } ; DIG 6 ; NIL operation ; SWAP ; PAIR } ; + DIP { DIP 7 { DUP } ; DIG 7 ; NIL operation ; SWAP ; PAIR } ; PAIR ; DIP { DIP 2 { DUP } ; DIG 2 } ; PAIR ; @@ -640,8 +634,8 @@ let%expect_test _ = GE ; IF { DIP 3 { DUP } ; DIG 3 ; - DIP 8 { DUP } ; - DIG 8 ; + DIP 9 { DUP } ; + DIG 9 ; DIP { DIP 4 { DUP } ; DIG 4 ; CAR ; CDR ; CDR ; NONE (set address) } ; UPDATE ; DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ; @@ -654,7 +648,7 @@ let%expect_test _ = CDR ; CAR ; CDR ; - DIP { DIP 9 { DUP } ; DIG 9 } ; + DIP { DIP 10 { DUP } ; DIG 10 } ; EXEC ; DIP { DUP } ; SWAP ; @@ -663,7 +657,7 @@ let%expect_test _ = CDR ; CAR ; CDR ; - DIP { DIP 10 { DUP } ; DIG 10 } ; + DIP { DIP 11 { DUP } ; DIG 11 } ; CONCAT ; SHA256 ; DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CAR } ; @@ -724,11 +718,10 @@ let%expect_test _ = PAIR ; DIP { DROP } } { DUP } ; - DIP { DROP } ; - DIP 4 { DUP } ; - DIG 4 ; DIP 5 { DUP } ; DIG 5 ; + DIP 6 { DUP } ; + DIG 6 ; CAR ; DIP 2 { DUP } ; DIG 2 ; @@ -736,7 +729,7 @@ let%expect_test _ = DIP { DROP ; CDR } ; PAIR ; CAR ; - DIP { DROP 5 } } ; + DIP { DROP 6 } } ; DIP 4 { DUP } ; DIG 4 ; DIP 4 { DUP } ; @@ -764,8 +757,8 @@ let%expect_test _ = { DUP ; DIP 4 { DUP } ; DIG 4 ; - DIP 9 { DUP } ; - DIG 9 ; + DIP 10 { DUP } ; + DIG 10 ; DIP { DIP 6 { DUP } ; DIG 6 ; SOME ; @@ -780,14 +773,13 @@ let%expect_test _ = SWAP ; CAR ; PAIR } ; - DIP { DROP } ; DUP ; CAR ; CDR ; CDR ; DIP { DUP ; CDR } ; PAIR ; - DIP { DROP 13 } } ; + DIP { DROP 15 } } ; DIP { DROP } } { DUP ; DIP { DIP { DUP } ; SWAP } ; @@ -848,16 +840,15 @@ let%expect_test _ = SWAP ; DIP { DROP 2 } } { DUP } ; - DIP { DROP } ; DUP ; - DIP 2 { DUP } ; - DIG 2 ; - DIP { DIP 5 { DUP } ; DIG 5 } ; + DIP 3 { DUP } ; + DIG 3 ; + DIP { DIP 6 { DUP } ; DIG 6 } ; PAIR ; DIP { DUP } ; PAIR ; - DIP 3 { DUP } ; - DIG 3 ; + DIP 4 { DUP } ; + DIG 4 ; SIZE ; PUSH nat 0 ; SWAP ; @@ -865,8 +856,8 @@ let%expect_test _ = EQ ; IF { DIP { DUP } ; SWAP ; - DIP 7 { DUP } ; - DIG 7 ; + DIP 8 { DUP } ; + DIG 8 ; DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CDR ; CDR ; NONE (set address) } ; UPDATE ; DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ; @@ -884,10 +875,10 @@ let%expect_test _ = { DUP ; DIP 2 { DUP } ; DIG 2 ; - DIP 8 { DUP } ; - DIG 8 ; - DIP { DIP 5 { DUP } ; - DIG 5 ; + DIP 9 { DUP } ; + DIG 9 ; + DIP { DIP 6 { DUP } ; + DIG 6 ; SOME ; DIP { DIP 3 { DUP } ; DIG 3 ; CAR ; CDR ; CDR } } ; UPDATE ; @@ -900,11 +891,10 @@ let%expect_test _ = SWAP ; CAR ; PAIR } ; - DIP { DROP } ; - DIP 5 { DUP } ; - DIG 5 ; - DIP 2 { DUP } ; - DIG 2 ; + DIP 7 { DUP } ; + DIG 7 ; + DIP 3 { DUP } ; + DIG 3 ; SWAP ; CAR ; PAIR ; @@ -936,13 +926,12 @@ let%expect_test _ = SWAP ; CAR ; PAIR ; - DIP { DROP 5 } } ; - DIP { DROP } ; + DIP { DROP 7 } } ; DUP ; CDR ; NIL operation ; PAIR ; - DIP { DROP 5 } } ; + DIP { DROP 6 } } ; DIP { DROP 2 } } } |} ] let%expect_test _ = diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index fd979b5fa..a7ce6ea0e 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -14,7 +14,7 @@ let pseq_to_list = function | Some lst -> npseq_to_list lst let get_value : 'a Raw.reg -> 'a = fun x -> x.value -and repair_mutable_variable (for_body : expression) (element_names : expression_variable list) (env : expression_variable) = +and repair_mutable_variable_in_matching (for_body : expression) (element_names : expression_variable list) (env : expression_variable) = let%bind captured_names = Self_ast_simplified.fold_map_expression (* TODO : these should use Variables sets *) (fun (decl_var,free_var : expression_variable list * expression_variable list) (ass_exp : expression) -> @@ -46,7 +46,7 @@ and repair_mutable_variable (for_body : expression) (element_names : expression_ for_body in ok @@ captured_names -and repair_mutable_variable_for_collect (for_body : expression) (element_names : expression_variable list) (env : expression_variable) = +and repair_mutable_variable_in_loops (for_body : expression) (element_names : expression_variable list) (env : expression_variable) = let%bind captured_names = Self_ast_simplified.fold_map_expression (* TODO : these should use Variables sets *) (fun (decl_var,free_var : expression_variable list * expression_variable list) (ass_exp : expression) -> @@ -89,14 +89,14 @@ and store_mutable_variable (free_vars : expression_variable list) = let aux var = (Var.to_name var, e_variable var) in e_record_ez (List.map aux free_vars) -and restore_mutable_variable (expr : expression) (free_vars : expression_variable list) (env :expression_variable) = +and restore_mutable_variable (expr : expression->expression) (free_vars : expression_variable list) (env :expression_variable) = let aux (f:expression -> expression) (ev:expression_variable) = ok @@ fun expr -> f (e_let_in (ev,None) true false (e_accessor (e_variable env) (Var.to_name ev)) expr) in let%bind ef = bind_fold_list aux (fun e -> e) free_vars in ok @@ fun expr'_opt -> match expr'_opt with - | None -> ok @@ e_let_in (env,None) false false expr (ef (e_skip ())) - | Some expr' -> ok @@ e_let_in (env,None) false false expr (ef expr') + | None -> ok @@ expr (ef (e_skip ())) + | Some expr' -> ok @@ expr (ef expr') @@ -434,7 +434,7 @@ let rec simpl_expression (t:Raw.expr) : expr result = let%bind match_false = simpl_expression c.ifnot in let match_expr = e_matching expr ~loc (Match_bool {match_true; match_false}) in let env = Var.fresh () in - let%bind (_, match_expr) = repair_mutable_variable match_expr [] env in + let%bind (_, match_expr) = repair_mutable_variable_in_matching match_expr [] env in return @@ match_expr | ECase c -> ( @@ -451,7 +451,7 @@ let rec simpl_expression (t:Raw.expr) : expr result = let%bind cases = simpl_cases lst in let match_expr = e_matching ~loc e cases in let env = Var.fresh () in - let%bind (_, match_expr) = repair_mutable_variable match_expr [] env in + let%bind (_, match_expr) = repair_mutable_variable_in_matching match_expr [] env in return @@ match_expr ) | EMap (MapInj mi) -> ( @@ -892,12 +892,16 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind match_true = match_true @@ Some (e_variable env) in let%bind match_false = match_false @@ Some (e_variable env) in - let%bind ((_,free_vars_true), match_true) = repair_mutable_variable match_true [] env in - let%bind ((_,free_vars_false), match_false) = repair_mutable_variable match_false [] env in + let%bind ((_,free_vars_true), match_true) = repair_mutable_variable_in_matching match_true [] env in + let%bind ((_,free_vars_false), match_false) = repair_mutable_variable_in_matching match_false [] env in let free_vars = free_vars_true @ free_vars_false in if (List.length free_vars != 0) then let match_expr = e_matching expr ~loc (Match_bool {match_true; match_false}) in - let return_expr = e_let_in (env,None) false false (store_mutable_variable free_vars) match_expr in + let return_expr = fun expr -> + e_let_in (env,None) false false (store_mutable_variable free_vars) @@ + e_let_in (env,None) false false match_expr @@ + expr + in restore_mutable_variable return_expr free_vars env else return_statement @@ e_matching expr ~loc (Match_bool {match_true=match_true'; match_false=match_false'}) @@ -945,7 +949,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind case_clause'= case_clause @@ None in let%bind case_clause = case_clause @@ Some(e_variable env) in let%bind case_vars = get_case_variables x.value.pattern in - let%bind ((_,free_vars), case_clause) = repair_mutable_variable case_clause case_vars env in + let%bind ((_,free_vars), case_clause) = repair_mutable_variable_in_matching case_clause case_vars env in ok (free_vars::fv,(x.value.pattern, case_clause, case_clause')) in bind_fold_map_list aux [] (npseq_to_list c.cases.value) in let free_vars = List.concat fv in @@ -957,7 +961,11 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let cases = List.map (fun case -> let (a,b,_) = case in (a,b)) cases in let%bind m = simpl_cases cases in let match_expr = e_matching ~loc expr m in - let return_expr = e_let_in (env,None) false false (store_mutable_variable free_vars) match_expr in + let return_expr = fun expr -> + e_let_in (env,None) false false (store_mutable_variable free_vars) @@ + e_let_in (env,None) false false match_expr @@ + expr + in restore_mutable_variable return_expr free_vars env ) ) @@ -1180,26 +1188,32 @@ and simpl_while_loop : Raw.while_loop -> (_ -> expression result) result = fun w let binder = Var.fresh () in let%bind cond = simpl_expression wl.cond in - let%bind for_body = simpl_block wl.block.value in - let ctrl = (e_variable binder) - in + in + + let%bind for_body = simpl_block wl.block.value in let%bind for_body = for_body @@ Some( ctrl ) in - let%bind ((_,captured_name_list),for_body) = repair_mutable_variable for_body [] binder in + let%bind ((_,captured_name_list),for_body) = repair_mutable_variable_in_loops for_body [] binder in let aux name expr= - e_let_in (name,None) false false (e_accessor (e_variable binder) (Var.to_name name)) expr + e_let_in (name,None) false false (e_accessor (e_accessor (e_variable binder) "0") (Var.to_name name)) expr in - let init_rec = store_mutable_variable @@ captured_name_list in + let init_rec = e_tuple [store_mutable_variable @@ captured_name_list] in let restore = fun expr -> List.fold_right aux captured_name_list expr in let continue_expr = e_constant C_CONTINUE [for_body] in let stop_expr = e_constant C_STOP [e_variable binder] in - let aux_func = e_cond cond continue_expr (stop_expr) in - let aux_func = (restore (aux_func)) in - let aux_func = e_lambda binder None None @@ aux_func in + let aux_func = + e_lambda binder None None @@ + restore @@ + e_cond cond continue_expr stop_expr in let loop = e_constant C_FOLD_WHILE [aux_func; e_variable env_rec] in - let return_expr = e_let_in (env_rec,None) false false init_rec (loop) in + let return_expr = fun expr -> + e_let_in (env_rec,None) false false init_rec @@ + e_let_in (env_rec,None) false false loop @@ + e_let_in (env_rec,None) false false (e_accessor (e_variable env_rec) "0") @@ + expr + in restore_mutable_variable return_expr captured_name_list env_rec @@ -1216,37 +1230,42 @@ and simpl_for_int : Raw.for_int -> (_ -> expression result) result = fun fi -> let step = e_int 1 in let ctrl = e_let_in (it,Some t_int) false false (e_constant C_ADD [ var ; step ]) - (e_let_in (binder, None) false false (e_update (e_variable binder) name var) + (e_let_in (binder, None) false false (e_update (e_variable binder) "1" var) (e_variable binder)) in (* Modify the body loop*) let%bind for_body = simpl_block fi.block.value in - let%bind for_body = for_body @@ Some( ctrl ) in - let%bind ((_,captured_name_list),for_body) = repair_mutable_variable for_body [it] binder in + let%bind for_body = for_body @@ Some ctrl in + let%bind ((_,captured_name_list),for_body) = repair_mutable_variable_in_loops for_body [it] binder in let aux name expr= - e_let_in (name,None) false false (e_accessor (e_variable binder) (Var.to_name name)) expr + e_let_in (name,None) false false (e_accessor (e_accessor (e_variable binder) "0") (Var.to_name name)) expr in (* restores the initial value of the free_var*) let restore = fun expr -> List.fold_right aux captured_name_list expr in (*Prep the lambda for the fold*) - let continue_expr = e_constant C_CONTINUE [for_body] in + let continue_expr = e_constant C_CONTINUE [restore(for_body)] in let stop_expr = e_constant C_STOP [e_variable binder] in - let aux_func = e_cond cond continue_expr (stop_expr) in - let aux_func = e_let_in (it,Some t_int) false false (e_accessor (e_variable binder) name) (restore (aux_func)) in - let aux_func = e_lambda binder None None @@ aux_func in + let aux_func = e_lambda binder None None @@ + e_let_in (it,Some t_int) false false (e_accessor (e_variable binder) "1") @@ + e_cond cond continue_expr (stop_expr) in (* Make the fold_while en precharge the vakye *) let loop = e_constant C_FOLD_WHILE [aux_func; e_variable env_rec] in - let init_rec = store_mutable_variable @@ it::captured_name_list in - let return_expr = e_let_in (env_rec,None) false false init_rec (loop) in - let return_expr = e_let_in (it, Some t_int) false false value @@ return_expr in + let init_rec = e_pair (store_mutable_variable @@ captured_name_list) var in + + let return_expr = fun expr -> + e_let_in (it, Some t_int) false false value @@ + e_let_in (env_rec,None) false false init_rec @@ + e_let_in (env_rec,None) false false loop @@ + e_let_in (env_rec,None) false false (e_accessor (e_variable env_rec) "0") @@ + expr + in restore_mutable_variable return_expr captured_name_list env_rec and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun fc -> - let _elt_name = fc.var.value in let binder = Var.of_name "arguments" in let%bind element_names = ok @@ match fc.bind_to with | Some v -> [Var.of_name fc.var.value;Var.of_name (snd v).value] @@ -1254,9 +1273,8 @@ and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun let env = Var.fresh () in let%bind for_body = simpl_block fc.block.value in - let%bind _for_body' = for_body None in let%bind for_body = for_body @@ Some (e_accessor (e_variable binder) "0") in - let%bind ((_,free_vars), for_body) = repair_mutable_variable_for_collect for_body element_names binder in + let%bind ((_,free_vars), for_body) = repair_mutable_variable_in_loops for_body element_names binder in let init_record = store_mutable_variable free_vars in let%bind collect = simpl_expression fc.expr in @@ -1275,7 +1293,10 @@ and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun let lambda = e_lambda binder None None (restore for_body) in let op_name = match fc.collection with | Map _ -> C_MAP_FOLD | Set _ -> C_SET_FOLD | List _ -> C_LIST_FOLD in - let fold = e_constant op_name [lambda; collect ; init_record] in + let fold = fun expr -> + e_let_in (env,None) false false (e_constant op_name [lambda; collect ; init_record]) @@ + expr + in restore_mutable_variable fold free_vars env and simpl_declaration_list declarations : diff --git a/src/stages/common/PP.ml b/src/stages/common/PP.ml index 7a943c603..a04d303a7 100644 --- a/src/stages/common/PP.ml +++ b/src/stages/common/PP.ml @@ -235,7 +235,7 @@ module Ast_PP_type (PARAMETER : AST_PARAMETER_TYPE) = struct | TC_key_hash -> "key_hash" | TC_signature -> - "signatuer" + "signature" | TC_timestamp -> "timestamp" | TC_chain_id -> diff --git a/src/stages/mini_c/PP.ml b/src/stages/mini_c/PP.ml index 626b6a23c..0fde6061c 100644 --- a/src/stages/mini_c/PP.ml +++ b/src/stages/mini_c/PP.ml @@ -44,7 +44,7 @@ and type_constant ppf (tc:type_constant) : unit = | TC_address -> "address" | TC_key -> "key" | TC_key_hash -> "key_hash" - | TC_signature -> "signatuer" + | TC_signature -> "signature" | TC_timestamp -> "timestamp" | TC_chain_id -> "chain_id" | TC_void -> "void" From 44ff5d580d0191a44f442ce43a260ec4e2230448 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Wed, 19 Feb 2020 16:10:50 +0100 Subject: [PATCH 107/119] Allow using top level variables defined in source code in dry-run PARAMETER and STORAGE --- src/bin/cli.ml | 2 +- src/bin/expect_tests/contract_tests.ml | 7 ++++++- src/test/contracts/super-counter.mligo | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bin/cli.ml b/src/bin/cli.ml index 92716d380..f9b6321e5 100644 --- a/src/bin/cli.ml +++ b/src/bin/cli.ml @@ -327,7 +327,7 @@ let dry_run = let%bind simplified = Compile.Of_source.compile_contract_input storage input v_syntax in let%bind typed,_ = Compile.Of_simplified.compile_expression ~env ~state simplified in let%bind mini_c = Compile.Of_typed.compile_expression typed in - let%bind compiled_params = Compile.Of_mini_c.compile_expression mini_c in + let%bind compiled_params = Compile.Of_mini_c.aggregate_and_compile_expression mini_c_prg mini_c in let%bind args_michelson = Run.evaluate_expression compiled_params.expr compiled_params.expr_ty in let%bind options = Run.make_dry_run_options {predecessor_timestamp ; amount ; sender ; source } in diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 2a3c4bd8d..cfc6f0490 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -1136,4 +1136,9 @@ let%expect_test _ = [%expect {| { parameter int ; storage (pair (map %one key_hash nat) (big_map %two key_hash bool)) ; - code { DUP ; CDR ; NIL operation ; PAIR ; DIP { DROP } } } |}] \ No newline at end of file + code { DUP ; CDR ; NIL operation ; PAIR ; DIP { DROP } } } |}] + +let%expect_test _ = + run_ligo_good [ "dry-run" ; contract "super-counter.mligo" ; "main" ; "test_param" ; "test_storage" ] ; + [%expect {| + ( list[] , 3 ) |}] \ No newline at end of file diff --git a/src/test/contracts/super-counter.mligo b/src/test/contracts/super-counter.mligo index 613d9b29b..dc00c9567 100644 --- a/src/test/contracts/super-counter.mligo +++ b/src/test/contracts/super-counter.mligo @@ -2,6 +2,9 @@ type action = | Increment of int | Decrement of int +let test_param = Increment(1) +let test_storage = 2 + let main (ps : action * int) : (operation list * int) = let storage = match ps.0 with From b8af9a56d9c6b6d7b1d6385d745609a6c42e0b7f Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Wed, 19 Feb 2020 16:15:43 +0100 Subject: [PATCH 108/119] fix contract with tuples starting at one --- .../docs/language-basics/maps-records.md | 4 +- .../docs/language-basics/sets-lists-tuples.md | 4 +- gitlab-pages/docs/reference/map.md | 4 +- src/passes/1-parser/cameligo/ParserLog.ml | 2 + src/passes/1-parser/cameligo/ParserLog.mli | 3 + src/passes/1-parser/pascaligo/ParserLog.ml | 2 + src/passes/1-parser/pascaligo/ParserLog.mli | 2 + src/passes/2-simplify/pascaligo.ml | 59 +++++++++++++------ src/test/contracts/big_map.ligo | 4 +- src/test/contracts/deep_access.ligo | 6 +- src/test/contracts/double_main.ligo | 2 +- src/test/contracts/map.ligo | 10 ++-- src/test/contracts/multisig.ligo | 4 +- src/test/contracts/simple_access.ligo | 4 +- src/test/contracts/tuple.ligo | 6 +- 15 files changed, 73 insertions(+), 43 deletions(-) diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index d691d588e..e5985caf4 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -614,7 +614,7 @@ operation over maps is called `map_map` and is used as follows: function map_op (const m : register) : register is block { function increment (const i : address; const j : move) : move is - (j.0, j.1 + 1); + (j.1, j.2 + 1); } with map_map (increment, m) ``` @@ -664,7 +664,7 @@ follows: ```pascaligo group=f function fold_op (const m : register) : int is block { function folded (const j : int; const cur : address * move) : int is - j + cur.1.1 + j + cur.2.2 } with map_fold (folded, m, 5) ``` diff --git a/gitlab-pages/docs/language-basics/sets-lists-tuples.md b/gitlab-pages/docs/language-basics/sets-lists-tuples.md index a3db92b6d..d4f3f856f 100644 --- a/gitlab-pages/docs/language-basics/sets-lists-tuples.md +++ b/gitlab-pages/docs/language-basics/sets-lists-tuples.md @@ -84,10 +84,10 @@ let first_name : string = full_name.0 -Tuple components are one-indexed and accessed like so: +Tuple components are zero-indexed and accessed like so: ```reasonligo group=tuple -let first_name : string = full_name[1]; +let first_name : string = full_name[0]; ``` diff --git a/gitlab-pages/docs/reference/map.md b/gitlab-pages/docs/reference/map.md index 08e1a457f..a24a28ada 100644 --- a/gitlab-pages/docs/reference/map.md +++ b/gitlab-pages/docs/reference/map.md @@ -238,7 +238,7 @@ rule `mapping_function`. ```pascaligo function map_op (const m : moveset) : moveset is block { - function increment (const i : address ; const j : move) : move is (j.0, j.1 + 1); + function increment (const i : address ; const j : move) : move is (j.1, j.2 + 1); } with map_map (increment, m); ``` @@ -267,7 +267,7 @@ Combine every value in the map together according to a fold rule `folding_functi ```pascaligo function fold_op (const m : moveset) : int is block { - function aggregate (const j : int; const cur : address * (int * int)) : int is j + cur.1.1 + function aggregate (const j : int; const cur : address * (int * int)) : int is j + cur.2.2 } with map_fold(aggregate, m, 5) ``` diff --git a/src/passes/1-parser/cameligo/ParserLog.ml b/src/passes/1-parser/cameligo/ParserLog.ml index aa847e245..7ae68ca76 100644 --- a/src/passes/1-parser/cameligo/ParserLog.ml +++ b/src/passes/1-parser/cameligo/ParserLog.ml @@ -591,6 +591,8 @@ let pattern_to_string ~offsets ~mode = to_string ~offsets ~mode print_pattern let expr_to_string ~offsets ~mode = to_string ~offsets ~mode print_expr +let projection_to_string ~offsets ~mode = + to_string ~offsets ~mode print_projection (** {1 Pretty-printing the AST} *) diff --git a/src/passes/1-parser/cameligo/ParserLog.mli b/src/passes/1-parser/cameligo/ParserLog.mli index d16252478..51013faed 100644 --- a/src/passes/1-parser/cameligo/ParserLog.mli +++ b/src/passes/1-parser/cameligo/ParserLog.mli @@ -17,6 +17,7 @@ val mk_state : val print_tokens : state -> AST.t -> unit val print_pattern : state -> AST.pattern -> unit val print_expr : state -> AST.expr -> unit +val print_projection : state -> AST.projection Region.reg -> unit val tokens_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.t -> string @@ -24,6 +25,8 @@ val pattern_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.pattern -> string val expr_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.expr -> string +val projection_to_string : + offsets:bool -> mode:[`Point|`Byte] -> AST.projection Region.reg -> string (** {1 Pretty-printing of AST nodes} *) diff --git a/src/passes/1-parser/pascaligo/ParserLog.ml b/src/passes/1-parser/pascaligo/ParserLog.ml index d423006f2..25785419b 100644 --- a/src/passes/1-parser/pascaligo/ParserLog.ml +++ b/src/passes/1-parser/pascaligo/ParserLog.ml @@ -816,6 +816,8 @@ let pattern_to_string ~offsets ~mode = to_string ~offsets ~mode print_pattern let instruction_to_string ~offsets ~mode = to_string ~offsets ~mode print_instruction +let projection_to_string ~offsets ~mode = + to_string ~offsets ~mode print_projection (** {1 Pretty-printing the AST} *) diff --git a/src/passes/1-parser/pascaligo/ParserLog.mli b/src/passes/1-parser/pascaligo/ParserLog.mli index 955c1590b..b85585715 100644 --- a/src/passes/1-parser/pascaligo/ParserLog.mli +++ b/src/passes/1-parser/pascaligo/ParserLog.mli @@ -30,6 +30,8 @@ val pattern_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.pattern -> string val instruction_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.instruction -> string +val projection_to_string : + offsets:bool -> mode:[`Point|`Byte] -> AST.projection Region.reg -> string (** {1 Pretty-printing of AST nodes} *) diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index 901bf7818..ba7175924 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -233,6 +233,20 @@ module Errors = struct ] in error ~data title message + let zero_index_access (p: _ Region.reg) = + let title () = "" in + let message () = + Format.asprintf "\n In PascaLigo, tuple indexes start at one \n" in + let pattern_loc = p.region in + let data = [ + ("location", + fun () -> Format.asprintf "%a" Location.pp_lift @@ pattern_loc); + ("tuple", + fun () -> ParserLog.projection_to_string + ~offsets:true ~mode:`Point p) + ] in + error ~data title message + (* Logging *) let simplifying_instruction t = @@ -348,13 +362,16 @@ let simpl_projection : Raw.projection Region.reg -> _ = fun p -> let name = Var.of_name p'.struct_name.value in e_variable name in let path = p'.field_path in - let path' = + let%bind path' = let aux (s:Raw.selection) = match s with - | FieldName property -> property.value - | Component index -> (Z.to_string (snd index.value)) + | FieldName property -> ok property.value + | Component index -> + let i:Z.t = Z.pred (snd index.value) in + if (Z.lt i Z.zero) then fail @@ zero_index_access p + else ok (Z.to_string i) in - List.map aux @@ npseq_to_list path in + bind_map_list aux @@ npseq_to_list path in ok @@ List.fold_left (e_accessor ~loc) var path' @@ -547,7 +564,7 @@ let rec simpl_expression (t:Raw.expr) : expr result = and simpl_update = fun (u:Raw.update Region.reg) -> let (u, loc) = r_split u in - let (name, path) = simpl_path u.record in + let%bind (name, path) = simpl_path u.record in let record = match path with | [] -> e_variable (Var.of_name name) | _ -> e_accessor_list (e_variable (Var.of_name name)) path in @@ -956,7 +973,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind value_expr = simpl_expression a.rhs in match a.lhs with | Path path -> ( - let (name , path') = simpl_path path in + let%bind (name , path') = simpl_path path in let (let_binder, mut, rhs, inline) = e_assign_with_let ~loc name path' value_expr in return_let_in let_binder mut inline rhs ) @@ -965,7 +982,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind (varname,map,path) = match v'.path with | Name name -> ok (name.value , e_variable (Var.of_name name.value), []) | Path p -> - let (name,p') = simpl_path v'.path in + let%bind (name,p') = simpl_path v'.path in let%bind accessor = simpl_projection p in ok @@ (name , accessor , p') in @@ -1023,7 +1040,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul } in let u : Raw.update = {record=r.path;kwd_with=r.kwd_with; updates=update} in let%bind expr = simpl_update {value=u;region=reg} in - let (name , access_path) = simpl_path r.path in + let%bind (name , access_path) = simpl_path r.path in let loc = Some loc in let (binder, mut, rhs, inline) = e_assign_with_let ?loc name access_path expr in return_let_in binder mut inline rhs @@ -1031,7 +1048,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul ) | MapPatch patch -> ( let (map_p, loc) = r_split patch in - let (name, access_path) = simpl_path map_p.path in + let%bind (name, access_path) = simpl_path map_p.path in let%bind inj = bind_list @@ List.map (fun (x:Raw.binding Region.reg) -> let x = x.value in @@ -1054,7 +1071,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul ) | SetPatch patch -> ( let (setp, loc) = r_split patch in - let (name , access_path) = simpl_path setp.path in + let%bind (name , access_path) = simpl_path setp.path in let%bind inj = bind_list @@ List.map simpl_expression @@ @@ -1074,7 +1091,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind (varname,map,path) = match v.map with | Name v -> ok (v.value , e_variable (Var.of_name v.value) , []) | Path p -> - let (name,p') = simpl_path v.map in + let%bind (name,p') = simpl_path v.map in let%bind accessor = simpl_projection p in ok @@ (name , accessor , p') in @@ -1088,7 +1105,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind (varname, set, path) = match set_rm.set with | Name v -> ok (v.value, e_variable (Var.of_name v.value), []) | Path path -> - let(name, p') = simpl_path set_rm.set in + let%bind (name, p') = simpl_path set_rm.set in let%bind accessor = simpl_projection path in ok @@ (name, accessor, p') in @@ -1098,21 +1115,25 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul return_let_in binder mut inline rhs ) -and simpl_path : Raw.path -> string * string list = fun p -> +and simpl_path : Raw.path -> (string * string list) result = fun p -> match p with - | Raw.Name v -> (v.value , []) + | Raw.Name v -> ok (v.value , []) | Raw.Path p -> ( let p' = p.value in let var = p'.struct_name.value in let path = p'.field_path in - let path' = + let%bind path' = let aux (s:Raw.selection) = match s with - | FieldName property -> property.value - | Component index -> (Z.to_string (snd index.value)) + | FieldName property -> ok property.value + | Component index -> + let i:Z.t = Z.pred (snd index.value) in + if (Z.lt i Z.zero) then fail @@ zero_index_access p + else ok (Z.to_string i) in - List.map aux @@ npseq_to_list path in - (var , path') + bind_map_list aux @@ npseq_to_list path + in + ok (var , path') ) and simpl_cases : (Raw.pattern * expression) list -> matching_expr result = fun t -> diff --git a/src/test/contracts/big_map.ligo b/src/test/contracts/big_map.ligo index 9b8364ac3..3ebaa2ff5 100644 --- a/src/test/contracts/big_map.ligo +++ b/src/test/contracts/big_map.ligo @@ -5,8 +5,8 @@ type return is list (operation) * storage function main (const p : parameter; const s : storage) : return is block { var toto : option (int) := Some (0); - toto := s.0[23]; - s.0[2] := 444 + toto := s.1[23]; + s.1[2] := 444 } with ((nil: list(operation)), s) diff --git a/src/test/contracts/deep_access.ligo b/src/test/contracts/deep_access.ligo index 2d9ad32d4..9dcd39fa4 100644 --- a/src/test/contracts/deep_access.ligo +++ b/src/test/contracts/deep_access.ligo @@ -11,14 +11,14 @@ function main (const toto : unit) : int is var a : ppp := (record [x = (0,1); y = (10,11)], record [x = (100,101); y = (110,111)]); - a.0.x.0 := 2; - } with a.0.x.0 + a.1.x.1 := 2; + } with a.1.x.1 function asymetric_tuple_access (const foo : unit) : int is block { var tuple : int * (int * (int * int)) := (0,(1,(2,3))) - } with tuple.0 + tuple.1.0 + tuple.1.1.0 + tuple.1.1.1 + } with tuple.1 + tuple.2.1 + tuple.2.2.1 + tuple.2.2.2 type nested_record_t is record [nesty : record [mymap : map (int,string)]] diff --git a/src/test/contracts/double_main.ligo b/src/test/contracts/double_main.ligo index a46df45ab..803e3df13 100644 --- a/src/test/contracts/double_main.ligo +++ b/src/test/contracts/double_main.ligo @@ -8,4 +8,4 @@ function main(const p : parameter; const s : storage) : return is function main (const p : parameter; const s : storage) : return is block { const ret : return = main (p, s) - } with (ret.0, ret.1 + 1) + } with (ret.1, ret.2 + 1) diff --git a/src/test/contracts/map.ligo b/src/test/contracts/map.ligo index eabd8edc7..7e7f792fa 100644 --- a/src/test/contracts/map.ligo +++ b/src/test/contracts/map.ligo @@ -28,7 +28,7 @@ function patch_ (var m : foobar) : foobar is block { } with m function patch_deep (var m : foobar * nat) : foobar * nat is - block { patch m.0 with map [1 -> 9] } with m + block { patch m.1 with map [1 -> 9] } with m function size_ (const m : foobar) : nat is size (m) @@ -54,12 +54,12 @@ function map_op (const m : foobar) : foobar is function fold_op (const m : foobar) : int is block { function aggregate (const i : int; const j : int * int) : int is - i + j.0 + j.1 + i + j.1 + j.2 } with map_fold(aggregate, m, 10) function deep_op (var m : foobar) : foobar is block { var coco : int * foobar := (0, m); - remove 42 from map coco.1; - coco.1[32] := 16 - } with coco.1 + remove 42 from map coco.2; + coco.2[32] := 16 + } with coco.2 diff --git a/src/test/contracts/multisig.ligo b/src/test/contracts/multisig.ligo index f0cdb636c..8e1480803 100644 --- a/src/test/contracts/multisig.ligo +++ b/src/test/contracts/multisig.ligo @@ -47,8 +47,8 @@ function check_message (const param : check_message_pt; nil -> skip | key # tl -> block { keys := tl; - if pkh_sig.0 = crypto_hash_key (key) then - if crypto_check (key, pkh_sig.1, packed_payload) + if pkh_sig.1 = crypto_hash_key (key) then + if crypto_check (key, pkh_sig.2, packed_payload) then valid := valid + 1n else failwith ("Invalid signature") else skip diff --git a/src/test/contracts/simple_access.ligo b/src/test/contracts/simple_access.ligo index e26e23bc7..0c8522988 100644 --- a/src/test/contracts/simple_access.ligo +++ b/src/test/contracts/simple_access.ligo @@ -11,8 +11,8 @@ function main (const toto : tpi) : int is var a : tpi := toto; var b : rpi := record x = 0; y=1 ; end; var m : mpi := map "y" -> 1; end; - a.0 := 2; - b.x := a.0; + a.1 := 2; + b.x := a.1; m["x"] := b.x; end with case m["x"] of diff --git a/src/test/contracts/tuple.ligo b/src/test/contracts/tuple.ligo index 9a39cde03..07e9c8f71 100644 --- a/src/test/contracts/tuple.ligo +++ b/src/test/contracts/tuple.ligo @@ -1,11 +1,11 @@ type abc is (int * int * int) function projection_abc (const tpl : abc) : int is - block { skip } with tpl.1 + block { skip } with tpl.2 function modify_abc (const tpl : abc) : abc is block { - tpl.1 := 2048 ; + tpl.2 := 2048 ; } with tpl type foobar is (int * int) @@ -15,7 +15,7 @@ const fb : foobar = (0, 0) function projection (const tpl : foobar) : int is begin skip - end with tpl.0 + tpl.1 + end with tpl.1 + tpl.2 type big_tuple is (int * int * int * int * int) From dcb342e03181d139aefd994f0063479f0a7d1144 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Fri, 14 Feb 2020 16:50:30 +0100 Subject: [PATCH 109/119] add primitive to cameligo --- src/passes/operators/operators.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 94ec09373..456c0172a 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -148,6 +148,7 @@ module Simplify = struct module Cameligo = struct let constants = function | "assert" -> ok C_ASSERTION + | "chain_id" -> ok C_CHAIN_ID | "Current.balance" -> ok C_BALANCE | "balance" -> ok C_BALANCE | "Current.time" -> ok C_NOW From e1606c47001436d698f5e6bd4a4b4aeabf64b338 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Fri, 14 Feb 2020 18:09:29 +0100 Subject: [PATCH 110/119] add multisig test for cameligo and reasonligo --- src/test/contracts/multisig.mligo | 66 +++++++++++++++++++++ src/test/contracts/multisig.religo | 80 +++++++++++++++++++++++++ src/test/multisig_tests.ml | 95 ++++++++++++++++++------------ 3 files changed, 203 insertions(+), 38 deletions(-) create mode 100644 src/test/contracts/multisig.mligo create mode 100644 src/test/contracts/multisig.religo diff --git a/src/test/contracts/multisig.mligo b/src/test/contracts/multisig.mligo new file mode 100644 index 000000000..2a7753cc6 --- /dev/null +++ b/src/test/contracts/multisig.mligo @@ -0,0 +1,66 @@ +// storage type + +type counter = nat +type threshold = nat +type authorized_keys = (key) list +type id = string + +type storage = { + id : id; + counter : counter; + threshold : threshold; + auth : authorized_keys +} + +// I/O types + +type message = unit -> (operation) list + +type signatures = (key_hash*signature) list +type check_message_pt = { + counter : counter; + message : message; + signatures : signatures +} + +type return = (operation) list * storage + +type parameter = CheckMessage of check_message_pt + +let check_message (param,s : check_message_pt * storage) : return = + let message : message = param.message in + let s = + if (param.counter <> s.counter) then + let coco = failwith ("Counters does not match") in s + else ( + let packed_payload : bytes = Bytes.pack ((message, param.counter, s.id, chain_id)) in + let valid : nat = 0n in + let keys : authorized_keys = s.auth in + let aux = fun (vk, pkh_sig: (nat* authorized_keys) * (key_hash*signature)) -> + let (valid,keys) = vk in + match (keys) with + | [] -> (valid,keys) + | key::tl -> ( + let keys = tl in + if (pkh_sig.0 = Crypto.hash_key (key)) then + let valid = + if (Crypto.check key pkh_sig.1 packed_payload) then valid + 1n + else let coco = failwith ("Invalid signature") in valid + in + (valid,keys) + else (valid,keys) + ) + in + let (valid,keys) = List.fold aux param.signatures (valid,keys) in + if (valid < s.threshold) then + let coco = failwith ("Not enough signatures passed the check") in + s + else + {s with counter = s.counter + 1n} + ) + in + (message(unit),s) + +let main (param, s: parameter * storage) : return = + match (param) with + | CheckMessage (p) -> check_message (p,s) diff --git a/src/test/contracts/multisig.religo b/src/test/contracts/multisig.religo new file mode 100644 index 000000000..a2d709ab9 --- /dev/null +++ b/src/test/contracts/multisig.religo @@ -0,0 +1,80 @@ +// storage type + +type counter = nat; +type threshold = nat; +type authorized_keys = list (key); +type id = string; + +type storage = { + id : id, + counter : counter, + threshold : threshold, + auth : authorized_keys +}; + +// I/O types + +type message = unit => list (operation); +type dummy = (key_hash,signature); +type signatures = list (dummy); + +type check_message_pt = { + counter : counter, + message : message, + signatures : signatures +}; + +type return = (list (operation),storage); + +type parameter = CheckMessage (check_message_pt); + +let check_message = ((param,s) : (check_message_pt, storage)) : return => { + let message : message = param.message; + let s = + if (param.counter != s.counter) { + let coco = failwith ("Counters does not match"); + s; + } + else { + let packed_payload : bytes = Bytes.pack ((message, param.counter, s.id, chain_id)); + let valid : nat = 0n; + let keys : authorized_keys = s.auth; + let aux = ((vk,pkh_sig) : ((nat, authorized_keys),(key_hash,signature))):(nat,authorized_keys) => { + let (valid,keys) = vk; + switch(keys) { + | [] => (valid,keys); + | [key, ...tl] => { + let keys = tl; + if (pkh_sig[0] == Crypto.hash_key (key)){ + let valid = + if (Crypto.check (key, pkh_sig[1], packed_payload)){ + valid + 1n ; + } + else { + let coco = failwith ("Invalid signature"); + valid; + }; + (valid,keys); + } + else { + (valid,keys); + }; + }; + }; + }; + let (valid,keys) = List.fold (aux, param.signatures, (valid,keys)); + if (valid < s.threshold) { + let coco = failwith ("Not enough signatures passed the check"); + s; + } + else { + {...s,counter : s.counter + 1n}; + }; + }; + (message(unit),s) +}; + +let main = ((param, s) : (parameter,storage)) : return => + switch(param) { + | CheckMessage (p) => check_message ((p,s)) + } diff --git a/src/test/multisig_tests.ml b/src/test/multisig_tests.ml index de6fbaaa4..e71c5ce99 100644 --- a/src/test/multisig_tests.ml +++ b/src/test/multisig_tests.ml @@ -1,24 +1,27 @@ open Trace open Test_helpers -let type_file f = - let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in +let file = "./contracts/multisig.ligo" +let mfile = "./contracts/multisig.mligo" +let refile = "./contracts/multisig.religo" + +let type_file f s = + let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name s) in let%bind typed,state = Ligo.Compile.Of_simplified.compile simplified in ok @@ (typed,state) -let get_program = +let get_program f st = let s = ref None in fun () -> match !s with | Some s -> ok s | None -> ( - let%bind program = type_file "./contracts/multisig.ligo" in + let%bind program = type_file f st in s := Some program ; ok program ) -let compile_main () = - let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/multisig.ligo" (Syntax_name "pascaligo") in - let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile simplified in +let compile_main f s () = + let%bind typed_prg,_ = type_file f s in let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in let%bind (_contract: Tezos_utils.Michelson.michelson) = @@ -51,8 +54,8 @@ let chain_id_zero = e_chain_id @@ Tezos_crypto.Base58.simple_encode Tezos_base__TzPervasives.Chain_id.zero (* sign the message 'msg' with 'keys', if 'is_valid'=false the providid signature will be incorrect *) -let params counter msg keys is_validl = - let%bind program,_ = get_program () in +let params counter msg keys is_validl f s = + let%bind program,_ = get_program f s () in let aux = fun acc (key,is_valid) -> let (_,_pk,sk) = key in let (pkh,_,_) = str_keys key in @@ -73,42 +76,42 @@ let params counter msg keys is_validl = ]) (* Provide one valid signature when the threshold is two of two keys *) -let not_enough_1_of_2 () = - let%bind program,_ = get_program () in +let not_enough_1_of_2 f s () = + let%bind program,_ = get_program f s () in let exp_failwith = "Not enough signatures passed the check" in let keys = gen_keys () in - let%bind test_params = params 0 empty_message [keys] [true] in + let%bind test_params = params 0 empty_message [keys] [true] f s in let%bind () = expect_string_failwith program "main" (e_pair test_params (init_storage 2 0 [keys;gen_keys()])) exp_failwith in ok () -let unmatching_counter () = - let%bind program,_ = get_program () in +let unmatching_counter f s () = + let%bind program,_ = get_program f s () in let exp_failwith = "Counters does not match" in let keys = gen_keys () in - let%bind test_params = params 1 empty_message [keys] [true] in + let%bind test_params = params 1 empty_message [keys] [true] f s in let%bind () = expect_string_failwith program "main" (e_pair test_params (init_storage 1 0 [keys])) exp_failwith in ok () (* Provide one invalid signature (correct key but incorrect signature) when the threshold is one of one key *) -let invalid_1_of_1 () = - let%bind program,_ = get_program () in +let invalid_1_of_1 f s () = + let%bind program,_ = get_program f s () in let exp_failwith = "Invalid signature" in let keys = [gen_keys ()] in - let%bind test_params = params 0 empty_message keys [false] in + let%bind test_params = params 0 empty_message keys [false] f s in let%bind () = expect_string_failwith program "main" (e_pair test_params (init_storage 1 0 keys)) exp_failwith in ok () (* Provide one valid signature when the threshold is one of one key *) -let valid_1_of_1 () = - let%bind program,_ = get_program () in +let valid_1_of_1 f s () = + let%bind program,_ = get_program f s () in let keys = gen_keys () in let%bind () = expect_eq_n_trace_aux [0;1;2] program "main" (fun n -> - let%bind params = params n empty_message [keys] [true] in + let%bind params = params n empty_message [keys] [true] f s in ok @@ e_pair params (init_storage 1 n [keys]) ) (fun n -> @@ -117,13 +120,13 @@ let valid_1_of_1 () = ok () (* Provive two valid signatures when the threshold is two of three keys *) -let valid_2_of_3 () = - let%bind program,_ = get_program () in +let valid_2_of_3 f s () = + let%bind program,_ = get_program f s () in let param_keys = [gen_keys (); gen_keys ()] in let st_keys = param_keys @ [gen_keys ()] in let%bind () = expect_eq_n_trace_aux [0;1;2] program "main" (fun n -> - let%bind params = params n empty_message param_keys [true;true] in + let%bind params = params n empty_message param_keys [true;true] f s in ok @@ e_pair params (init_storage 2 n st_keys) ) (fun n -> @@ -132,36 +135,52 @@ let valid_2_of_3 () = ok () (* Provide one invalid signature and two valid signatures when the threshold is two of three keys *) -let invalid_3_of_3 () = - let%bind program,_ = get_program () in +let invalid_3_of_3 f s () = + let%bind program,_ = get_program f s () in let valid_keys = [gen_keys() ; gen_keys()] in let invalid_key = gen_keys () in let param_keys = valid_keys @ [invalid_key] in let st_keys = valid_keys @ [gen_keys ()] in - let%bind test_params = params 0 empty_message param_keys [false;true;true] in + let%bind test_params = params 0 empty_message param_keys [false;true;true] f s in let exp_failwith = "Invalid signature" in let%bind () = expect_string_failwith program "main" (e_pair test_params (init_storage 2 0 st_keys)) exp_failwith in ok () (* Provide two valid signatures when the threshold is three of three keys *) -let not_enough_2_of_3 () = - let%bind program,_ = get_program () in +let not_enough_2_of_3 f s () = + let%bind program,_ = get_program f s() in let valid_keys = [gen_keys() ; gen_keys()] in let st_keys = gen_keys () :: valid_keys in - let%bind test_params = params 0 empty_message (valid_keys) [true;true] in + let%bind test_params = params 0 empty_message (valid_keys) [true;true] f s in let exp_failwith = "Not enough signatures passed the check" in let%bind () = expect_string_failwith program "main" (e_pair test_params (init_storage 3 0 st_keys)) exp_failwith in ok () let main = test_suite "Multisig" [ - test "compile" compile_main ; - test "unmatching_counter" unmatching_counter ; - test "valid_1_of_1" valid_1_of_1 ; - test "invalid_1_of_1" invalid_1_of_1 ; - test "not_enough_signature" not_enough_1_of_2 ; - test "valid_2_of_3" valid_2_of_3 ; - test "invalid_3_of_3" invalid_3_of_3 ; - test "not_enough_2_of_3" not_enough_2_of_3 ; + test "compile" (compile_main file "pascaligo"); + test "unmatching_counter" (unmatching_counter file "pascaligo"); + test "valid_1_of_1" (valid_1_of_1 file "pascaligo"); + test "invalid_1_of_1" (invalid_1_of_1 file "pascaligo"); + test "not_enough_signature" (not_enough_1_of_2 file "pascaligo"); + test "valid_2_of_3" (valid_2_of_3 file "pascaligo"); + test "invalid_3_of_3" (invalid_3_of_3 file "pascaligo"); + test "not_enough_2_of_3" (not_enough_2_of_3 file "pascaligo"); + test "compile (mligo)" (compile_main mfile "cameligo"); + test "unmatching_counter (mligo)" (unmatching_counter mfile "cameligo"); + test "valid_1_of_1 (mligo)" (valid_1_of_1 mfile "cameligo"); + test "invalid_1_of_1 (mligo)" (invalid_1_of_1 mfile "cameligo"); + test "not_enough_signature (mligo)" (not_enough_1_of_2 mfile "cameligo"); + test "valid_2_of_3 (mligo)" (valid_2_of_3 mfile "cameligo"); + test "invalid_3_of_3 (mligo)" (invalid_3_of_3 mfile "cameligo"); + test "not_enough_2_of_3 (mligo)" (not_enough_2_of_3 mfile "cameligo"); + test "compile (religo)" (compile_main refile "reasonligo"); + test "unmatching_counter (religo)" (unmatching_counter refile "reasonligo"); + test "valid_1_of_1 (religo)" (valid_1_of_1 refile "reasonligo"); + test "invalid_1_of_1 (religo)" (invalid_1_of_1 refile "reasonligo"); + test "not_enough_signature (religo)" (not_enough_1_of_2 refile "reasonligo"); + test "valid_2_of_3 (religo)" (valid_2_of_3 refile "reasonligo"); + test "invalid_3_of_3 (religo)" (invalid_3_of_3 refile "reasonligo"); + test "not_enough_2_of_3 (religo)" (not_enough_2_of_3 refile "reasonligo"); ] From 62fe576bc9fb7c4b3fc01adc82c55271a7c1067a Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Thu, 20 Feb 2020 05:25:30 +0000 Subject: [PATCH 111/119] Revert "Merge branch 'fix/pascal-tuples-in-doc' into 'dev'" This reverts merge request !437 --- .../docs/language-basics/maps-records.md | 4 +- .../docs/language-basics/sets-lists-tuples.md | 4 +- gitlab-pages/docs/reference/map.md | 4 +- src/passes/1-parser/cameligo/ParserLog.ml | 2 - src/passes/1-parser/cameligo/ParserLog.mli | 3 - src/passes/1-parser/pascaligo/ParserLog.ml | 2 - src/passes/1-parser/pascaligo/ParserLog.mli | 2 - src/passes/2-simplify/pascaligo.ml | 59 ++++++------------- src/test/contracts/big_map.ligo | 4 +- src/test/contracts/deep_access.ligo | 6 +- src/test/contracts/double_main.ligo | 2 +- src/test/contracts/map.ligo | 10 ++-- src/test/contracts/multisig.ligo | 4 +- src/test/contracts/simple_access.ligo | 4 +- src/test/contracts/tuple.ligo | 6 +- 15 files changed, 43 insertions(+), 73 deletions(-) diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index e5985caf4..d691d588e 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -614,7 +614,7 @@ operation over maps is called `map_map` and is used as follows: function map_op (const m : register) : register is block { function increment (const i : address; const j : move) : move is - (j.1, j.2 + 1); + (j.0, j.1 + 1); } with map_map (increment, m) ``` @@ -664,7 +664,7 @@ follows: ```pascaligo group=f function fold_op (const m : register) : int is block { function folded (const j : int; const cur : address * move) : int is - j + cur.2.2 + j + cur.1.1 } with map_fold (folded, m, 5) ``` diff --git a/gitlab-pages/docs/language-basics/sets-lists-tuples.md b/gitlab-pages/docs/language-basics/sets-lists-tuples.md index d4f3f856f..a3db92b6d 100644 --- a/gitlab-pages/docs/language-basics/sets-lists-tuples.md +++ b/gitlab-pages/docs/language-basics/sets-lists-tuples.md @@ -84,10 +84,10 @@ let first_name : string = full_name.0 -Tuple components are zero-indexed and accessed like so: +Tuple components are one-indexed and accessed like so: ```reasonligo group=tuple -let first_name : string = full_name[0]; +let first_name : string = full_name[1]; ``` diff --git a/gitlab-pages/docs/reference/map.md b/gitlab-pages/docs/reference/map.md index 71684c945..70710e8b7 100644 --- a/gitlab-pages/docs/reference/map.md +++ b/gitlab-pages/docs/reference/map.md @@ -238,7 +238,7 @@ rule `mapping_function`. ```pascaligo function map_op (const m : moveset) : moveset is block { - function increment (const i : address ; const j : move) : move is (j.1, j.2 + 1); + function increment (const i : address ; const j : move) : move is (j.0, j.1 + 1); } with map_map (increment, m); ``` @@ -267,7 +267,7 @@ Combine every value in the map together according to a fold rule `folding_functi ```pascaligo function fold_op (const m : moveset) : int is block { - function aggregate (const j : int; const cur : address * (int * int)) : int is j + cur.2.2 + function aggregate (const j : int; const cur : address * (int * int)) : int is j + cur.1.1 } with map_fold(aggregate, m, 5) ``` diff --git a/src/passes/1-parser/cameligo/ParserLog.ml b/src/passes/1-parser/cameligo/ParserLog.ml index 7ae68ca76..aa847e245 100644 --- a/src/passes/1-parser/cameligo/ParserLog.ml +++ b/src/passes/1-parser/cameligo/ParserLog.ml @@ -591,8 +591,6 @@ let pattern_to_string ~offsets ~mode = to_string ~offsets ~mode print_pattern let expr_to_string ~offsets ~mode = to_string ~offsets ~mode print_expr -let projection_to_string ~offsets ~mode = - to_string ~offsets ~mode print_projection (** {1 Pretty-printing the AST} *) diff --git a/src/passes/1-parser/cameligo/ParserLog.mli b/src/passes/1-parser/cameligo/ParserLog.mli index 51013faed..d16252478 100644 --- a/src/passes/1-parser/cameligo/ParserLog.mli +++ b/src/passes/1-parser/cameligo/ParserLog.mli @@ -17,7 +17,6 @@ val mk_state : val print_tokens : state -> AST.t -> unit val print_pattern : state -> AST.pattern -> unit val print_expr : state -> AST.expr -> unit -val print_projection : state -> AST.projection Region.reg -> unit val tokens_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.t -> string @@ -25,8 +24,6 @@ val pattern_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.pattern -> string val expr_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.expr -> string -val projection_to_string : - offsets:bool -> mode:[`Point|`Byte] -> AST.projection Region.reg -> string (** {1 Pretty-printing of AST nodes} *) diff --git a/src/passes/1-parser/pascaligo/ParserLog.ml b/src/passes/1-parser/pascaligo/ParserLog.ml index 25785419b..d423006f2 100644 --- a/src/passes/1-parser/pascaligo/ParserLog.ml +++ b/src/passes/1-parser/pascaligo/ParserLog.ml @@ -816,8 +816,6 @@ let pattern_to_string ~offsets ~mode = to_string ~offsets ~mode print_pattern let instruction_to_string ~offsets ~mode = to_string ~offsets ~mode print_instruction -let projection_to_string ~offsets ~mode = - to_string ~offsets ~mode print_projection (** {1 Pretty-printing the AST} *) diff --git a/src/passes/1-parser/pascaligo/ParserLog.mli b/src/passes/1-parser/pascaligo/ParserLog.mli index b85585715..955c1590b 100644 --- a/src/passes/1-parser/pascaligo/ParserLog.mli +++ b/src/passes/1-parser/pascaligo/ParserLog.mli @@ -30,8 +30,6 @@ val pattern_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.pattern -> string val instruction_to_string : offsets:bool -> mode:[`Point|`Byte] -> AST.instruction -> string -val projection_to_string : - offsets:bool -> mode:[`Point|`Byte] -> AST.projection Region.reg -> string (** {1 Pretty-printing of AST nodes} *) diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index efd746cc5..a7ce6ea0e 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -184,20 +184,6 @@ module Errors = struct ] in error ~data title message - let zero_index_access (p: _ Region.reg) = - let title () = "" in - let message () = - Format.asprintf "\n In PascaLigo, tuple indexes start at one \n" in - let pattern_loc = p.region in - let data = [ - ("location", - fun () -> Format.asprintf "%a" Location.pp_lift @@ pattern_loc); - ("tuple", - fun () -> ParserLog.projection_to_string - ~offsets:true ~mode:`Point p) - ] in - error ~data title message - (* Logging *) let simplifying_instruction t = @@ -313,16 +299,13 @@ let simpl_projection : Raw.projection Region.reg -> _ = fun p -> let name = Var.of_name p'.struct_name.value in e_variable name in let path = p'.field_path in - let%bind path' = + let path' = let aux (s:Raw.selection) = match s with - | FieldName property -> ok property.value - | Component index -> - let i:Z.t = Z.pred (snd index.value) in - if (Z.lt i Z.zero) then fail @@ zero_index_access p - else ok (Z.to_string i) + | FieldName property -> property.value + | Component index -> (Z.to_string (snd index.value)) in - bind_map_list aux @@ npseq_to_list path in + List.map aux @@ npseq_to_list path in ok @@ List.fold_left (e_accessor ~loc) var path' @@ -515,7 +498,7 @@ let rec simpl_expression (t:Raw.expr) : expr result = and simpl_update = fun (u:Raw.update Region.reg) -> let (u, loc) = r_split u in - let%bind (name, path) = simpl_path u.record in + let (name, path) = simpl_path u.record in let record = match path with | [] -> e_variable (Var.of_name name) | _ -> e_accessor_list (e_variable (Var.of_name name)) path in @@ -928,7 +911,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind value_expr = simpl_expression a.rhs in match a.lhs with | Path path -> ( - let%bind (name , path') = simpl_path path in + let (name , path') = simpl_path path in let (let_binder, mut, rhs, inline) = e_assign_with_let ~loc name path' value_expr in return_let_in let_binder mut inline rhs ) @@ -937,7 +920,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind (varname,map,path) = match v'.path with | Name name -> ok (name.value , e_variable (Var.of_name name.value), []) | Path p -> - let%bind (name,p') = simpl_path v'.path in + let (name,p') = simpl_path v'.path in let%bind accessor = simpl_projection p in ok @@ (name , accessor , p') in @@ -999,7 +982,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul } in let u : Raw.update = {record=r.path;kwd_with=r.kwd_with; updates=update} in let%bind expr = simpl_update {value=u;region=reg} in - let%bind (name , access_path) = simpl_path r.path in + let (name , access_path) = simpl_path r.path in let loc = Some loc in let (binder, mut, rhs, inline) = e_assign_with_let ?loc name access_path expr in return_let_in binder mut inline rhs @@ -1007,7 +990,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul ) | MapPatch patch -> ( let (map_p, loc) = r_split patch in - let%bind (name, access_path) = simpl_path map_p.path in + let (name, access_path) = simpl_path map_p.path in let%bind inj = bind_list @@ List.map (fun (x:Raw.binding Region.reg) -> let x = x.value in @@ -1030,7 +1013,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul ) | SetPatch patch -> ( let (setp, loc) = r_split patch in - let%bind (name , access_path) = simpl_path setp.path in + let (name , access_path) = simpl_path setp.path in let%bind inj = bind_list @@ List.map simpl_expression @@ @@ -1050,7 +1033,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind (varname,map,path) = match v.map with | Name v -> ok (v.value , e_variable (Var.of_name v.value) , []) | Path p -> - let%bind (name,p') = simpl_path v.map in + let (name,p') = simpl_path v.map in let%bind accessor = simpl_projection p in ok @@ (name , accessor , p') in @@ -1064,7 +1047,7 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul let%bind (varname, set, path) = match set_rm.set with | Name v -> ok (v.value, e_variable (Var.of_name v.value), []) | Path path -> - let%bind (name, p') = simpl_path set_rm.set in + let(name, p') = simpl_path set_rm.set in let%bind accessor = simpl_projection path in ok @@ (name, accessor, p') in @@ -1074,25 +1057,21 @@ and simpl_single_instruction : Raw.instruction -> (_ -> expression result) resul return_let_in binder mut inline rhs ) -and simpl_path : Raw.path -> (string * string list) result = fun p -> +and simpl_path : Raw.path -> string * string list = fun p -> match p with - | Raw.Name v -> ok (v.value , []) + | Raw.Name v -> (v.value , []) | Raw.Path p -> ( let p' = p.value in let var = p'.struct_name.value in let path = p'.field_path in - let%bind path' = + let path' = let aux (s:Raw.selection) = match s with - | FieldName property -> ok property.value - | Component index -> - let i:Z.t = Z.pred (snd index.value) in - if (Z.lt i Z.zero) then fail @@ zero_index_access p - else ok (Z.to_string i) + | FieldName property -> property.value + | Component index -> (Z.to_string (snd index.value)) in - bind_map_list aux @@ npseq_to_list path - in - ok (var , path') + List.map aux @@ npseq_to_list path in + (var , path') ) and simpl_cases : (Raw.pattern * expression) list -> matching_expr result = fun t -> diff --git a/src/test/contracts/big_map.ligo b/src/test/contracts/big_map.ligo index 3ebaa2ff5..9b8364ac3 100644 --- a/src/test/contracts/big_map.ligo +++ b/src/test/contracts/big_map.ligo @@ -5,8 +5,8 @@ type return is list (operation) * storage function main (const p : parameter; const s : storage) : return is block { var toto : option (int) := Some (0); - toto := s.1[23]; - s.1[2] := 444 + toto := s.0[23]; + s.0[2] := 444 } with ((nil: list(operation)), s) diff --git a/src/test/contracts/deep_access.ligo b/src/test/contracts/deep_access.ligo index 9dcd39fa4..2d9ad32d4 100644 --- a/src/test/contracts/deep_access.ligo +++ b/src/test/contracts/deep_access.ligo @@ -11,14 +11,14 @@ function main (const toto : unit) : int is var a : ppp := (record [x = (0,1); y = (10,11)], record [x = (100,101); y = (110,111)]); - a.1.x.1 := 2; - } with a.1.x.1 + a.0.x.0 := 2; + } with a.0.x.0 function asymetric_tuple_access (const foo : unit) : int is block { var tuple : int * (int * (int * int)) := (0,(1,(2,3))) - } with tuple.1 + tuple.2.1 + tuple.2.2.1 + tuple.2.2.2 + } with tuple.0 + tuple.1.0 + tuple.1.1.0 + tuple.1.1.1 type nested_record_t is record [nesty : record [mymap : map (int,string)]] diff --git a/src/test/contracts/double_main.ligo b/src/test/contracts/double_main.ligo index 803e3df13..a46df45ab 100644 --- a/src/test/contracts/double_main.ligo +++ b/src/test/contracts/double_main.ligo @@ -8,4 +8,4 @@ function main(const p : parameter; const s : storage) : return is function main (const p : parameter; const s : storage) : return is block { const ret : return = main (p, s) - } with (ret.1, ret.2 + 1) + } with (ret.0, ret.1 + 1) diff --git a/src/test/contracts/map.ligo b/src/test/contracts/map.ligo index 7e7f792fa..eabd8edc7 100644 --- a/src/test/contracts/map.ligo +++ b/src/test/contracts/map.ligo @@ -28,7 +28,7 @@ function patch_ (var m : foobar) : foobar is block { } with m function patch_deep (var m : foobar * nat) : foobar * nat is - block { patch m.1 with map [1 -> 9] } with m + block { patch m.0 with map [1 -> 9] } with m function size_ (const m : foobar) : nat is size (m) @@ -54,12 +54,12 @@ function map_op (const m : foobar) : foobar is function fold_op (const m : foobar) : int is block { function aggregate (const i : int; const j : int * int) : int is - i + j.1 + j.2 + i + j.0 + j.1 } with map_fold(aggregate, m, 10) function deep_op (var m : foobar) : foobar is block { var coco : int * foobar := (0, m); - remove 42 from map coco.2; - coco.2[32] := 16 - } with coco.2 + remove 42 from map coco.1; + coco.1[32] := 16 + } with coco.1 diff --git a/src/test/contracts/multisig.ligo b/src/test/contracts/multisig.ligo index 8e1480803..f0cdb636c 100644 --- a/src/test/contracts/multisig.ligo +++ b/src/test/contracts/multisig.ligo @@ -47,8 +47,8 @@ function check_message (const param : check_message_pt; nil -> skip | key # tl -> block { keys := tl; - if pkh_sig.1 = crypto_hash_key (key) then - if crypto_check (key, pkh_sig.2, packed_payload) + if pkh_sig.0 = crypto_hash_key (key) then + if crypto_check (key, pkh_sig.1, packed_payload) then valid := valid + 1n else failwith ("Invalid signature") else skip diff --git a/src/test/contracts/simple_access.ligo b/src/test/contracts/simple_access.ligo index 0c8522988..e26e23bc7 100644 --- a/src/test/contracts/simple_access.ligo +++ b/src/test/contracts/simple_access.ligo @@ -11,8 +11,8 @@ function main (const toto : tpi) : int is var a : tpi := toto; var b : rpi := record x = 0; y=1 ; end; var m : mpi := map "y" -> 1; end; - a.1 := 2; - b.x := a.1; + a.0 := 2; + b.x := a.0; m["x"] := b.x; end with case m["x"] of diff --git a/src/test/contracts/tuple.ligo b/src/test/contracts/tuple.ligo index 07e9c8f71..9a39cde03 100644 --- a/src/test/contracts/tuple.ligo +++ b/src/test/contracts/tuple.ligo @@ -1,11 +1,11 @@ type abc is (int * int * int) function projection_abc (const tpl : abc) : int is - block { skip } with tpl.2 + block { skip } with tpl.1 function modify_abc (const tpl : abc) : abc is block { - tpl.2 := 2048 ; + tpl.1 := 2048 ; } with tpl type foobar is (int * int) @@ -15,7 +15,7 @@ const fb : foobar = (0, 0) function projection (const tpl : foobar) : int is begin skip - end with tpl.1 + tpl.2 + end with tpl.0 + tpl.1 type big_tuple is (int * int * int * int * int) From ea74ed8a2ca7e9d609f11f3ab1775c6b1ae817f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 10 Feb 2020 21:05:51 +0100 Subject: [PATCH 112/119] Normalize indentation etc. of ast_typed in preparation for the ADT generator --- src/stages/ast_typed/types.ml | 120 +++++++++++++++++++++------------- 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/src/stages/ast_typed/types.ml b/src/stages/ast_typed/types.ml index 5aa323c9b..8d4170b45 100644 --- a/src/stages/ast_typed/types.ml +++ b/src/stages/ast_typed/types.ml @@ -26,11 +26,12 @@ and declaration = *) (* | Macro_declaration of macro_declaration *) -and expression = - { expression_content: expression_content - ; location: Location.t - ; type_expression: type_expression - ; environment: full_environment } +and expression = { + expression_content: expression_content ; + location: Location.t ; + type_expression: type_expression ; + environment: full_environment ; + } and expression_content = (* Base *) @@ -56,63 +57,90 @@ and expression_content = | E_look_up of (expression * expression) (* Advanced *) | E_loop of loop - (* - | E_ascription of ascription - *) - -and constant = - { cons_name: constant' (* this is at the end because it is huge *) - ; arguments: expression list } + (* | E_ascription of ascription *) +and constant = { + cons_name: constant' ; + arguments: expression list ; + } and application = {expr1: expression; expr2: expression} -and lambda = - { binder: expression_variable - (* ; input_type: type_expression option - ; output_type: type_expression option *) - ; result: expression } - -and let_in = - { let_binder: expression_variable - ; rhs: expression - ; let_result: expression - ; inline : inline } - -and constructor = {constructor: constructor'; element: expression} - -and accessor = {expr: expression; label: label} - -and update = {record: expression; path: label ; update: expression} - -and loop = {condition: expression; body: expression} - -and matching_expr = (expression,type_expression) matching_content -and matching = - { matchee: expression - ; cases: matching_expr +and lambda = { + binder: expression_variable ; + (* input_type: type_expression option ; *) + (* output_type: type_expression option ; *) + result: expression ; } -and ascription = {anno_expr: expression; type_annotation: type_expression} +and let_in = { + let_binder: expression_variable ; + rhs: expression ; + let_result: expression ; + inline : inline ; + } + +and constructor = { + constructor: constructor'; + element: expression ; + } + +and accessor = { + expr: expression ; + label: label ; + } + +and update = { + record: expression ; + path: label ; + update: expression ; + } + +and loop = { + condition: expression ; + body: expression ; + } + +and matching_expr = (expression, type_expression) matching_content +and matching = { + matchee: expression ; + cases: matching_expr ; + } + +and ascription = { + anno_expr: expression ; + type_annotation: type_expression ; + } and environment_element_definition = | ED_binder - | ED_declaration of (expression * free_variables) + | ED_declaration of environment_element_definition_declaration + +and environment_element_definition_declaration = + (expression * free_variables) and free_variables = expression_variable list -and environment_element = - { type_value: type_expression - ; source_environment: full_environment - ; definition: environment_element_definition } +and environment_element = { + type_value: type_expression ; + source_environment: full_environment ; + definition: environment_element_definition ; + } -and environment = (expression_variable * environment_element) list +and environment = environment_binding list -and type_environment = (type_variable * type_expression) list +and environment_binding = + (expression_variable * environment_element) + +and type_environment = type_environment_binding list + +and type_environment_binding = + (type_variable * type_expression) (* SUBST ??? *) -and small_environment = environment * type_environment +and small_environment = + (environment * type_environment) and full_environment = small_environment List.Ne.t @@ -123,4 +151,4 @@ and texpr = type_expression and named_type_content = { type_name : type_variable; type_value : type_expression; -} + } From 4f36ff3bcb8f92ee36f96cdb7e8954b7ccd32683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Mon, 17 Feb 2020 18:09:35 +0100 Subject: [PATCH 113/119] Replace OCaml tuples with record in ast_typed --- src/passes/6-transpiler/transpiler.ml | 2 +- src/stages/ast_typed/environment.ml | 42 +++++++++++++++------------ src/stages/ast_typed/misc_smart.ml | 2 +- src/stages/ast_typed/types.ml | 24 ++++++++++----- src/stages/typesystem/misc.ml | 22 +++++++------- 5 files changed, 52 insertions(+), 40 deletions(-) diff --git a/src/passes/6-transpiler/transpiler.ml b/src/passes/6-transpiler/transpiler.ml index 632fe0ee9..1a4569f75 100644 --- a/src/passes/6-transpiler/transpiler.ml +++ b/src/passes/6-transpiler/transpiler.ml @@ -338,7 +338,7 @@ and transpile_annotated_expression (ae:AST.expression) : expression result = trace_option (corner_case ~loc:__LOC__ "missing var") @@ AST.Environment.get_opt v f.environment in match elt.definition with - | ED_declaration (f , _) -> ( + | ED_declaration { expr = f ; free_variables = _ } -> ( match f.expression_content with | E_lambda l -> lambda_to_iterator_body f l | _ -> fail @@ unsupported_iterator f.location diff --git a/src/stages/ast_typed/environment.ml b/src/stages/ast_typed/environment.ml index 61c21ed8a..cc0aa2878 100644 --- a/src/stages/ast_typed/environment.ml +++ b/src/stages/ast_typed/environment.ml @@ -6,24 +6,28 @@ let make_element : type_expression -> full_environment -> environment_element_de fun type_value source_environment definition -> {type_value ; source_environment ; definition} let make_element_binder = fun t s -> make_element t s ED_binder -let make_element_declaration = fun s (ae : expression) -> - let free_variables = Misc.Free_variables.(expression empty ae) in - make_element (get_type_expression ae) s (ED_declaration (ae , free_variables)) +let make_element_declaration = fun s (expr : expression) -> + let free_variables = Misc.Free_variables.(expression empty expr) in + make_element (get_type_expression expr) s (ED_declaration {expr ; free_variables}) module Small = struct type t = small_environment - let empty : t = ([] , []) + let empty : t = { expression_environment = [] ; type_environment = [] } - let get_environment : t -> environment = fst - let get_type_environment : t -> type_environment = snd - let map_environment : _ -> t -> t = fun f (a , b) -> (f a , b) - let map_type_environment : _ -> t -> t = fun f (a , b) -> (a , f b) + (* TODO: generate *) + let get_environment : t -> environment = fun { expression_environment ; type_environment=_ } -> expression_environment + (* TODO: generate *) + let get_type_environment : t -> type_environment = fun { expression_environment=_ ; type_environment } -> type_environment + (* TODO: generate *) + let map_environment : _ -> t -> t = fun f { expression_environment ; type_environment } -> { expression_environment = f expression_environment ; type_environment } + let map_type_environment : _ -> t -> t = fun f { expression_environment ; type_environment } -> { expression_environment ; type_environment = f type_environment } - let add : expression_variable -> element -> t -> t = fun k v -> map_environment (fun x -> (k , v) :: x) - let add_type : type_variable -> type_expression -> t -> t = fun k v -> map_type_environment (fun x -> (k , v) :: x) - let get_opt : expression_variable -> t -> element option = fun k x -> List.assoc_opt k (get_environment x) - let get_type_opt : type_variable -> t -> type_expression option = fun k x -> List.assoc_opt k (get_type_environment x) + let add : expression_variable -> element -> t -> t = fun expr_var env_elt -> map_environment (fun x -> {expr_var ; env_elt} :: x) + let add_type : type_variable -> type_expression -> t -> t = fun type_variable type_ -> map_type_environment (fun x -> { type_variable ; type_ } :: x) + (* TODO: generate : these are now messy, clean them up. *) + let get_opt : expression_variable -> t -> element option = fun k x -> Option.bind (fun {expr_var=_ ; env_elt} -> Some env_elt) @@ List.find_opt (fun {expr_var ; env_elt=_} -> Var.equal expr_var k) (get_environment x) + let get_type_opt : type_variable -> t -> type_expression option = fun k x -> Option.bind (fun {type_variable=_ ; type_} -> Some type_) @@ List.find_opt (fun {type_variable ; type_=_} -> Var.equal type_variable k) (get_type_environment x) end type t = full_environment @@ -41,11 +45,11 @@ let get_type_opt : type_variable -> t -> type_expression option = fun k x -> Lis let get_constructor : constructor' -> t -> (type_expression * type_expression) option = fun k x -> (* Left is the constructor, right is the sum type *) let aux = fun x -> - let aux = fun (_type_name , x) -> - match x.type_content with + let aux = fun {type_variable=_ ; type_} -> + match type_.type_content with | T_sum m -> (match CMap.find_opt k m with - Some km -> Some (km , x) + Some km -> Some (km , type_) | None -> None) | _ -> None in @@ -60,11 +64,11 @@ module PP = struct let list_sep_scope x = list_sep x (const " | ") - let environment_element = fun ppf (k , (ele : environment_element)) -> - fprintf ppf "%a -> %a" PP.expression_variable k PP.type_expression ele.type_value + let environment_element = fun ppf {expr_var ; env_elt} -> + fprintf ppf "%a -> %a" PP.expression_variable expr_var PP.type_expression env_elt.type_value - let type_environment_element = fun ppf (k , tv) -> - fprintf ppf "%a -> %a" PP.type_variable k PP.type_expression tv + let type_environment_element = fun ppf {type_variable ; type_} -> + fprintf ppf "%a -> %a" PP.type_variable type_variable PP.type_expression type_ let environment : _ -> environment -> unit = fun ppf lst -> fprintf ppf "E[%a]" (list_sep environment_element (const " , ")) lst diff --git a/src/stages/ast_typed/misc_smart.ml b/src/stages/ast_typed/misc_smart.ml index 3cc52eaec..bf376f383 100644 --- a/src/stages/ast_typed/misc_smart.ml +++ b/src/stages/ast_typed/misc_smart.ml @@ -59,7 +59,7 @@ module Captured_variables = struct Environment.get_opt name ae.environment in match env_element.definition with | ED_binder -> ok empty - | ED_declaration (_ , _) -> simple_fail "todo" + | ED_declaration {expr=_ ; free_variables=_} -> simple_fail "todo" ) | E_application {expr1;expr2} -> let%bind lst' = bind_map_list self [ expr1 ; expr2 ] in diff --git a/src/stages/ast_typed/types.ml b/src/stages/ast_typed/types.ml index 8d4170b45..8b9195d60 100644 --- a/src/stages/ast_typed/types.ml +++ b/src/stages/ast_typed/types.ml @@ -117,8 +117,10 @@ and environment_element_definition = | ED_binder | ED_declaration of environment_element_definition_declaration -and environment_element_definition_declaration = - (expression * free_variables) +and environment_element_definition_declaration = { + expr: expression ; + free_variables: free_variables ; + } and free_variables = expression_variable list @@ -130,17 +132,23 @@ and environment_element = { and environment = environment_binding list -and environment_binding = - (expression_variable * environment_element) +and environment_binding = { + expr_var: expression_variable ; + env_elt: environment_element ; + } and type_environment = type_environment_binding list -and type_environment_binding = - (type_variable * type_expression) +and type_environment_binding = { + type_variable: type_variable ; + type_: type_expression ; +} (* SUBST ??? *) -and small_environment = - (environment * type_environment) +and small_environment = { + expression_environment: environment ; + type_environment: type_environment ; +} and full_environment = small_environment List.Ne.t diff --git a/src/stages/typesystem/misc.ml b/src/stages/typesystem/misc.ml index eb5e11c16..011fef1b7 100644 --- a/src/stages/typesystem/misc.ml +++ b/src/stages/typesystem/misc.ml @@ -17,25 +17,25 @@ module Substitution = struct let rec rec_yes = true and s_environment_element_definition ~substs = function | T.ED_binder -> ok @@ T.ED_binder - | T.ED_declaration (val_, free_variables) -> - let%bind val_ = s_expression ~substs val_ in + | T.ED_declaration T.{expr ; free_variables} -> + let%bind expr = s_expression ~substs expr in let%bind free_variables = bind_map_list (s_variable ~substs) free_variables in - ok @@ T.ED_declaration (val_, free_variables) + ok @@ T.ED_declaration {expr ; free_variables} and s_environment : T.environment w = fun ~substs env -> - bind_map_list (fun (variable, T.{ type_value; source_environment; definition }) -> + bind_map_list (fun T.{expr_var=variable ; env_elt={ type_value; source_environment; definition }} -> let%bind type_value = s_type_expression ~substs type_value in let%bind source_environment = s_full_environment ~substs source_environment in let%bind definition = s_environment_element_definition ~substs definition in - ok @@ (variable, T.{ type_value; source_environment; definition })) env + ok @@ T.{expr_var=variable ; env_elt={ type_value; source_environment; definition }}) env and s_type_environment : T.type_environment w = fun ~substs tenv -> - bind_map_list (fun (type_variable , type_value) -> + bind_map_list (fun T.{type_variable ; type_} -> let%bind type_variable = s_type_variable ~substs type_variable in - let%bind type_value = s_type_expression ~substs type_value in - ok @@ (type_variable , type_value)) tenv - and s_small_environment : T.small_environment w = fun ~substs (environment, type_environment) -> - let%bind environment = s_environment ~substs environment in + let%bind type_ = s_type_expression ~substs type_ in + ok @@ T.{type_variable ; type_}) tenv + and s_small_environment : T.small_environment w = fun ~substs T.{expression_environment ; type_environment} -> + let%bind expression_environment = s_environment ~substs expression_environment in let%bind type_environment = s_type_environment ~substs type_environment in - ok @@ (environment, type_environment) + ok @@ T.{ expression_environment ; type_environment } and s_full_environment : T.full_environment w = fun ~substs (a , b) -> let%bind a = s_small_environment ~substs a in let%bind b = bind_map_list (s_small_environment ~substs) b in From c4c79e69f29c09df35b3a28827d2cd7e4e7ac07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 20 Feb 2020 16:52:07 +0100 Subject: [PATCH 114/119] Run dev pipeline for *-run-dev branches: fix "docker push" to the next-attempt tag --- .gitlab-ci.yml | 4 ++-- scripts/build_docker_image.sh | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1c003fd77..b3deaa2d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,7 +121,7 @@ build-current-docker-image: - build-and-package-debian-10 <<: *docker script: - - sh scripts/build_docker_image.sh + - sh scripts/build_docker_image.sh next - sh scripts/test_cli.sh only: - merge_requests @@ -134,7 +134,7 @@ build-and-publish-latest-docker-image: dependencies: - build-and-package-debian-10 script: - - sh scripts/build_docker_image.sh + - sh scripts/build_docker_image.sh $(if test "$CI_COMMIT_REF_NAME" = "dev"; then echo next; else echo next-attempt; fi) - sh scripts/test_cli.sh - echo ${LIGO_REGISTRY_PASSWORD} | docker login -u ${LIGO_REGISTRY_USER} --password-stdin - docker push ${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$(if test "$CI_COMMIT_REF_NAME" = "dev"; then echo next; else echo next-attempt; fi) diff --git a/scripts/build_docker_image.sh b/scripts/build_docker_image.sh index 260a530c7..3934417a9 100755 --- a/scripts/build_docker_image.sh +++ b/scripts/build_docker_image.sh @@ -1,3 +1,9 @@ #!/bin/sh set -e -docker build -t "${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:next" -f ./docker/distribution/debian/distribute.Dockerfile . \ No newline at end of file + +if test $# -ne 1 || test "x$1" = "-h" -o "x$1" = "x--help"; then + echo "Usage: build_docker_image.sh TAG_NAME" + exit 1 +fi + +docker build -t "${LIGO_REGISTRY_IMAGE_BUILD:-ligolang/ligo}:$1" -f ./docker/distribution/debian/distribute.Dockerfile . From 4c53fa4ae66dce8ff97853127bd71d419b9fce77 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Wed, 19 Feb 2020 14:55:02 -0600 Subject: [PATCH 115/119] Fix non-tail fail avoidance --- src/passes/9-self_michelson/dune | 3 ++- src/passes/9-self_michelson/self_michelson.ml | 22 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/passes/9-self_michelson/dune b/src/passes/9-self_michelson/dune index b7387bdc1..c5275ec70 100644 --- a/src/passes/9-self_michelson/dune +++ b/src/passes/9-self_michelson/dune @@ -6,7 +6,8 @@ tezos-utils ) (preprocess - (pps ppx_let bisect_ppx --conditional) + (pps ppx_let bisect_ppx --conditional ppx_expect) ) + (inline_tests) (flags (:standard -w +1..62-4-9-44-40-42-48-30@39@33 -open Simple_utils )) ) diff --git a/src/passes/9-self_michelson/self_michelson.ml b/src/passes/9-self_michelson/self_michelson.ml index 19fe58476..8a3291204 100644 --- a/src/passes/9-self_michelson/self_michelson.ml +++ b/src/passes/9-self_michelson/self_michelson.ml @@ -382,14 +382,28 @@ let rec opt_tail_fail : michelson -> michelson = let rec aux args = match args with | [] -> [] - | arg :: _ when is_failing arg -> [arg] - | arg :: args -> arg :: aux args in - let args = aux args in - Seq (l, List.map opt_tail_fail args) + | arg :: args -> + let arg = opt_tail_fail arg in + if is_failing arg + then [arg] + else arg :: aux args in + Seq (l, aux args) | Prim (l, p, args, annot) -> Prim (l, p, List.map opt_tail_fail args, annot) | x -> x +let%expect_test _ = + let seq args = Seq(-1, args) in + let prim p args = Prim(-1, p, args, []) in + let code = seq [ prim I_IF_LEFT [ seq [ prim I_FAILWITH [] ; prim I_DROP [] ] + ; seq [ prim I_FAILWITH [] ; prim I_DROP [] ] + ] + ; prim I_DROP [] + ] in + let code = opt_tail_fail code in + Format.printf "%a" Tezos_utils.Michelson.pp code ; + [%expect {| { IF_LEFT { FAILWITH } { FAILWITH } } |}] + let rec opt_combine_drops (x : michelson) : michelson = let rec combine : michelson list -> michelson list = function | [] -> [] From 01531ac3079c3ae90e970e04506c1d2440385f7e Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Thu, 20 Feb 2020 12:07:01 -0600 Subject: [PATCH 116/119] Support lowercase in hex bytes --- src/passes/1-parser/shared/Lexer.mll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/passes/1-parser/shared/Lexer.mll b/src/passes/1-parser/shared/Lexer.mll index 2821acc85..8b213f70b 100644 --- a/src/passes/1-parser/shared/Lexer.mll +++ b/src/passes/1-parser/shared/Lexer.mll @@ -580,7 +580,7 @@ let letter = small | capital let ident = small (letter | '_' | digit)* let constr = capital (letter | '_' | digit)* let attr = ident | constr -let hexa_digit = digit | ['A'-'F'] +let hexa_digit = digit | ['A'-'F' 'a'-'f'] let byte = hexa_digit hexa_digit let byte_seq = byte | byte (byte | '_')* byte let bytes = "0x" (byte_seq? as seq) From 23353b0e274545aaf8c49521678496ae5859f40a Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Tue, 21 Jan 2020 02:23:56 -0600 Subject: [PATCH 117/119] Clarify internal sender/source options --- src/main/run/of_michelson.ml | 2 +- src/test/coase_tests.ml | 8 ++-- src/test/hash_lock_tests.ml | 12 +++--- src/test/id_tests.ml | 24 +++++------ src/test/multisig_v2_tests.ml | 40 +++++++++---------- src/test/replaceable_id_tests.ml | 16 ++++---- .../proto-alpha-utils/x_memory_proto_alpha.ml | 9 +++-- 7 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/main/run/of_michelson.ml b/src/main/run/of_michelson.ml index 4a9b7e1c3..6e8733e0e 100644 --- a/src/main/run/of_michelson.ml +++ b/src/main/run/of_michelson.ml @@ -75,7 +75,7 @@ let make_dry_run_options (opts : dry_run_options) : options result = match Memory_proto_alpha.Protocol.Alpha_context.Timestamp.of_notation st with | Some t -> ok (Some t) | None -> simple_fail ("\""^st^"\" is a bad timestamp notation") in - ok @@ make_options ?predecessor_timestamp:predecessor_timestamp ~amount ?source:sender ?payer:source () + ok @@ make_options ?predecessor_timestamp:predecessor_timestamp ~amount ?sender ?source () let ex_value_ty_to_michelson (v : ex_typed_value) : Michelson.t result = let (Ex_typed_value (value , ty)) = v in diff --git a/src/test/coase_tests.ml b/src/test/coase_tests.ml index 57e55b495..f335ec45b 100644 --- a/src/test/coase_tests.ml +++ b/src/test/coase_tests.ml @@ -204,8 +204,8 @@ let transfer () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let payer = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () in + let source = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in expect_eq_n_strict_pos_small ~options program "transfer_single" make_input make_expected in ok () in @@ -234,8 +234,8 @@ let sell () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let payer = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () in + let source = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in expect_n_strict_pos_small ~options program "sell_single" make_input make_expecter in ok () in diff --git a/src/test/hash_lock_tests.ml b/src/test/hash_lock_tests.ml index bff1e8219..7bfe77c88 100644 --- a/src/test/hash_lock_tests.ml +++ b/src/test/hash_lock_tests.ml @@ -78,7 +78,7 @@ let commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_eq ~options program "commit" @@ -127,7 +127,7 @@ let reveal_young_commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -159,7 +159,7 @@ let reveal_breaks_commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -191,7 +191,7 @@ let reveal_wrong_commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -223,7 +223,7 @@ let reveal_no_reuse () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -256,7 +256,7 @@ let reveal () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_eq ~options program "reveal" diff --git a/src/test/id_tests.ml b/src/test/id_tests.ml index dfe5be581..db8b78960 100644 --- a/src/test/id_tests.ml +++ b/src/test/id_tests.ml @@ -48,7 +48,7 @@ let buy_id () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in @@ -81,7 +81,7 @@ let buy_id_sender_addr () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in @@ -115,7 +115,7 @@ let buy_id_wrong_amount () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) () in let param = e_pair owner_website (e_some (e_address new_addr)) in @@ -134,7 +134,7 @@ let update_details_owner () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -175,7 +175,7 @@ let update_details_controller () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -217,7 +217,7 @@ let update_details_nonexistent () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -284,7 +284,7 @@ let update_details_unchanged () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -316,7 +316,7 @@ let update_owner () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -355,7 +355,7 @@ let update_owner_nonexistent () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -386,7 +386,7 @@ let update_owner_wrong_addr () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -416,7 +416,7 @@ let skip () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in @@ -450,7 +450,7 @@ let skip_wrong_amount () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) () in let new_website = e_bytes_string "ligolang.org" in diff --git a/src/test/multisig_v2_tests.ml b/src/test/multisig_v2_tests.ml index e21736586..0ed619c1d 100644 --- a/src/test/multisig_v2_tests.ml +++ b/src/test/multisig_v2_tests.ml @@ -73,8 +73,8 @@ let wrong_addr () = id_counter_list = [1,0 ; 2,0] ; msg_store_list = [] } in - let source = contract 3 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 3 in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = let exp_failwith = "Unauthorized address" in expect_string_failwith ~options program "main" @@ -89,8 +89,8 @@ let message_size_exceeded () = id_counter_list = [1,0] ; msg_store_list = [] } in - let source = contract 1 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = let exp_failwith = "Message size exceed maximum limit" in expect_string_failwith ~options program "main" @@ -107,8 +107,8 @@ let maximum_number_of_proposal () = id_counter_list = [1,1] ; msg_store_list = [(bytes1, e_set [e_address@@ addr 1])] } in - let source = contract 1 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = let exp_failwith = "Maximum number of proposal reached" in expect_string_failwith ~options program "main" @@ -126,8 +126,8 @@ let send_already_accounted () = msg_store_list = [(bytes, e_set [e_address@@ addr 1])] } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair (send_param empty_message) init_storage) (e_pair empty_op_list init_storage) @@ -147,8 +147,8 @@ let send_never_accounted () = msg_store_list = [(bytes, e_set [e_address@@ addr 1])] ; } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair (send_param empty_message) init_storage) (e_pair empty_op_list final_storage) @@ -168,8 +168,8 @@ let withdraw_already_accounted_one () = id_counter_list = [1,0 ; 2,0] ; msg_store_list = [] } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list final_storage) @@ -189,8 +189,8 @@ let withdraw_already_accounted_two () = id_counter_list = [1,0 ; 2,1] ; msg_store_list = [(bytes, e_set [e_address@@ addr 2])] } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list final_storage) @@ -212,8 +212,8 @@ let counters_reset () = id_counter_list = [1,0 ; 2,0 ; 3,0] ; msg_store_list = [] } in let options = - let source = contract 3 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 3 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list final_storage) @@ -227,8 +227,8 @@ let withdraw_never_accounted () = msg_store_list = [] ; } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list init_storage) @@ -243,8 +243,8 @@ let succeeded_storing () = msg_store_list = [(bytes, e_typed_set [] t_address)] ; } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = expect_eq_n_trace_aux ~options [1;2] program "main" (fun th -> let init_storage = storage (init_storage th) in diff --git a/src/test/replaceable_id_tests.ml b/src/test/replaceable_id_tests.ml index 6bf09e95a..54d7d1a64 100644 --- a/src/test/replaceable_id_tests.ml +++ b/src/test/replaceable_id_tests.ml @@ -44,8 +44,8 @@ let change_addr_success () = let init_storage = storage 1 in let param = entry_change_addr 2 in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list (storage 2)) @@ -54,8 +54,8 @@ let change_addr_fail () = let init_storage = storage 1 in let param = entry_change_addr 2 in let options = - let source = contract 3 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 3 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let exp_failwith = "Unauthorized sender" in expect_string_failwith ~options program "main" (e_pair param init_storage) exp_failwith @@ -65,8 +65,8 @@ let pass_message_success () = let init_storage = storage 1 in let param = entry_pass_message in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list init_storage) @@ -75,8 +75,8 @@ let pass_message_fail () = let init_storage = storage 1 in let param = entry_pass_message in let options = - let source = contract 2 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 2 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let exp_failwith = "Unauthorized sender" in expect_string_failwith ~options program "main" (e_pair param init_storage) exp_failwith diff --git a/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml b/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml index c613c86a4..a8f5aa468 100644 --- a/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml +++ b/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml @@ -1067,9 +1067,9 @@ type options = { let make_options ?(tezos_context = dummy_environment.tezos_context) ?(predecessor_timestamp = dummy_environment.tezos_context.predecessor_timestamp) - ?(source = (List.nth dummy_environment.identities 0).implicit_contract) + ?(sender = (List.nth dummy_environment.identities 0).implicit_contract) ?(self = (List.nth dummy_environment.identities 0).implicit_contract) - ?(payer = (List.nth dummy_environment.identities 1).implicit_contract) + ?(source = (List.nth dummy_environment.identities 1).implicit_contract) ?(amount = Alpha_context.Tez.one) ?(chain_id = Environment.Chain_id.zero) () @@ -1077,9 +1077,10 @@ let make_options let tezos_context = { tezos_context with predecessor_timestamp } in { tezos_context ; - source ; + (* yep *) + source = sender ; + payer = source ; self ; - payer ; amount ; chain_id ; } From 4b9e175063de95fcb6c6c42be58420224413f471 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Tue, 21 Jan 2020 02:24:16 -0600 Subject: [PATCH 118/119] Examples: don't use SOURCE --- src/bin/expect_tests/contract_tests.ml | 10 +++++----- src/test/coase_tests.ml | 20 ++++++++++---------- src/test/contracts/coase.ligo | 8 ++++---- src/test/contracts/get_contract.ligo | 4 ++-- src/test/contracts/vote.mligo | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index c1ec32c6e..bacbfc8e2 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -125,7 +125,7 @@ let%expect_test _ = CDR ; DIP { DIP 7 { DUP } ; DIG 7 ; - SOURCE ; + SENDER ; PAIR ; SOME ; DIP { DIP { DUP } ; SWAP ; CAR ; CDR } } ; @@ -162,7 +162,7 @@ let%expect_test _ = IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CAR ; - SOURCE ; + SENDER ; SWAP ; COMPARE ; NEQ ; @@ -207,7 +207,7 @@ let%expect_test _ = CAR ; DIP { DIP 2 { DUP } ; DIG 2 ; CDR } ; MUL ; - SOURCE ; + SENDER ; CONTRACT unit ; IF_NONE { PUSH string "bad address for get_contract" ; FAILWITH } {} ; DIP { DUP } ; @@ -249,7 +249,7 @@ let%expect_test _ = IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CAR ; - SOURCE ; + SENDER ; SWAP ; COMPARE ; NEQ ; @@ -1008,7 +1008,7 @@ let%expect_test _ = DIP { DIP { DUP } ; SWAP ; CDR ; CAR ; CDR ; CDR } ; PAIR } ; PAIR ; - DIP { DIP { DUP } ; SWAP ; CDR ; CDR ; PUSH bool True ; SOURCE ; UPDATE } ; + DIP { DIP { DUP } ; SWAP ; CDR ; CDR ; PUSH bool True ; SENDER ; UPDATE } ; PAIR ; NIL operation ; PAIR ; diff --git a/src/test/coase_tests.ml b/src/test/coase_tests.ml index f335ec45b..be36603c7 100644 --- a/src/test/coase_tests.ml +++ b/src/test/coase_tests.ml @@ -90,11 +90,11 @@ let (first_owner , first_contract) = let kt = id.implicit_contract in Protocol.Alpha_context.Contract.to_b58check kt , kt -let second_owner = +let (second_owner , second_contract) = let open Proto_alpha_utils.Memory_proto_alpha in let id = List.nth dummy_environment.identities 1 in let kt = id.implicit_contract in - Protocol.Alpha_context.Contract.to_b58check kt + Protocol.Alpha_context.Contract.to_b58check kt , kt let basic a b cards next_id = let card_patterns = List.map card_pattern_ez [ @@ -127,13 +127,13 @@ let buy () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 10000000000 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in let%bind () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 0 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in trace_strong (simple_error "could buy without money") @@ Assert.assert_fail @@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in @@ -166,13 +166,13 @@ let dispatch_buy () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 10000000000 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in expect_eq_n_pos_small ~options program "main" make_input make_expected in let%bind () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 0 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in trace_strong (simple_error "could buy without money") @@ Assert.assert_fail @@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in @@ -204,8 +204,8 @@ let transfer () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let source = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in + let sender = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender () in expect_eq_n_strict_pos_small ~options program "transfer_single" make_input make_expected in ok () in @@ -234,8 +234,8 @@ let sell () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let source = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in + let sender = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender () in expect_n_strict_pos_small ~options program "sell_single" make_input make_expecter in ok () in diff --git a/src/test/contracts/coase.ligo b/src/test/contracts/coase.ligo index fd870b7a8..5f5b00644 100644 --- a/src/test/contracts/coase.ligo +++ b/src/test/contracts/coase.ligo @@ -48,7 +48,7 @@ function transfer_single (const action : action_transfer_single; const s : storage) : return is block { const cards : cards = s.cards; const card : card = get_force (action.card_to_transfer, cards); - if card.card_owner =/= source then + if card.card_owner =/= sender then failwith ("This card doesn't belong to you") else skip; card.card_owner := action.destination; @@ -61,7 +61,7 @@ function sell_single (const action : action_sell_single; const s : storage) : return is block { const card : card = get_force (action.card_to_sell, s.cards); - if card.card_owner =/= source + if card.card_owner =/= sender then failwith ("This card doesn't belong to you") else skip; const card_pattern : card_pattern = @@ -74,7 +74,7 @@ function sell_single (const action : action_sell_single; remove action.card_to_sell from map cards; s.cards := cards; const price : tez = card_pattern.coefficient * card_pattern.quantity; - const receiver : contract (unit) = get_contract (source); + const receiver : contract (unit) = get_contract (sender); const op : operation = transaction (unit, price, receiver); const operations : list (operation) = list [op] } with (operations, s) @@ -98,7 +98,7 @@ function buy_single (const action : action_buy_single; // Add card const cards : cards = s.cards; cards[s.next_id] := record [ - card_owner = source; + card_owner = sender; card_pattern = action.card_to_buy ]; s.cards := cards; diff --git a/src/test/contracts/get_contract.ligo b/src/test/contracts/get_contract.ligo index cb203c840..8ace2277d 100644 --- a/src/test/contracts/get_contract.ligo +++ b/src/test/contracts/get_contract.ligo @@ -3,7 +3,7 @@ type return is list (operation) * storage function cb (const s : storage) : return is block { - const c : contract (unit) = get_contract (source) + const c : contract(unit) = get_contract(sender) } with (list [transaction(unit, 0mutez, c)], s) @@ -11,7 +11,7 @@ function cb (const s : storage) : return is function cbo (const s : unit) : return is block { const c : contract (unit) = - case (get_contract_opt (source) : option (contract (unit))) of + case (get_contract_opt(sender) : option(contract(unit))) of Some (c) -> c | None -> (failwith ("contract not found") : contract (unit)) end diff --git a/src/test/contracts/vote.mligo b/src/test/contracts/vote.mligo index 414b72300..a32f54fa4 100644 --- a/src/test/contracts/vote.mligo +++ b/src/test/contracts/vote.mligo @@ -35,7 +35,7 @@ let init (init_params_s : init_action * storage) = let vote (ps : string * storage) = let now = Current.time in (* let _ = assert (now >= ps.1.beginning_time && ps.1.finish_time > now) in *) - let addr = Current.source in + let addr = Current.sender in (* let _ = assert (not Set.mem addr ps.1.voters) in *) let x = Map.find ps.0 ps.1.candidates in ( From 9a3c1789e1df11eef51bf1cc2dd3213a1969ad27 Mon Sep 17 00:00:00 2001 From: Maksym Bykovskyy Date: Mon, 24 Feb 2020 19:29:11 +0000 Subject: [PATCH 119/119] Improving syntax selection UI --- .../cameligo/arithmetic-contract.ligo | 2 +- .../pascaligo/arithmetic-contract.ligo | 2 +- .../reasonligo/arithmetic-contract.ligo | 2 +- tools/webide/packages/client/ligo_run.svg | 84 ------------ .../client/src/components/editable-title.tsx | 121 ++++++++++++++++++ .../packages/client/src/components/editor.tsx | 32 ++++- .../client/src/components/examples.tsx | 47 +++---- .../packages/client/src/components/header.tsx | 4 +- .../packages/client/src/components/inputs.tsx | 6 +- .../packages/client/src/components/monaco.tsx | 15 ++- .../packages/client/src/components/share.tsx | 6 +- .../client/src/components/syntax-select.tsx | 17 ++- .../client/src/components/tooltip.tsx | 31 +++-- tools/webide/packages/client/src/index.css | 4 +- .../packages/client/src/redux/editor.ts | 39 +++++- .../packages/client/src/redux/examples.ts | 25 +++- .../webide/packages/client/src/redux/share.ts | 9 +- .../webide/packages/client/src/setupProxy.js | 10 +- tools/webide/packages/e2e/test/share.spec.js | 2 +- .../packages/server/src/handlers/share.ts | 6 +- .../webide/packages/server/src/load-state.ts | 8 +- .../server/src/schemas/share-latest.ts | 4 +- .../packages/server/src/schemas/share-v2.ts | 96 ++++++++++++++ 23 files changed, 407 insertions(+), 165 deletions(-) delete mode 100644 tools/webide/packages/client/ligo_run.svg create mode 100644 tools/webide/packages/client/src/components/editable-title.tsx create mode 100644 tools/webide/packages/server/src/schemas/share-v2.ts diff --git a/tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo b/tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo index ac674c6ef..3bcd5660c 100644 --- a/tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo +++ b/tools/webide/packages/client/examples/cameligo/arithmetic-contract.ligo @@ -1,5 +1,5 @@ (*_* - name: Cameligo Contract + name: CameLIGO Contract language: cameligo compile: entrypoint: main diff --git a/tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo b/tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo index d533ba6e4..3eb38c48b 100644 --- a/tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo +++ b/tools/webide/packages/client/examples/pascaligo/arithmetic-contract.ligo @@ -1,5 +1,5 @@ (*_* - name: Pascaligo Contract + name: PascaLIGO Contract language: pascaligo compile: entrypoint: main diff --git a/tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo b/tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo index 646d9c3a7..ecb06a569 100644 --- a/tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo +++ b/tools/webide/packages/client/examples/reasonligo/arithmetic-contract.ligo @@ -1,5 +1,5 @@ (*_* - name: Reasonligo Contract + name: ReasonLIGO Contract language: reasonligo compile: entrypoint: main diff --git a/tools/webide/packages/client/ligo_run.svg b/tools/webide/packages/client/ligo_run.svg deleted file mode 100644 index 642bb327a..000000000 --- a/tools/webide/packages/client/ligo_run.svg +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/tools/webide/packages/client/src/components/editable-title.tsx b/tools/webide/packages/client/src/components/editable-title.tsx new file mode 100644 index 000000000..3f9472032 --- /dev/null +++ b/tools/webide/packages/client/src/components/editable-title.tsx @@ -0,0 +1,121 @@ +import { faPencilAlt } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import React, { useEffect, useRef, useState } from 'react'; +import styled, { css } from 'styled-components'; + +import { Tooltip } from './tooltip'; + +const Container = styled.div` + display: flex; + align-items: center; +`; + +const Input = styled.input<{ visible?: boolean }>` + position: absolute; + border-radius: var(--border_radius); + opacity: 0; + height: 2em; + width: 0; + border: none; + font-size: 1em; + + outline: none; + z-index: 1; + + ${props => + props.visible && + css` + padding-left: 0.5em; + opacity: 1; + width: 15em; + `} +`; + +const Label = styled.div<{ visible?: boolean }>` + color: var(--blue); + opacity: 0; + + ${props => + props.visible && + css` + opacity: 1; + `} +`; + +const PencilIcon = ({ ...props }) => ( + +); + +const Pencil = styled(PencilIcon)<{ visible: boolean }>` + margin-left: 10px; + cursor: pointer; + color: var(--label_foreground); + opacity: 0; + + :hover { + opacity: 1; + } + + ${props => + props.visible && + css` + opacity: 0.5; + `} +`; + +export const EditableTitleComponent = (props: { + id?: string; + title: string; + onChanged?: (value: string) => void; + className?: string; +}) => { + const [newTitle, setNewTitle] = useState(props.title); + const [showInput, setShowInput] = useState(false); + const inputEl = useRef(null); + + const notifyChanged = () => { + if (props.onChanged && props.title !== newTitle) { + props.onChanged(newTitle); + } + + setShowInput(false); + }; + + useEffect(() => { + setNewTitle(props.title); + }, [props.title]); + + return ( + + setNewTitle(event.target.value)} + onBlur={_ => notifyChanged()} + onKeyDown={event => { + if (event.key === 'Enter') { + notifyChanged(); + } else if (event.key === 'Escape') { + setNewTitle(props.title); + setShowInput(false); + } + }} + > + +
+ { + if (inputEl.current) { + inputEl.current.select(); + inputEl.current.setSelectionRange(0, 99999); + setShowInput(true); + } + }} + > + Rename +
+
+ ); +}; diff --git a/tools/webide/packages/client/src/components/editor.tsx b/tools/webide/packages/client/src/components/editor.tsx index dd3624a73..3d2843126 100644 --- a/tools/webide/packages/client/src/components/editor.tsx +++ b/tools/webide/packages/client/src/components/editor.tsx @@ -1,6 +1,10 @@ import React from 'react'; +import { useDispatch, useSelector } from 'react-redux'; import styled from 'styled-components'; +import { AppState } from '../redux/app'; +import { ChangeTitleAction } from '../redux/editor'; +import { EditableTitleComponent } from './editable-title'; import { MonacoComponent } from './monaco'; import { ShareComponent } from './share'; import { SyntaxSelectComponent } from './syntax-select'; @@ -12,20 +16,44 @@ const Container = styled.div` const Header = styled.div` flex: 1; display: flex; - justify-content: space-between; + justify-content: flex-start; align-items: center; min-height: 2.5em; border-bottom: 5px solid var(--blue_trans1); `; +const Subheader = styled.div` + flex: 1; + display: flex; + justify-content: space-between; + align-items: center; + + background: var(--blue_trans1); + border: 5px solid rgba(0, 0, 0, 0); + border-top: none; + padding: 0 10px; +`; + export const EditorComponent = () => { + const dispatch = useDispatch(); + const title = useSelector(state => state.editor.title); + return (
-
+ + { + dispatch({ ...new ChangeTitleAction(value) }); + }} + > + +
); diff --git a/tools/webide/packages/client/src/components/examples.tsx b/tools/webide/packages/client/src/components/examples.tsx index 59c193b54..fec8c13c6 100644 --- a/tools/webide/packages/client/src/components/examples.tsx +++ b/tools/webide/packages/client/src/components/examples.tsx @@ -3,12 +3,13 @@ import { useDispatch, useSelector } from 'react-redux'; import styled from 'styled-components'; import { AppState } from '../redux/app'; +import { ChangeDirtyAction, EditorState } from '../redux/editor'; import { ChangeSelectedAction, ExamplesState } from '../redux/examples'; import { getExample } from '../services/api'; const bgColor = 'transparent'; const borderSize = '5px'; -const verticalPadding = '0.8em'; +const verticalPadding = '0.6em'; const Container = styled.div` flex: 0.5; @@ -16,7 +17,7 @@ const Container = styled.div` flex-direction: column; `; -const MenuItem = styled.div<{ selected: boolean }>` +const MenuItem = styled.div<{ selected?: boolean }>` padding: ${verticalPadding} 0 ${verticalPadding} 1em; height: 1.5em; display: flex; @@ -27,25 +28,12 @@ const MenuItem = styled.div<{ selected: boolean }>` border-left: ${`${borderSize} solid ${bgColor}`}; border-left-color: ${props => (props.selected ? 'var(--blue)' : bgColor)}; - :first-child { - margin-top: ${props => (props.selected ? '0' : `-${borderSize}`)}; - } - :hover { background-color: ${props => props.selected ? 'var(--blue_trans1)' : 'var(--blue_trans2)'}; border-left: ${`${borderSize} solid ${bgColor}`}; border-left-color: ${props => props.selected ? 'var(--blue)' : 'transparent'}; - :first-child { - margin-top: ${props => (props.selected ? '0' : `-${borderSize}`)}; - padding-top: ${props => - props.selected - ? `${verticalPadding}` - : `calc(${verticalPadding} - ${borderSize})`}; - border-top: ${props => - props.selected ? '' : `${borderSize} solid var(--blue_opaque1)`}; - } } `; @@ -57,44 +45,45 @@ const MenuContainer = styled.div` box-sizing: border-box; `; -const Header = styled.div<{ firstChildSelected: boolean }>` - border-bottom: ${props => - props.firstChildSelected ? '' : '5px solid var(--blue_trans1)'}; +const Header = styled.div` min-height: 2.5em; padding: 0 10px; display: flex; align-items: center; + font-weight: 600; `; export const Examples = () => { const examples = useSelector( (state: AppState) => state.examples.list ); - const selectedExample = useSelector( - (state: AppState) => state.examples.selected + const editorDirty = useSelector( + (state: AppState) => state.editor.dirty ); + const dispatch = useDispatch(); return ( -
- Examples -
+
Examples
{examples.map(example => { return ( { const response = await getExample(example.id); - dispatch({ ...new ChangeSelectedAction(response) }); + if ( + !editorDirty || + window.confirm( + 'Are you sure you want to navigate away? Data you have entered will be lost.\n\nPress OK to continue or Cancel to stay on the current page.\n\n' + ) + ) { + dispatch({ ...new ChangeSelectedAction(response) }); + dispatch({ ...new ChangeDirtyAction(false) }); + } }} > {example.name} diff --git a/tools/webide/packages/client/src/components/header.tsx b/tools/webide/packages/client/src/components/header.tsx index 0298fe0dd..b4eb4bc45 100644 --- a/tools/webide/packages/client/src/components/header.tsx +++ b/tools/webide/packages/client/src/components/header.tsx @@ -6,9 +6,9 @@ const Container = styled.div` justify-content: space-between; align-items: center; - padding: 0.5em 1em; + padding: 0.2em 1em; font-family: 'DM Sans', 'Open Sans', sans-serif; - box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.3); + box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.3); `; const Group = styled.div` diff --git a/tools/webide/packages/client/src/components/inputs.tsx b/tools/webide/packages/client/src/components/inputs.tsx index cd68c6d8d..22eabca0a 100644 --- a/tools/webide/packages/client/src/components/inputs.tsx +++ b/tools/webide/packages/client/src/components/inputs.tsx @@ -12,12 +12,12 @@ export const HGroup = styled.div` export const Label = styled.label` font-size: 1em; - color: rgba(153, 153, 153, 1); + color: var(--label_foreground); `; export const Input = styled.input` margin: 0.3em 0 0.7em 0; - background-color: #eff7ff; + background-color: var(--input_background); border-style: none; border-bottom: 5px solid #e1f1ff; padding: 0.5em; @@ -33,7 +33,7 @@ export const Input = styled.input` export const Textarea = styled.textarea` resize: vertical; margin: 0.3em 0 0.7em 0; - background-color: #eff7ff; + background-color: var(--input_background); border-style: none; border-bottom: 5px solid #e1f1ff; padding: 0.5em; diff --git a/tools/webide/packages/client/src/components/monaco.tsx b/tools/webide/packages/client/src/components/monaco.tsx index 8aef9ad33..7007cc832 100644 --- a/tools/webide/packages/client/src/components/monaco.tsx +++ b/tools/webide/packages/client/src/components/monaco.tsx @@ -4,7 +4,8 @@ import { useDispatch, useStore } from 'react-redux'; import styled from 'styled-components'; import { AppState } from '../redux/app'; -import { ChangeCodeAction } from '../redux/editor'; +import { ChangeCodeAction, ChangeDirtyAction } from '../redux/editor'; +import { ClearSelectedAction } from '../redux/examples'; const Container = styled.div` height: var(--content_height); @@ -53,8 +54,14 @@ export const MonacoComponent = () => { } }); + let shouldDispatchCodeChangedAction = true; + const { dispose } = editor.onDidChangeModelContent(() => { - dispatch({ ...new ChangeCodeAction(editor.getValue()) }); + if (shouldDispatchCodeChangedAction) { + dispatch({ ...new ChangeCodeAction(editor.getValue()) }); + dispatch({ ...new ChangeDirtyAction(true) }); + dispatch({ ...new ClearSelectedAction() }); + } }); cleanupFunc.push(dispose); @@ -64,11 +71,13 @@ export const MonacoComponent = () => { const { editor: editorState }: AppState = store.getState(); if (editorState.code !== editor.getValue()) { + shouldDispatchCodeChangedAction = false; editor.setValue(editorState.code); + shouldDispatchCodeChangedAction = true; } if (editorState.language !== model.getModeId()) { - if (editorState.language === 'reasonligo') { + if (editorState.language === 'reasonligo') { monaco.editor.setModelLanguage(model, 'javascript'); } else { monaco.editor.setModelLanguage(model, editorState.language); diff --git a/tools/webide/packages/client/src/components/share.tsx b/tools/webide/packages/client/src/components/share.tsx index bb81591eb..06974784c 100644 --- a/tools/webide/packages/client/src/components/share.tsx +++ b/tools/webide/packages/client/src/components/share.tsx @@ -12,7 +12,7 @@ import { Tooltip } from './tooltip'; const Container = styled.div` display: flex; - justify-content: flex-end; + justify-content: flex-start; align-items: center; `; @@ -81,9 +81,9 @@ const Input = styled.input<{ visible?: boolean }>` opacity: 0; height: 2em; width: 2em; - transform: translateX(-0.3em); + transform: translateX(0.3em); border: none; - padding: 0 1em; + padding-left: 2em; font-size: 1em; color: white; diff --git a/tools/webide/packages/client/src/components/syntax-select.tsx b/tools/webide/packages/client/src/components/syntax-select.tsx index e24ec4a70..d3fd4f794 100644 --- a/tools/webide/packages/client/src/components/syntax-select.tsx +++ b/tools/webide/packages/client/src/components/syntax-select.tsx @@ -8,6 +8,7 @@ import styled, { css } from 'styled-components'; import { AppState } from '../redux/app'; import { ChangeLanguageAction, EditorState } from '../redux/editor'; import { Language } from '../redux/types'; +import { Tooltip } from './tooltip'; const Container = styled.div` display: flex; @@ -22,14 +23,19 @@ const Header = styled.div` flex: 1; display: flex; - align-items: center; - justify-content: space-between; height: 2em; padding: 0 0.5em; border: 1px solid var(--blue_trans1); `; +const Label = styled.div` + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; +`; + const ArrowIcon = ({ rotate, ...props }: { rotate: boolean }) => ( ); @@ -140,8 +146,11 @@ export const SyntaxSelectComponent = () => {
open(true)}> - {OPTIONS[language]} - + + Select syntax
); diff --git a/tools/webide/packages/client/src/components/tooltip.tsx b/tools/webide/packages/client/src/components/tooltip.tsx index 6bbef8e27..6aad6036d 100644 --- a/tools/webide/packages/client/src/components/tooltip.tsx +++ b/tools/webide/packages/client/src/components/tooltip.tsx @@ -1,4 +1,4 @@ -import React, { createElement, useEffect, useRef, useState } from 'react'; +import React, { createElement, useCallback, useEffect, useRef, useState } from 'react'; import { render } from 'react-dom'; import styled from 'styled-components'; @@ -64,19 +64,22 @@ export const Tooltip = (props: { position?: Position; children: any }) => { const ref = useRef(null); const [isTooltipVisible, setTooltipVisible] = useState(false); - const renderTooltip = (visible: boolean, triggerRect: ClientRect) => { - const tooltip = createElement( - StyledTooltip, - { - visible, - x: calcX(triggerRect, props.position), - y: calcY(triggerRect, props.position) - }, - props.children - ); + const renderTooltip = useCallback( + (visible: boolean, triggerRect: ClientRect) => { + const tooltip = createElement( + StyledTooltip, + { + visible, + x: calcX(triggerRect, props.position), + y: calcY(triggerRect, props.position) + }, + props.children + ); - render(tooltip, document.getElementById(TOOLTIP_CONTAINER_ID)); - }; + render(tooltip, document.getElementById(TOOLTIP_CONTAINER_ID)); + }, + [props.position, props.children] + ); useEffect(() => { if (ref.current) { @@ -98,7 +101,7 @@ export const Tooltip = (props: { position?: Position; children: any }) => { }; } } - }); + }, [isTooltipVisible, renderTooltip]); return
; }; diff --git a/tools/webide/packages/client/src/index.css b/tools/webide/packages/client/src/index.css index aaa5a1f7b..6f15a1d73 100644 --- a/tools/webide/packages/client/src/index.css +++ b/tools/webide/packages/client/src/index.css @@ -10,6 +10,8 @@ --blue_opaque1: #dbeaff; --blue_trans2: rgba(14, 116, 255, 0.08); /* #eff7ff; */ + --input_background: #eff7ff; + --grey: #888; --box-shadow: 1px 3px 10px 0px rgba(153, 153, 153, 0.4); /* or #999999 */ @@ -46,7 +48,7 @@ --font_ghost_weight: 700; --font_ghost_color: rgba(153, 153, 153, 0.5); /* or #CFCFCF */ - --content_height: 85vh; + --content_height: 80vh; --tooltip_foreground: white; --tooltip_background: rgba(0, 0, 0, 0.75) /*#404040*/; diff --git a/tools/webide/packages/client/src/redux/editor.ts b/tools/webide/packages/client/src/redux/editor.ts index f1582dd01..462c07bb8 100644 --- a/tools/webide/packages/client/src/redux/editor.ts +++ b/tools/webide/packages/client/src/redux/editor.ts @@ -3,12 +3,16 @@ import { Language } from './types'; export enum ActionType { ChangeLanguage = 'editor-change-language', - ChangeCode = 'editor-change-code' + ChangeCode = 'editor-change-code', + ChangeDirty = 'editor-change-dirty', + ChangeTitle = 'editor-change-title' } export interface EditorState { language: Language; code: string; + title: string; + dirty: boolean; } export class ChangeLanguageAction { @@ -21,14 +25,28 @@ export class ChangeCodeAction { constructor(public payload: EditorState['code']) {} } +export class ChangeDirtyAction { + public readonly type = ActionType.ChangeDirty; + constructor(public payload: EditorState['dirty']) {} +} + +export class ChangeTitleAction { + public readonly type = ActionType.ChangeTitle; + constructor(public payload: EditorState['title']) {} +} + type Action = | ChangeCodeAction | ChangeLanguageAction + | ChangeDirtyAction + | ChangeTitleAction | ChangeSelectedExampleAction; const DEFAULT_STATE: EditorState = { language: Language.CameLigo, - code: '' + code: '', + title: '', + dirty: false }; export default (state = DEFAULT_STATE, action: Action): EditorState => { @@ -36,7 +54,9 @@ export default (state = DEFAULT_STATE, action: Action): EditorState => { case ExamplesActionType.ChangeSelected: return { ...state, - ...(!action.payload ? DEFAULT_STATE : action.payload.editor) + ...(!action.payload + ? DEFAULT_STATE + : { ...action.payload.editor, title: action.payload.name }) }; case ActionType.ChangeLanguage: return { @@ -48,6 +68,17 @@ export default (state = DEFAULT_STATE, action: Action): EditorState => { ...state, code: action.payload }; + case ActionType.ChangeDirty: + return { + ...state, + dirty: action.payload + }; + case ActionType.ChangeTitle: + return { + ...state, + title: action.payload + }; + default: + return state; } - return state; }; diff --git a/tools/webide/packages/client/src/redux/examples.ts b/tools/webide/packages/client/src/redux/examples.ts index 98bc0a481..7e631cbc9 100644 --- a/tools/webide/packages/client/src/redux/examples.ts +++ b/tools/webide/packages/client/src/redux/examples.ts @@ -1,7 +1,8 @@ import { ExampleState } from './example'; export enum ActionType { - ChangeSelected = 'examples-change-selected' + ChangeSelected = 'examples-change-selected', + ClearSelected = 'examples-clear-selected' } export interface ExampleItem { @@ -19,13 +20,25 @@ export class ChangeSelectedAction { constructor(public payload: ExamplesState['selected']) {} } -type Action = ChangeSelectedAction; +export class ClearSelectedAction { + public readonly type = ActionType.ClearSelected; +} + +type Action = ChangeSelectedAction | ClearSelectedAction; export const DEFAULT_STATE: ExamplesState = { selected: null, list: [] }; +if (process.env.NODE_ENV === 'development') { + DEFAULT_STATE.list = [ + { id: 'MzkMQ1oiVHJqbcfUuVFKTw', name: 'CameLIGO Contract' }, + { id: 'FEb62HL7onjg1424eUsGSg', name: 'PascaLIGO Contract' }, + { id: 'JPhSOehj_2MFwRIlml0ymQ', name: 'ReasonLIGO Contract' } + ]; +} + export default (state = DEFAULT_STATE, action: Action): ExamplesState => { switch (action.type) { case ActionType.ChangeSelected: @@ -33,6 +46,12 @@ export default (state = DEFAULT_STATE, action: Action): ExamplesState => { ...state, selected: action.payload }; + case ActionType.ClearSelected: + return { + ...state, + selected: null + }; + default: + return state; } - return state; }; diff --git a/tools/webide/packages/client/src/redux/share.ts b/tools/webide/packages/client/src/redux/share.ts index 5c807e48c..78a7b11ad 100644 --- a/tools/webide/packages/client/src/redux/share.ts +++ b/tools/webide/packages/client/src/redux/share.ts @@ -15,7 +15,7 @@ import { ChangeParametersAction as ChangeDryRunParametersAction, ChangeStorageAction as ChangeDryRunStorageAction, } from './dry-run'; -import { ActionType as EditorActionType, ChangeCodeAction, ChangeLanguageAction } from './editor'; +import { ActionType as EditorActionType, ChangeCodeAction, ChangeLanguageAction, ChangeTitleAction } from './editor'; import { ActionType as EvaluateFunctionActionType, ChangeEntrypointAction as ChangeEvaluateFunctionEntrypointAction, @@ -25,6 +25,7 @@ import { ActionType as EvaluateValueActionType, ChangeEntrypointAction as ChangeEvaluateValueEntrypointAction, } from './evaluate-value'; +import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples'; export enum ActionType { ChangeShareLink = 'share-change-link' @@ -41,6 +42,7 @@ export class ChangeShareLinkAction { type Action = | ChangeShareLinkAction + | ChangeTitleAction | ChangeCodeAction | ChangeLanguageAction | ChangeCompileEntrypointAction @@ -53,7 +55,8 @@ type Action = | ChangeDryRunStorageAction | ChangeEvaluateFunctionEntrypointAction | ChangeEvaluateFunctionParametersAction - | ChangeEvaluateValueEntrypointAction; + | ChangeEvaluateValueEntrypointAction + | ChangeSelectedExampleAction; const DEFAULT_STATE: ShareState = { link: '' @@ -61,6 +64,8 @@ const DEFAULT_STATE: ShareState = { export default (state = DEFAULT_STATE, action: Action): ShareState => { switch (action.type) { + case EditorActionType.ChangeTitle: + case ExamplesActionType.ChangeSelected: case EditorActionType.ChangeCode: case EditorActionType.ChangeLanguage: case CompileActionType.ChangeEntrypoint: diff --git a/tools/webide/packages/client/src/setupProxy.js b/tools/webide/packages/client/src/setupProxy.js index b50059100..2e5650b40 100644 --- a/tools/webide/packages/client/src/setupProxy.js +++ b/tools/webide/packages/client/src/setupProxy.js @@ -1,6 +1,6 @@ const proxy = require('http-proxy-middleware'); -module.exports = function(app) { +module.exports = function (app) { app.use( '/api', proxy({ @@ -8,4 +8,12 @@ module.exports = function(app) { changeOrigin: true }) ); + + app.use( + '/static/examples', + proxy({ + target: 'http://localhost:8080', + changeOrigin: true + }) + ); }; diff --git a/tools/webide/packages/e2e/test/share.spec.js b/tools/webide/packages/e2e/test/share.spec.js index 40b84fd11..dd73d64db 100644 --- a/tools/webide/packages/e2e/test/share.spec.js +++ b/tools/webide/packages/e2e/test/share.spec.js @@ -24,7 +24,7 @@ describe('Share', () => { await responseCallback; const actualShareLink = await page.evaluate(getInputValue, 'share-link'); - const expectedShareLink = `${API_HOST}/p/sIpy-2D9ExpCojwuBNw_-g`; + const expectedShareLink = `${API_HOST}/p/WxKPBq9-mkZ_kq4cMHXfCQ`; expect(actualShareLink).toEqual(expectedShareLink); done(); diff --git a/tools/webide/packages/server/src/handlers/share.ts b/tools/webide/packages/server/src/handlers/share.ts index 722e9d9c6..18bc13627 100644 --- a/tools/webide/packages/server/src/handlers/share.ts +++ b/tools/webide/packages/server/src/handlers/share.ts @@ -10,6 +10,8 @@ interface ShareBody { editor: { language: string; code: string; + dirty: boolean; + title: string; }; compile: { entrypoint: string; @@ -39,7 +41,9 @@ const validateRequest = (body: any): { value: ShareBody; error: any } => { editor: joi .object({ language: joi.string().required(), - code: joi.string().required() + code: joi.string().required(), + dirty: joi.boolean().optional(), + title: joi.string().allow('') }) .required(), compile: joi.object({ diff --git a/tools/webide/packages/server/src/load-state.ts b/tools/webide/packages/server/src/load-state.ts index 2b71128d1..bb62e5a65 100644 --- a/tools/webide/packages/server/src/load-state.ts +++ b/tools/webide/packages/server/src/load-state.ts @@ -24,7 +24,9 @@ export async function loadDefaultState(appBundleDirectory: string) { deploy: {}, evaluateValue: {}, evaluateFunction: {}, - editor: {}, + editor: { + title: '' + }, examples: { selected: null, list: examplesList @@ -59,9 +61,9 @@ export async function loadDefaultState(appBundleDirectory: string) { }; defaultState.editor = { ...defaultState.editor, - ...defaultExample.editor + ...defaultExample.editor, + title: defaultExample.name }; - defaultState.examples.selected = defaultExample; } return defaultState; diff --git a/tools/webide/packages/server/src/schemas/share-latest.ts b/tools/webide/packages/server/src/schemas/share-latest.ts index 9125b413a..02caeddb0 100644 --- a/tools/webide/packages/server/src/schemas/share-latest.ts +++ b/tools/webide/packages/server/src/schemas/share-latest.ts @@ -1,3 +1,3 @@ -import { SchemaMigrationV1 } from './share-v1'; +import { SchemaMigrationV2 } from './share-v2'; -export default new SchemaMigrationV1(); +export default new SchemaMigrationV2(); diff --git a/tools/webide/packages/server/src/schemas/share-v2.ts b/tools/webide/packages/server/src/schemas/share-v2.ts new file mode 100644 index 000000000..1ebeacc64 --- /dev/null +++ b/tools/webide/packages/server/src/schemas/share-v2.ts @@ -0,0 +1,96 @@ +import joi from '@hapi/joi'; + +import { Migration } from './migration'; +import { SchemaMigrationV1, SchemaV1 } from './share-v1'; + +export type Version = 'v2'; + +export interface SchemaV2 { + version: Version; + state: { + editor: { + language: string; + code: string; + dirty: boolean; + title: string; + }; + compile: { + entrypoint: string; + }; + dryRun: { + entrypoint: string; + parameters: string; + storage: string; + }; + deploy: { + entrypoint: string; + storage: string; + useTezBridge?: boolean; + }; + evaluateValue: { + entrypoint: string; + }; + evaluateFunction: { + entrypoint: string; + parameters: string; + }; + }; +} + +export class SchemaMigrationV2 extends Migration { + readonly VERSION: Version = 'v2'; + + protected readonly schema = joi.object({ + version: joi + .string() + .required() + .allow(this.VERSION), + state: joi.object({ + editor: joi + .object({ + language: joi.string().required(), + code: joi.string().required(), + dirty: joi.boolean().optional(), + title: joi.string().allow('') + }) + .required(), + compile: joi.object({ + entrypoint: joi.string().allow('') + }), + dryRun: joi.object({ + entrypoint: joi.string().allow(''), + parameters: joi.any().allow(''), + storage: joi.any().allow('') + }), + deploy: joi.object({ + entrypoint: joi.string().allow(''), + storage: joi.any().allow(''), + useTezBridge: joi.boolean().optional() + }), + evaluateValue: joi.object({ + entrypoint: joi.string().allow('') + }), + evaluateFunction: joi.object({ + entrypoint: joi.string().allow(''), + parameters: joi.any().allow('') + }) + }) + }); + + protected readonly previous = new SchemaMigrationV1(); + + protected migrate(data: SchemaV1): SchemaV2 { + return { + ...data, + version: this.VERSION, + state: { + ...data.state, + editor: { + ...data.state.editor, + dirty: false, + title: '' + } + } + }; + } +}