Commit Graph

64 Commits

Author SHA1 Message Date
emizzle 095bd0b971 feat(@embark/quorum): Add support for Quorum blockchains
Add support for *connecting to* Quorum blockchains. This plugin will not start a Quorum node or nodes automatically as Embark does with other chains.

This plugins supports deploying contracts publically and privately using the Tessera private transaction manager.

This plugin supports sending of public and private transactions using the Tessera private transaction manager.

Add ability to skip bytecode checking as part of the contract deployment process. Instruct the deployer to skip checking if the contract bytecode exists on-chain before deploying the contract. This is important in the case of having many private nodes in a network because if a contract is deployed privately to node 1 and 7, running Embark on node 2 should skip the bytecode check as the contract *is not* deployed on node 2, nor do we want it deployed on node 2. If the bytecode check was in place, Embark would have deployed it to node 2 and therefore not adhered to the privacy needs.

Add Ethereum contract deployer for Quorum, allowing for deploying of public and private contracts using `privateFor` and `privateFrom` (see Contract config updates below).

Add web3 extensions enabling specific functionality for Quorum. Extensions includes those provided by [`quorum-js`](https://github.com/jpmorganchase/quorum.js), as well as some custom monkeypatches that override web3 method output formatting, including:
 - web3.eth.getBlock
 - web3.eth.getTransaction
 - web3.eth.getTransactionReceipt
 - web3.eth.decodeParameters
DApps wishing to take advantage of these overrides will need to patch web3 as follows:
```
import {patchWeb3} from "embark-quorum";
import Web3 from "web3";

let web3 = new Web3(...);
web3 = patchWeb3(web3);
```

Add support for sending a raw private transaction in the Quorum network. This includes running actions from the proxy after an `eth_sendTransaction` RPC request has been transformed in to `eth_sendRawTransaction` after being signed.

fix(@embark/transaction-logger): Fix bug when sending a 0-value transaction.

Add `originalRequest` to the proxy when modifying `eth_sendTransaction` to `eth_sendRawTransaction`, so that the original transaction parameters (including `privateFor` and `privateFrom`) can be used to sign a raw private transaction in the `eth_sendRawTransaction` action.

Added the following properties on to blockchain config:
 - *`client`* `{boolean}` - Allows `quorum` to be specified as the blockchain client
 - *`clientConfig/tesseraPrivateUrl`* `{string}` - URL of the Tessera private transaction manager
```
client: "quorum",
clientConfig: {
  tesseraPrivateUrl: "http://localhost:9081" // URL of the Tessera private transaction manager
}
```
Added the following properties to the contracts config:
 - *`skipBytecodeCheck`* `{boolean}` - Instructs the deployer to skip checking if the bytecode of the contract exists on the chain before deploying the contract. This is important in the case of having many private nodes in a network because if a contract is deployed privately to node 1 and 7, running Embark on node 2 should skip the bytecode check as the contract *is not* deployed on node 2, nor do we want it deployed on node 2. If the bytecode check was in place, Embark would have deployed it to node 2 and therefore not adhered to the privacy needs.
  - *`privateFor`* `{string[]}` - When sending a private transaction, an array of the recipient nodes' base64-encoded public keys.
  - *`privateFrom`* `{string}` - When sending a private transaction, the sending party's base64-encoded public key to use
```
environment: {
  deploy: {
    SimpleStorage: {
      skipBytecodeCheck: true,
      privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc"],
      privateFrom: "BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo="
    }
  }
},
```

 - *`proxy:endpoint:http:get`* - get the HTTP endpoint of the proxy regardless of blockchain settings
 - *`proxy:endpoint:ws:get`* - get the WS endpoint of the proxy regardless of blockchain settings

 - *`runcode:register:<variable>`* - when variables are registered in the console using `runcode:register`, actions with the name of the variable (ie `runcode:register:web3`) will be run *before* the variable is actually registered in the console. This allows a variable to be modified by plugins before being registered in the console.
2020-03-23 20:19:04 +01:00
EmbarkBot 7f52634331 chore(prerelease): 5.3.0-nightly.12 2020-03-21 00:15:48 +00:00
EmbarkBot d5e0897231 chore(prerelease): 5.3.0-nightly.11 2020-03-20 00:17:02 +00:00
EmbarkBot 444b9eae87 chore(prerelease): 5.3.0-nightly.10 2020-03-14 00:16:39 +00:00
EmbarkBot db8282c52c chore(prerelease): 5.3.0-nightly.9 2020-03-13 00:16:27 +00:00
EmbarkBot 34f4b0cf1a chore(prerelease): 5.3.0-nightly.7 2020-03-10 00:18:09 +00:00
EmbarkBot 7287eda651 chore(prerelease): 5.3.0-nightly.6 2020-03-07 00:14:47 +00:00
dependabot-preview[bot] afa1d14fa0 build(deps): bump async from 2.6.1 to 3.2.0
Bumps [async](https://github.com/caolan/async) from 2.6.1 to 3.2.0.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/master/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v2.6.1...v3.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-06 12:51:09 -06:00
EmbarkBot b19a58b007 chore(prerelease): 5.3.0-nightly.5 2020-03-06 00:15:50 +00:00
dependabot-preview[bot] dcaa2626d9 build(deps-dev): bump eslint-plugin-jest from 22.5.1 to 23.8.1
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 22.5.1 to 23.8.1.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v22.5.1...v23.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-05 11:25:18 -06:00
EmbarkBot 838d421eac chore(prerelease): 5.3.0-nightly.4 2020-03-05 00:15:25 +00:00
dependabot-preview[bot] cb8ece8db5 build(deps): bump @babel/runtime-corejs3 from 7.7.4 to 7.8.4
Bumps [@babel/runtime-corejs3](https://github.com/babel/babel) from 7.7.4 to 7.8.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.7.4...v7.8.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-04 12:05:18 -06:00
EmbarkBot a7b8f0d141 chore(prerelease): 5.3.0-nightly.3 2020-03-04 00:15:48 +00:00
Pascal Precht a4a0e9dc33 feat(plugins/specialconfigs): adds support for Smart Contract args as functions
This commit introduces a new feature that enables users to calculate Smart Contract
constructor arguments lazily using an (async) function. Similar to normal Smart Contract
configurations, the return or resolved value from that function has to be either a list
of arguments in the order as they are needed for the constructor, or as an object with
named members that match the arguments individually.

```
...
development: {
  deploy: {
    SimpleStorage: {
      args: async ({ contracts, web3, logger}) => {
        // do something with `contracts` and `web3` to determine
        // arguments
        let someValue = await ...;
        return [someValue];

        // or
        return {
          initialValue: someValue
        };
      }
    }
  }
}
...
```

Closes #2270
2020-03-03 10:14:58 +01:00
EmbarkBot 8de6cf9fe0 chore(prerelease): 5.3.0-nightly.2 2020-03-03 00:14:47 +00:00
dependabot-preview[bot] ead92bd90f build(deps): bump @babel/core from 7.7.4 to 7.8.6
Bumps [@babel/core](https://github.com/babel/babel) from 7.7.4 to 7.8.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.7.4...v7.8.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 14:42:32 -06:00
EmbarkBot 719faeebdd chore(prerelease): 5.3.0-nightly.1 2020-02-29 00:14:15 +00:00
EmbarkBot 1675019f44 chore(prerelease): 5.3.0-nightly.0 2020-02-27 00:13:54 +00:00
EmbarkBot c54cc77e01 chore(prerelease): 5.2.4-nightly.0 2020-02-26 00:14:00 +00:00
Michael Bradley, Jr 8e945a2caa chore(release): 5.2.3 2020-02-25 15:09:29 -06:00
Michael Bradley, Jr 3693ebd90d fix: ensure that packages properly specify their dependencies
Many packages in the monorepo did not specify all of their dependencies; they
were effectively relying on resolution in the monorepo's root
`node_modules`. In a production release of `embark` and `embark[js]-*` packages
this can lead to broken packages.

To fix the problem currently and to help prevent it from happening again, make
use of the `eslint-plugin-import` package's `import/no-extraneous-dependencies`
and `import/no-unresolved` rules. In the root `tslint.json` set
`"no-implicit-dependencies": true`, wich is the tslint equivalent of
`import/no-extraneous-dependencies`; there is no tslint equivalent for
`import/no-unresolved`, but we will eventually replace tslint with an eslint
configuration that checks both `.js` and `.ts` files.

For `import/no-unresolved` to work in our monorepo setup, in most packages add
an `index.js` that has:

```js
module.exports = require('./dist'); // or './dist/lib' in some cases
```

And point `"main"` in `package.json` to `"./index.js"`. Despite what's
indicated in npm's documentation for `package.json`, it's also necessary to add
`"index.js"` to the `"files"` array.

Make sure that all `.js` files that can and should be linted are in fact
linted. For example, files in `packages/embark/src/cmd/` weren't being linted
and many test suites weren't being linted.

Bump all relevant packages to `eslint@6.8.0`.

Fix all linter errors that arose after these changes.

Implement a `check-yarn-lock` script that's run as part of `"ci:full"` and
`"qa:full"`, and can manually be invoked via `yarn cylock` in the root of the
monorepo. The script exits with error if any specifiers are found in
`yarn.lock` for `embark[js][-*]` and/or `@embarklabs/*` (with a few exceptions,
cf. `scripts/check-yarn-lock.js`).
2020-02-25 14:52:10 -06:00
Michael Bradley, Jr f5db3f61b6 chore(release): 5.2.0 2020-02-18 11:45:33 -06:00
EmbarkBot 414de52203 chore(prerelease): 5.2.0-nightly.3 2020-02-14 00:14:39 +00:00
EmbarkBot e29a93bde5 chore(prerelease): 5.2.0-nightly.1 2020-02-08 00:12:06 +00:00
EmbarkBot a016fa8fb9 chore(prerelease): 5.2.0-nightly.0 2020-02-07 00:12:17 +00:00
Pascal Precht 3e3b4287a4 chore(stack/deployment): update dependencies 2020-02-06 13:19:10 -05:00
EmbarkBot d4136ffa8a chore(prerelease): 5.1.2-nightly.0 2020-02-05 00:12:23 +00:00
Michael Bradley, Jr 110957f273 chore(release): 5.1.1 2020-02-03 13:59:08 -06:00
EmbarkBot a9807b77f5 chore(prerelease): 5.1.1-nightly.2 2020-01-31 00:12:28 +00:00
EmbarkBot 03ca790ffd chore(prerelease): 5.1.1-nightly.0 2020-01-29 00:12:23 +00:00
Iuri Matias d328b9953a chore: update site urls 2020-01-28 12:07:17 -05:00
Michael Bradley, Jr 0d1da2971c chore(release): 5.1.0 2020-01-27 12:33:50 -06:00
EmbarkBot 84448f8732 chore(prerelease): 5.1.0-nightly.5 2020-01-24 00:10:58 +00:00
EmbarkBot e8b5c7ab89 chore(prerelease): 5.1.0-nightly.4 2020-01-23 00:13:38 +00:00
EmbarkBot c98e769d0d chore(prerelease): 5.1.0-nightly.1 2020-01-20 09:57:35 -06:00
Michael Bradley, Jr c093cf88ea feat: support Node.js v12.x and newer
Remove the `<12.0.0` restriction re: Node.js version in the `"engines"`
settings for all the packages in the monorepo that had that restriction.

Add missing `"engines"` settings in `packages/plugins/snark/package.json`.

Adjust the Azure Pipelines config to include builds for Node.js v12.x and
v13.x.

Bump `solc` to `0.4.26` in `dapps/tests/app` and `dapps/tests/contracts`. It
was discovered that older versions suffered a fatal `Maximum call stack size
exceeded` error when run on Windows with Node.js v12.x or newer. Display a
warning re: the bad combo (solc version + Windows + Node version) if it's
detected at runtime.

Adjust the root `yarn.lock` so that the `sha3` transitive dependency resolves
to a newer version that is compatible with Node v13.x.
2020-01-20 08:28:24 -06:00
EmbarkBot 4d44e29b3c chore(prerelease): 5.1.0-nightly.0 2020-01-17 00:15:31 +00:00
Iuri Matias 9aeddaa998 chore: rename org references from embark-framework to embarklabs 2020-01-16 15:36:29 -05:00
Michael Bradley, Jr ba0d6d17f3 chore(release): 5.0.0 2020-01-07 12:14:37 -06:00
Iuri Matias 472efbbf6e chore(release): 5.0.0-alpha.9 2019-12-20 18:13:47 -05:00
Iuri Matias 4091296924 chore(release): 5.0.0-alpha.8 2019-12-19 14:14:23 -05:00
Iuri Matias 78a06c9d76 chore(release): 5.0.0-alpha.5 2019-12-16 13:49:41 -05:00
Michael Bradley, Jr ee56f37713 build: implement collective typecheck
This PR replaces #2057.

Implement a collective typecheck action that can be invoked in the root of the
monorepo with `yarn typecheck` or in watch-mode with `yarn watch:typecheck`.
Include the watch-mode typecheck action as part of `yarn start` (a.k.a
`yarn watch`).

To activate collective typecheck for a package in the monorepo, its
`package.json` file should specify:

```
{
  "embark-collective": {
    "typecheck": true
  }
}
```
*-or-*
```
{
  "embark-collective": {
    "typecheck": {...}
  }
}
```

Where `{...}` above is a `tsconfig.json` fragment that will be merged into the
config generated for the package according the same rules that `tsc` applies
when merging [configs][config].

When collective typecheck begins, it generates a `tsconfig.json` for the root
of the monorepo and for each package that is activated for the action. If the
generated JSON is different than what's on disk for the respective root/package
config, or if the config is not present on disk, then it will be
written. Changes to generated `tsconfig.json` files should be committed; such
changes will arise when there are structural changes to the monorepo, e.g. a
package is added, removed, moved and/or the directory containing it is
renamed. Since the configs are only generated at the beginning of collective
typecheck, when structural changes are made in the monorepo `yarn typecheck`
(or `yarn start` or `yarn watch:typecheck`) should be restarted.

Nearly all of the packages in the monorepo (i.e. all those for which it makes
sense) have been activated for collective typecheck. Even those packages that
don't contain `.ts` sources are activated because `tsc` can make better sense
of the code base as a whole owing to the project references included in the
generated `tsconfig.json` files. Also, owing to the fully cross-referenced
`tsconfig.json` files, it's possible for `tsc` to type check the whole code
base without babel (`yarn build` or `yarn watch:build`) having been run
beforehand.

**NOTE** that a *"cold typecheck"* of the whole monorepo is resource intensive:
on this author's 2019 MacBook Pro it takes around three minutes, the fans spin
up, and `tsc` uses nearly 0.5 GB of RAM. However, once a full typecheck has
completed, the next full typecheck will complete in a few seconds or less; and
when running in watch-mode there is likewise a *big* speedup once a full
typecheck has completed, whether that full check happened before it's running
in watch-mode or when watch-mode itself resulted in a full check before
switching automatically to incremental check, as well a corresponding *big*
reduction in resource consumption. A full check will be needed any time
`yarn typecheck` (or `yarn start` or `yarn watch:typecheck`) is run in a fresh
clone plus `yarn install`, or after doing `yarn reboot[:full]` or `yarn reset`.

The combination of options in each generated package-level `tsconfig.json` and
the root `tsconfig.base.json` result in `tsc` writing `.d.ts` files (TypeScript
declaration files) into the `dist/` directory of each package. That
output is intended to live side-by-side with babel's output, and therefore the
`"rootDir"` option in each generated config is set to `"./src"`.

In projects activated for collective typecheck, `.js` may be converted to `.ts`
and/or `.ts` sources may be added without any additional changes needed in
package-level `package.json`.

---

Reorganize types in `packages/core/typings` (a.k.a `@types/embark`) into
`packages/core/core` (`embark-core`), refactor other packages' imports
accordingly, and delete `packages/core/typings` from the monorepo. This results
in some similarly named but incompatible types exported from `embark-core`
(e.g. `Events` and `EmbarkEvents`, the latter being the one from
`packages/core/typings`); future refactoring should consolidate those types. To
avoid circular dependency relationships it's also necessary to split out
`Engine` from `embark-core` into its own package (`embark-engine`) and to
introduce a bit of duplication, e.g. the `Maybe` type that's now defined in
both `embark-i18n` and `embark-core`.

In the process of the types reorg, move many dependencies spec'd in various
`package.json` to the `package.json` of the package/s that actually depend on
them, e.g. many are moved from `packages/embark/package.json` to
`packages/core/engine/package.json`. Related to those moves, fix some Node.js
`require`-logic related to bug-prone dependency resolution.

Fix all type errors that appeared as a result of activating collective
typecheck across the whole monorepo.

Reactivate `tslint` in `packages/core/core` and fix the remaining linter errors.

Tidy up and add a few items in the root `package.json` scripts.

Bump lerna from `3.16.4` to `3.19.0`.

Bumpt typescript from `3.6.3` to `3.7.2`.

Bumpt tslint from `5.16.0` to `5.20.1`.

Make various changes related to packages' `import`/`require`ing packages that
weren't spec'd in their respective `package.json`. More refactoring is needed
in this regard, but changes were made as the problems were observed in the
process of authoring this PR.

[config]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
2019-12-13 13:59:47 -05:00
Iuri Matias c00511a0e2 chore(release): 5.0.0-alpha.4 2019-12-12 11:38:22 -05:00
Michael Bradley, Jr 9f2a5949c2 build: specify missing test action in relevant package.json "qa" scripts
It's a relevant `package.json` if the package has a test suite. If `test` isn't
specified then the tests won't run in CI (they have't been running).

Include a fix for one failing test in `packages/plugins/ens` and two failing
test in `packages/stack/deployment`. In all three cases, the mock embark
object's config needed a `blockchainConfig` section with `{ enabled: true }`.
2019-12-11 14:01:12 -06:00
Pascal Precht 446197baff fix(@embark/blockchain): make disabling blockchain feature work
Users can turn of blockchain support if they want to using the blockchain.js
configuration. In practice however, this has never properly worked as several
places in Embark's codebase weren't actually honoring that configuration value.

This commit introduces the necessary changes so that disabling blockchain support will:

No longer generate blockchain related EmbarkJS artifacts
No longer try to deploy Smart Contracts but still compile them
2019-12-11 11:08:13 -05:00
Iuri Matias 37ae942b99 chore(release): 5.0.0-alpha.3 2019-12-06 06:15:07 -05:00
Iuri Matias 6efe791cfd chore(release): 5.0.0-alpha.2 2019-12-05 15:03:09 -05:00
Michael Bradley, Jr 8ede518bd2 build(deps): bump core-js from 3.3.5 to 3.4.3 2019-11-26 15:16:29 -06:00
Michael Bradley, Jr da7ceb8c54 build(deps/-dev): update babel and babel-related deps and devDeps to latest versions 2019-11-26 13:22:13 -06:00