Commit Graph

40 Commits

Author SHA1 Message Date
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
Pascal Precht e37d3f73ff feat(@embark/test-runner): expose evmClientVersion for conditional tests
This commit introduces a new `global.getEvmVersion()` that can be used to
conditionally run tests, such as when tests rely on RPC APIs that are only
available in specific evm nodes.
2020-01-09 11:39:28 -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
Michael Bradley, Jr 7e550f0e6f build(deps): bump web3[-*] from 1.2.1 to 1.2.4
Refactor typings as necessary. In order for `bignumber.js` in the root
`node_modules` to not conflict with `@types/bignumber.js`, specify
`"bignumber.js": "5.0.0"` in `devDependencies` and `"embark-ui/bignumber.js"`
in `nohoist` of the root `package.json`.

In `packages/plugins/rpc-manager` switch from callback to promise usage with
respect to `web3.eth.accounts.signTransaction` because of a [bug][bug]
discovered in web3 v1.2.4.

In `packages/plugins/solidity-tests` specialize the tsc compiler options with
`"skipLibCheck": true` because of a problematic web3-related typing in the
`.d.ts` files of the remix-tests package.

Bump ganache-cli from 6.4.3 to 6.7.0 (latest) because 6.4.3 doesn't support
`eth_chainId` but web3 1.2.4 makes use of the `eth_chainId` RPC method (EIP
695).

BREAKING CHANGE: bump embark's minimum supported version of parity from
`>=2.0.0` to `>=2.2.1`. This is necessary since web3 1.2.4 makes use of the
`eth_chainId` RPC method (EIP 695) and that parity version is the earliest one
to implement it.

[bug]: https://github.com/ethereum/web3.js/issues/3283
2019-12-20 08:35:48 -06: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
Jonathan Rainville b82a240933 fix(@embark/test): fix using --node option in tests 2019-12-11 11:05:12 -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
dependabot-preview[bot] 6695ab9d23 build(deps): bump mocha from 6.2.0 to 6.2.2
Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.0 to 6.2.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v6.2.0...v6.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-22 09:50:51 -06:00
emizzle 23e94d6197 fix(@embark/tests): Improve expiration unit test
Improve the reliability of the expiration unit test in the test dapp by explicitly setting the `block.timestamp` and comparing an expiration value against that.

This improves on the current implementation that relies on time passed which varies depending on the speed of unit tests run (CPU speed, logs shown, etc).
2019-11-22 11:23:18 +01:00
emizzle f6f45077e9
fix(@embark/proxy): Fix unsubsribe handling and add new provider
When `eth_unsubscribe` is received in the proxy, ensure this request is forwarded through on the correct socket (the same socket that was used for the corresponding `eth_subscribe`).

Move subscription handling for `eth_subscribe` and `eth_unsubscribe` to RpcModifiers (in `rpc-manager` package).

For each `eth_subscribe` request, a new `RequestManager` is created. Since the endpoint property on the proxy class was updated to be a provider, the same provider was being assigned to each new `RequestManager` and thus creating multiple event handlers for each subscription created. To circumvent this, we are now creating a new provider for each `RequestManager`.

Co-authored-by: Pascal Precht <pascal.precht@googlemail.com>
2019-11-21 15:38:48 +01:00
emizzle c7ec49a38f feat(@embark/embark-rpc-manager): Add support for `eth_signTypedData_v3`
This PR adds support for EIP-712 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md), by allowing the signing of typed data transactions using the `eth_signTypeData_v3` or `eth_signTypedData` request.

Add a module called `embark-rpc-manager` to handle all RPC transaction modifications.

The internal events management module extracted to `embark-core`. This allows other modules (ie plugins) to use a private instance of Embark’s event API.

Remove transaction modifications in `embark-accounts-manager` and leave only the functionality in this module that handle account management (ie funding of accounts). Other functionality was moved to `embark-rpc-manager`.

