Commit Graph

78 Commits

Author SHA1 Message Date
Jonathan Rainville 0503bb24a3 fix: fix node connection test to use the endpoints correctly
This caused issues to connect to Infura for example, because we did
not support HTTPS at all, nor WSS
2019-12-13 10:38:53 -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
emizzle acd1d72f2d fix(@embark/tests): Tests exiting early
Tests were exiting early and Mocha was reporting an exit code of 0. This allowed CI to complete as if the tests were successful.

Change `compiler:contracts` event request to `compiler:contracts:compile` and update documentation. Because the `compiler:contracts` event didn’t exist, this test was silently failing.

Update the `TestEvents` mock object to allow passing of parameters to an event that is not a callback.

Add unit tests to test for contracts loaded via node_modules.

1. This PR contains a change where any contracts loaded from node_modules will be imported in to `.embark/contracts/node_modules`. Previously, these contracts were loaded in to `.embark/node_modules` (with the `/contracts`).
2019-12-11 11:27:45 -05:00
emizzle 8e0f8b44d1 fix(@embark/debugger): Re-enable debugger
Re-enable debugger for cockpit and console.

Add missing request `blockchain:getTransaction` required to start a debugging session.

Fix error in console when stopping a debug session.
2019-12-11 11:12:52 -05: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
Jonathan Rainville b82a240933 fix(@embark/test): fix using --node option in tests 2019-12-11 11:05:12 -05:00
Jonathan Rainville eae97dee4f fix(@embark/proxy): fix conflict for WS port in the proxy
This error arose when using tests parallel to Embark
2019-12-11 11:05:12 -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
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
Jonathan Rainville 3c760c3515 fix(@embark/library-manager): add web3 to versions list
This is needed by the cockpit for the communication component
2019-11-21 08:46:55 -05: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
emizzle 7482107374 refactor(@embark/blockchain): Move check for blockchain started
The blockchain module should not contain any ethereum-specific code, and currently it contains a check to see if the blockchain has already been started.

This PR moves this check to blockchain client (ie geth or parity). This check function is registered along with the started callback.

style(@embark/stack/blockchain): add missing semicolon
2019-11-14 15:35:09 +01:00
Iuri Matias af51e2d793 bugfix (@embark/stack/embarkjs): set default gas so it's an optional parameter for onDeploy directives in the contracts config 2019-11-12 17:08:48 -05: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
Pascal Precht d2556af8ba refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
Michael Bradley, Jr 2543acad75 refactor(@embark/library-manager): restrict versionable packages to only solc
BREAKING CHANGE:

