Commit Graph

46 Commits

Author SHA1 Message Date
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
emizzle 4a10476e85 refactor(@embark/whisper): Remove unneeded whisper layer
1. get rid of the whisper layer and handle everything in the communication layer
2. Create a gethWhisper and a parityWhisper plugin that has the same files as packages/embark/src/lib/modules/geth, except with a whisperClient instead of gethClient, and will include most of https://github.com/embark-framework/embark/blob/master/packages/plugins/whisper/src/index.js.
3. Get rid of any whisper registration in geth.
4. In the whisperGeth and whisperParity plugins, modify the request for communication:node:register, to end up calling `startWhisperNode`
2019-11-26 12:22:05 +01: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 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
Michael Bradley, Jr d5ebdafb55 refactor(@embark): remove unnecessary `undefined` argument in calls of registerActionForEvent 2019-11-19 13:59:39 -06: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
Pascal Precht 5dc4b2134e fix(@embark/core): ensure type declaration for Plugin.registerActionForEvent() is legit
In 776db1b7f7 (diff-5cab125016e6d753f03b6cd0241d5ebbR267) we've introduced the ability to add
a `priority` parameter to plugin actions, so the order of actions can be semi-ensured.

That commit also introduced typings for that new API but it actually didn't match the
implementation of the API, namely that the second parameter of `Plugin.registerActionForEvent()`
can be either an options object **or** a callback function.

This forces consumers to call the API as `registerActoniForEvent(name, undefined|null, callback)`
which shouldn't be necessary.
2019-11-18 18:05:47 +01:00
Michael Bradley, Jr 978e17daa1 build(deps): bump deprecated ipfs-api@17.2.4 to ipfs-http-client@39.0.2
BREAKING CHANGE:

Related to #1985. Prior to Embark's minimum supported version of Node.js being
bumped to to 10.17.0, Embark was incompatible with any relatively recent
release of the `ipfs-http-client` package.

While *internal* changes are needed re: ipfs's `Buffer` export for
e.g. `embark_demo` to function correctly *(and this PR makes those changes)*,
Embark otherwise runs/tests okay.

Keep in mind #2033.

However, if a dApp author were to explicitly `require('ifps-api')` in the
front-end that wouldn't work as before; and swapping `"ipfs-http-client"` for
`"ipfs-api"` might also not be enough — there are API changes that dApp authors
would need to consider, regardless of Embark presently supplying the dependency
and EmbarkJS wrapping around it.

Closes #1994.
2019-11-18 09:41:24 -06:00
Michael Bradley, Jr 08933dec90 refactor(@embark/plugins/profiler): re-enable embark-profiler plugin
Hook `embark-profiler` into the engine's contracts group.

Adjust `request` signatures to match v5 usage.

Ensure gas numbers are formatted consistently in the ascii table.

Display non-json output in cockpit's console as monospace/pre to preserve
profiler table formatting.
2019-11-18 09:02:05 -06:00
dependabot-preview[bot] 92c5062e3e build(deps-dev): bump @types/async from 2.0.50 to 3.0.3
Bumps [@types/async](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/async) from 2.0.50 to 3.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/async)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-14 09:26:22 -06:00
Pascal Precht 00ad5321bd chore(@embark/utils): improve error handling for downloading file contents
Embark's `File.content` is an asynchrononus getter that potentially downloads the
contents of a file from its `externalUrl`. This can potentially fail but is not properly
reported to the user as the error itself is ignored.

This commit ensures errors are propagated and displayed to the user.
2019-11-14 15:36:18 +01:00
Michael Bradley, Jr 5d61faa550 build(deps): bump ora from 2.1.0 to 4.0.3 2019-11-13 11:18:45 -06:00
Pascal Precht d2556af8ba refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
Michael Bradley, Jr 4ee900480d fix(@cockpit/console): show contract names in the suggestions list
Update event name `"deploy:contract:deployed"` to
`"deployment:contract:deployed"`.