- Transactions should now reflect when a new node account is added via `personal_newAccount` or via the node itself (and once `eth_accounts` is requested).
- In the proxy, errors are handled for all cases and are now JSON-RPC spec-compliant.
- Always register `eth_signTypedData` RPC response and display error message if account cannot be found.

NOTE: Updated yarn.lock due to conflict after rebase.

Avoid race condition with rpc modifications

Refactor proxy to make request handling asynchronous, and to allow circumvention of forwarding requests to the node in cases where it is not needed.

Move loading of plugins to after core and stack components (in cmd_controller).

We should load custom plugins LAST (ie after all core and stack components, and after all Embark plugins). To do this, we disable automatic loading of plugins in the config, and allow them to be loading explicitly in cmd_controller.

Create a system that allows registration of custom plugins. Each plugin is generated in EmbarkJS by instantiating the registered class. For example, we can register a Plasma plugin and it will be generated in to EmbarkJS.Plasma with an instantiation of `embarkjs-plasma`. The DApp itself can then do what it wants with `EmbarkJS.Plasma` (ie call `EmbarkJS.Plasma.init()`.

NOTE: loading of custom plugins needs to be applied to all other commands in `cmd_controller`. This PR only loads custom plugins for the `run` command.

NOTE: This PR is based on branch fix/ws-eth-subscribe (#1850). I will rebase this PR when (and if) #1850 is merged.
2019-11-18 13:36:37 -06:00
Jonathan Rainville aecb99d428 feat(@embark/tests): enable comms and storage in tests
But only enabled at the start and not changed per test
2019-11-12 09:31:05 -05:00
Jonathan Rainville de9e667794 feat(@embark/ens): enable changing namesystem config per test
Adds back the feature to change ENS config per test
Fixes ENS not working in the console because EmbarkJS was not ready
2019-11-12 09:31:05 -05:00
Michael Bradley, Jr fccda21623 chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
dependabot-preview[bot] d0f4236aff build(deps): bump core-js from 3.3.4 to 3.3.5
Bumps [core-js](https://github.com/zloirock/core-js) from 3.3.4 to 3.3.5.
- [Release notes](https://github.com/zloirock/core-js/releases)
- [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zloirock/core-js/compare/v3.3.4...v3.3.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-01 12:21:12 -05:00
Michael Bradley, Jr 85235f88b2 chore(release): 5.0.0-alpha.0 2019-10-28 16:05:13 -05:00
Michael Bradley, Jr 1225cb14e8 build(deps): add core-js@3 as a dep to all pkgs that have @babel/runtime-corejs3 dep
When making use of the `useBuiltIns: 'usage'` option for @babel/preset-env
(which is the case for all transpiled packages in Embark's monorepo) a package
needs to have both @babel/runtime-corejs3 and core-js@3 specified as
dependencies.
2019-10-28 11:40:48 -05:00
Michael Bradley d22cd58db3 reorg some deps from packages/embark to the packages that actually depend on them (#1990)
* build(deps): move @types/os-locale from packages/embark to packages/core/i18n

* build(deps) move @types/globule from packages/embark to packages/plugins/coverage

* build(deps): refactor stack/{api,proxy,webserver} deps relative to packages/embark

* build(deps): remove unneeded @types/async dep from packages/stack/test-runner

* build(deps): remove unneeded deps from packages/embark
2019-10-25 13:04:51 -04:00
Michael Bradley, Jr a4ee9f8739 test(@embark/stack/test-runner): enable test-runner's test suite
Introduce some light refactoring related to embark-testing facilities, and also
a configurable stdout option so the output of the reporter implemented in this
package isn't confusingly mixed into unit test reporting for this package.
2019-10-25 11:32:48 -05:00
Michael Bradley d17fe33339 build: update babel and webpack dependencies (#1987)
Includes a switch from core-js@2 to core-js@3
2019-10-24 17:41:28 -04:00
Michael Bradley ed02cc849f build: bump all packages' engines settings (#1985)
BREAKING CHANGE:

node: >=10.17.0 <12.0.0
npm: >=6.11.3
yarn: >=1.19.1

node v10.17.0 is the latest in the 10.x series and is still in the Active LTS
lifecycle. Embark is still not compatible with node's 12.x and 13.x
series (because of some dependencies), otherwise it would probably make sense
to bump our minimum supported node version all the way to the most recent 12.x
release.

npm v6.11.3 is the version that's bundled with node v10.17.0.

yarn v1.19.1 is the most recent version as of the time node v10.17.0 was
released.
2019-10-24 09:52:05 -04:00
Jonathan Rainville 6e9635c12b fix(@contract-app): fix contracts app tests (#1982)
* refactor(@embark/dapps/tests/app): use function syntax

These changes don't fix the race conditions related to the test dapp's tests
but are a step in the right direction.

* refactor(@embark/dapps/tests/contracts): adjustments to get tests passing

Further refactoring is needed re: potentially duplicated or overlapping logic
in `packages/plugins/solidity-tests` and
`packages/core/utils/src/solidity/remapImports.ts`, as well in disabled test
dapp tests

* test(dapps/tests/app): temporarily disable intermittently failing tests

They are failing because of a race condition; once that race condition has been
fixed these tests should be reenabled.

* fix(@embark/solidity-tests): fix importing the library for the tests
2019-10-23 14:58:40 -04:00
Jonathan Rainville 2193d82399 fix(test-app): make test app test all pass (#1980)
Fix a lot of bugs and reenable a couple of modules
Some tests were kept disabled, mostly the ENS and EmbarkJS tests
Those need to add back a fairly significant feature to work
Add back missing solidity contracts
2019-10-22 09:27:22 -04:00
Jonathan Rainville a3b52676fc Fix part of the test app and add new test util functions (#1977)
* fix: fix tests hanging because the console is not started

* fix(@embark/proxy): send back errors correctly to the client

Code originally by @emizzle and fixed by me

* feat(@embark/test-runner): add assert.reverts to test reverts

* fix: make test app actually run its test and not hang

* fix(@embark/proxy): fix listening to contract event in the proxy

* feat(@embark/test-runner): add assertion for events being triggered

* docs(@embark/site): add docs for the new assert functions

* feat(@embark/test-runner): add increaseTime util function to globals

* docs(@embark/site): add docs for increaseTime
2019-10-17 14:39:25 -04:00
Michael Bradley, Jr 17ccd5c1bd build: tidy up the monorepo in prep for v5.0.0-alpha.0 2019-10-01 13:29:53 -05:00
Michael Bradley, Jr 3b649fa455 build: phase 1 of introducing embark-collective 2019-10-01 13:28:13 -05:00
Jonathan Rainville f54fbf0b3d feat(@embark/test-runner): make vm default node (#1846)
* feat: make vm default node

* feat(@embark/tests): enable switching node between tests
2019-09-12 17:30:28 -04:00
André Medeiros 2f9d5e6085 chore: test framework (#1894)
* chore: test framework

* chore(@embark/testing): introduce Plugin apis and other changes

* refactor(@embark/deployment): use new testing APIs for tests
2019-09-12 17:26:57 -04:00
André Medeiros 2900e04cae
chore: use libraries to generate coverage report (#1876) 2019-09-09 08:47:22 -04:00
Michael Bradley, Jr 8779476ac0 style: make eslint aware of mocha globals in plugins/mocha-tests and stack/test-runner
Also remove some `/* globals ... */` comments and supply missing semicolons
2019-09-08 15:29:03 -05:00
André Medeiros 5e560768ad chore: test runner tests (#1884)
* chore: test runner tests

* chore: mocha test runner tests

* chore: add solidity test file to dapp
2019-09-07 15:55:24 -04:00
Iuri Matias 8cf458b129
chore(@embark/): move more packages to their logical folders, remove embark- prefix (#1882) 2019-09-07 11:27:08 -04:00