Remove support for specifying the versions of `web3` and `ipfs-api` in a
project's `embark.json`.
2019-11-08 11:27:20 -06:00
Michael Bradley, Jr fccda21623 chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
Iuri Matias dc64b99779
Remove unnecessary messages/traces from logs when not debugging (#1986)
* bugfix(@embark/stack/blockchain): fix issue with calling wrong callback variable

* chore(@embark/): remove unnecessary messages/warnings when not in debug mode

* refactor(@embark/core/events): add debugEventsEnabled method
2019-11-05 10:35:37 -05: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
Jonathan Rainville 9e654c533e fix: fix ws providers to have the patch for a bigger threshold (#2017)
* fix: fix ws providers to have the patch for a bigger threshold

* chore (@embark/dapps): add big contract to test WS issue with large contracts
2019-10-30 16:02:17 -04:00
emizzle f9ad486edb fix(@embark/proxy): Fix contract event subscriptions
Fix the proxy’s handling of WebSocket connections when subscribing to contract events and node data using the `eth_subscribe` RPC request.

Previously, the client connection that the subscription data was sent to was often in a closed state. It was determined that this connection was the wrong connection to forward the data in the first place. The connection was in fact generally the connection created for the Ethereum service check which was then (correctly and subsequently) closed after it had finished its operation.

The flow of a proxy request handling a WebSocket “eth_subscribe” RPC request is now as follows:
1. A WebSocket RPC request `”eth_subscribe”` is sent from a client to the proxy.
2. Proxy forwards the request to the node by way of a new instance of `RequestManager`.
3. When the node receives an event matching the subscription, it sends the event data back to same socket connection it received the request on (ie the specific instance of `RequestManager`).
4. The `RequestManager` fires the `”data”` event containing the subscription data, and this event is picked up in the proxy.
5. The proxy then forwards the subscription data on to the originating WS client connection.

All other requests (ie non-WS or WS RPC requests that are not `eth_subscribe`) will be serviced to/from the node using a single `RequestManager` instance.

Co-authored-by: Pascal Precht <pascal.precht@gmail.com>
2019-10-30 12:19:24 -05:00
Michael Bradley, Jr 85235f88b2 chore(release): 5.0.0-alpha.0 2019-10-28 16:05:13 -05:00
Iuri Matias 867a55c98a
Revert "fix(@embark/proxy): Fix contract event subscriptions" (#2005)
* Revert "fix(@embark/core): set loglevel back to info"

This reverts commit a03ffd56e5.

* Revert "fix(@embark/proxy): Fix contract event subscriptions"

This reverts commit 173d53de2f.
2019-10-28 16:20:14 -04:00
emizzle 173d53de2f fix(@embark/proxy): Fix contract event subscriptions
Fix the proxy’s handling of WebSocket connections when subscribing to contract events and node data using the `eth_subscribe` RPC request.

Previously, the client connection that the subscription data was sent to was often in a closed state. It was determined that this connection was the wrong connection to forward the data in the first place. The connection was in fact generally the connection created for the Ethereum service check which was then (correctly and subsequently) closed after it had finished its operation.

The flow of a proxy request handling a WebSocket “eth_subscribe” RPC request is now as follows:
1. A WebSocket RPC request `”eth_subscribe”` is sent from a client to the proxy.
2. Proxy forwards the request to the node by way of a new instance of `RequestManager`.
3. When the node receives an event matching the subscription, it sends the event data back to same socket connection it received the request on (ie the specific instance of `RequestManager`).
4. The `RequestManager` fires the `”data”` event containing the subscription data, and this event is picked up in the proxy.
5. The proxy then forwards the subscription data on to the originating WS client connection.

All other requests (ie non-WS or WS RPC requests that are not `eth_subscribe`) will be serviced to/from the node using a single `RequestManager` instance.

Co-authored-by: Pascal Precht <pascal.precht@gmail.com>
2019-10-28 13:00:18 -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, Jr 2407df5d11 test(@embark/stack/compiler): add tests for the compiler 2019-10-25 14:12:00 -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
Michael Bradley 183d9a05b5 Fix/solo spawn (#1981)
* build(@embark/stack/blockchain-client): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* build(embark): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* build(@embark/plugins/ethereum-blockchain-client): remove unneeded typescript related scripts, deps

In addition to being unneeded their presence is causing build errors.

* build(@embark/plugins/ganache): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* build(@embark/plugins/geth): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* fix(@embark/plugins/transaction-logger): require 'web3' not 'Web3'

* fix(@embark/utils/solo): spawn npm(.cmd) instead of npx(.cmd)

* test(@embark/plugins/basic-pipeline): add test stub

* test(@embark/stack/blockchain): add test stub
2019-10-22 09:27:28 -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
Pascal Precht 7881e6a3ac test(@embark/communication): fix failing test (#1979)
In d6bf5c24b9 we've ensured that certain modules of
embark only executed if their functionality is actually enabled.
This broke one of our tests in the communication module.
This commit fixes the test by explicitly enabling the module's functionality.
2019-10-21 13:23:43 -04:00
Eric Mastro db71a93bba fix(@embark/proxy): Check if WebSocket open before sending (#1978)
Add error handling to the proxy so that websocket frames are not sent on a socket that is not open.
2019-10-21 13:23:34 -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
Iuri Matias cb0995f3f6
chore(@embark/stack/blockchain-client): re-add missing file (#1973) 2019-10-16 11:00:26 -04:00
Eric Mastro 3b8f8f9ea7 refactor(@embark/blockchain-client): move module into own package (#1955)
refactor(@embark/blockchain-client): move module into own package

update package.json
2019-10-16 09:41:17 -04:00
Eric Mastro ed0d3afb4f refactor(@embark/blockchain): move module into own package (#1942) 2019-10-16 09:30:14 -04:00
Jonathan Rainville 08c97a2964 fix: fix windows build for pipeline and embarkjs (#1971) 2019-10-16 09:07:42 -04:00
Eric Mastro e03ae120fe refactor(@embark/embarkjs): move module into own package (#1943) 2019-10-14 16:08:21 +09:00
Jonathan Rainville 4b947bb5c2 fix: fix error logs in the cockpit due from negative blocks numbers (#1967) 2019-10-14 10:53:14 +09:00
Jonathan Rainville 80df4fa11d fix: patch for infinite loop with panic override (#1964) 2019-10-12 12:17:33 +09:00