Also, listen one time for `"deployment:deployContracts:afterAll"` and then
request the full contracts list so as to pickup contract names that were
already deployed. This is necessary for subsequent `embark run` (without
reset), otherwise the suggestions list will be missing contracts.
2019-11-08 12:43:08 -06: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
Michael Bradley, Jr c320dcfbb5 refactor(@embark/core/console): silence errors when autocomplete is attempted on bad reference
Previously, in the embark cli dashboard/console, if you were to type `Foo.` and
hit tab for autocomplete then (assuming you hadn't defined `Foo`) there would
be unhandled errors and the console could even become unusable.

Refactor `packages/core/console` and related code so that nothing happens when
you attempt to autocomplete a bad reference (the same behavior as Node's own
REPL).
2019-11-05 11:01:43 -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
Iuri Matias ee15cd4c87
feature (@embark/core): show origin of each log in the logfile logs (#2018) 2019-10-30 16:01:59 -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 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 0af6e13779 build(deps): move deps needed by embark-basic-pipeline from packages/embark
Introduce additional refactors to ensure the packages can be resolved by the
basic pipeline's webpack child process.
2019-10-25 11:13:49 -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
Eric Mastro e2efbbd846 refactor(@embark/parity): move module into own package (#1951)
Contains bug fixes to get parity to work as a blockchain client.

**NOTE:** Please merge https://github.com/embark-framework/embark/pull/1950 first before merging this PR, as this PR contains removal of dependencies from `packages/embark` that are needed for geth. So if this is merged first, and the geth PR (https://github.com/embark-framework/embark/pull/1950) is not merged, then geth will not have some of the dependencies it needs.
2019-10-16 09:35:26 -04:00
Jonathan Rainville 918a00c24c fix: add back log command for modules (#1969) 2019-10-14 10:58:57 +09:00
Jonathan Rainville 913267b1ce fix: fix process logs not showing on errors (#1962) 2019-10-14 10:31:20 +09: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
Michael Bradley, Jr 14d20e1b6f test(@embark/core/console): fix bad setUpEnv path 2019-09-24 10:51:27 -05:00
Michael Bradley, Jr de0e12d039 feat(@embark/utils): "inside monorepo" APIs 2019-09-24 10:51:27 -05:00
Michael Bradley fe107546a8 refactor(@embark): remove the embark-async-wrapper package (#1911)
It's principal use was in `stack/compiler`, but that package was refactored
in #1878 to use async/await. There was a replica in
`packages/embark/src/lib/utils/async_extend.js` but it wasn't being used to do
async operations and could be replaced with `Object.entries().forEach()`. It
was required by `plugins/vyper` but the wrapper's custom `eachObject` method
wasn't being used. `stack/api` had it as a dependency but wasn't using it.
2019-09-17 17:31:57 +02:00
Michael Bradley, Jr b262a18441 build(deps): bump pretty-ms from 4.0.0 to 5.0.0 2019-09-12 21:45:42 -05:00
dependabot-preview[bot] 0cabff3eb9 build(deps-dev): bump @types/pretty-ms from 3.2.0 to 5.0.1
Bumps [@types/pretty-ms](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/pretty-ms) from 3.2.0 to 5.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/pretty-ms)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-12 21:45:42 -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
Iuri Matias e598e3f998
chore(@embark/embark-reset): move embark-reset package (#1898) 2019-09-11 14:16:23 -04:00
Michael Bradley 043ccc0a24 feat(@embark/compiler): support :before and :after hooks on event compiler:contracts:compile (#1878)
* feat(@embark/compiler): support :before and :after hooks on event compiler:contracts:compile

* style: keep root package.json sorted cleanly

* style: formatting with prettier where print-width is 200

Per the suggestion of @iurimatias

* WIP: PR review

* WIP: PR review

* WIP: refactor to check if file.path is within dappPath() or os.tmpdir()

* WIP: PR review

* WIP: use native async functions (and related JS lang constructs) instead of the async library

* WIP: async.eachObject is no longer a dependency
2019-09-11 13:08:52 -04:00
Iuri Matias 14155285b3
move rest of the packages to their logical folders (#1886)
* chore(@embark/): move more packages to their logical folders, remove embark- prefix

* chore(@embark/): move embark-process-logs-api-manager to stack folder, remove embark- prefix

* chore(@embark/): move embark-coverage to plugins folder, remove embark- prefix

* chore(@embark/): move api, async-wrapper, authenticator, library-managre to folders, remove embark- prefix
2019-09-07 15:45:25 -04:00
Michael Bradley, Jr 4e590991a8 style: fix linter errors on master after recent PR merges 2019-09-06 19:31:18 -05:00
Iuri Matias c46c52ff5c
move embarkjs packages & remove embark- prefix from some folders (#1879)
* chore(@embark/): move embarkjs packages to their own folder

* chore(@embark/): rename embark-ui folder to cockpit

* chore(@embark/): rename packages already in logical folders to remove embark- prefix

chore(@embark/): rename packages already in logical folders to remove embark- prefix

update package.json files to use correct eslint config

remove core/* from package.json workspaces
2019-09-06 18:26:08 -04:00
Iuri Matias 48c328e39e
refactor(@embark/): move several packages into logical folders (#1877) 2019-09-06 17:39:51 -04:00