Commit Graph

673 Commits

Author SHA1 Message Date
Michael Bradley, Jr abfa8ca50a build(deps): bump ipfs-http-client from 39.0.2 to 40.0.0
Refactor constructor call in light of breaking change in the release notes:

https://github.com/ipfs/js-ipfs-http-client/releases/tag/v40.0.0

> Multi parameter constructor options are no longer supported
2019-11-25 11:46:39 -06:00
dependabot-preview[bot] 405e4d527d build(deps-dev): bump redux-saga from 0.16.2 to 1.1.3
Bumps [redux-saga](https://github.com/redux-saga/redux-saga) from 0.16.2 to 1.1.3.
- [Release notes](https://github.com/redux-saga/redux-saga/releases)
- [Changelog](https://github.com/redux-saga/redux-saga/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redux-saga/redux-saga/compare/v0.16.2...v1.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-22 10:54:51 -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
Michael Bradley, Jr 4ebbb4488e fix(@embark/rpc-manager): implement missing RPC modifier for eth_sign 2019-11-22 08:29:15 -06:00
Jonathan Rainville 14dbb63775
chore(@embark/whisper): add warning if comm port is the same as node
Co-Authored-By: Eric Mastro <ericmastro@status.im>
2019-11-22 11:37:16 +01:00
Jonathan Rainville 23f9a8c49c
fix(@embark/whisper): show message when geth port is already taken 2019-11-22 11:37:08 +01:00
emizzle dba5f771f2 fix(@embark/simulator): fix port used in simulator
When using websockets, the simulator was starting on port `8545` instead of `8546`, so the blockchain check was failing.

Update the simulator port to be websockets port from the config when using websockets.
2019-11-22 11:25:02 +01:00
emizzle cb0f8b011e chore(@embark/whisper): improve whisper startup logging
When whisper was being started in a new process, the message displayed in the console was “Starting Blockchain node in another process”. This is misleading as it is the same message that geth/parity use to start up their processes.

Update whisper initialisation process messaging so it states “Starting Whisper node in another process”.
2019-11-22 11:24:20 +01: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 6f9e82d8b9 chore(@embark/geth): remove unneeded APIs 2019-11-22 11:22:43 +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
Jonathan Rainville ebdd573548 chore: small fixes to cockpit 2019-11-21 08:46:55 -05:00
Michael Bradley, Jr d5ebdafb55 refactor(@embark): remove unnecessary `undefined` argument in calls of registerActionForEvent 2019-11-19 13:59:39 -06:00
Michael Bradley, Jr b28054530d refactor(@embark/cmd_controller): remove logger call in initConfig 2019-11-19 13:56:25 -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
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
Pascal Precht 0d20cb5d86 fix(@embark/ens): don't break when determining contract addresses
Turns out that, when Embark tries to replace ENS subdomains, it would fail
if `subdomains` aren't defined in the namesystem configuration.

This commit adds a safeguard so that not defining `subdomains` is fine.
2019-11-14 12:28:41 +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
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 b4478a9c46 fix(@embark/ens): don't change shape of Smart Contract args in action hooks
This commit fixes the issue that it wasn't possible anymore to use named constructor arguments
in Smart Contract configurations.

For example, the following Smart Contract expects two constructor arguments:

```solidity
contract SomeContract {
  constructor(address[] _addresses, int initialValue) public {}
}
```

The first being a list of addresses, the second one a number. This can be configured as:

```js
SomeContract: {
  args: [
    ["$MyToken2", "$SimpleStorage"],
    123
  ]
}
```

Notice how the order of arguments matters here. `_addresses` come first in the constructor,
so they have to be defined first in the configuration as well.

Another way to configure this is using named arguments, which is what's broken prior to this commit:

```js
SomeContract: {
  args: {
    initialValue: 123,
    _addresses: ["$MyToken2", "$SimpleStorage"]
  }
}
```

Using a notation like this ^ the order no longer matters as Embark will figure out the right
values for the constructor arguments by their names.

The reason this is broken is because there are several modules in Embark that register and
run a `deployment:contract:beforeDeploy` action, which are allowed to mutate this configuration
object. One of those modules is the `ens` module, which searches for ENS names in the arguments
and figure out whether it has to replace it with a resolved address.

One thing that particular module didn't take into account is that `args` could be either and
array, or an object and will always return an array, changing the shape of `args` in case it was
an object.

This is a problem because another module, `ethereum-blockchain-client`, another action is registered
that takes this mutated object in `determineArguments()` and ensure that, if `args` is actually an
object, the values are put in the correct position matching the constructor of the Smart Contract in
question.

One way to solve this was to use the newly introduced [priority](https://github.com/embark-framework/embark/pull/2031) and ensure
that `ens` action is executed after `ethereum-blockchain-client`'s.

However, the actual bug here is that the ENS module changes the shape of `args` in the first place,
so this commit ensures that it preserves it.
2019-11-11 14:01:48 -05:00
Iuri Matias 41c943f052
bugfix (@embark/embarkjs): fix required Web3 object so it can support brave and other browser not injecting a Web3 object with websockets (#2036) 2019-11-11 13:59:56 -05:00
Pascal Precht d2556af8ba refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
Jonathan Rainville 8733ca911c chore(@embark/deploy-tracker): fix tests and make them run in CI 2019-11-08 16:53:57 -06:00
Michael Bradley, Jr 25d0510d5b feat(@embark/plugins/geth): bump min supported geth version from 1.8.14 to 1.9.7
This is not a breaking change because Embark doesn't strictly enforce the
mininum version, it only prints a warning.
2019-11-08 12:45:45 -06: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 7b991bb58a refactor(@embark/plugins/geth): don't run empty commands
The `WhisperGethClient` returns empty strings for its "new account" and "list
accounts" commands; if a command is an empty string then `Blockchain` should
not execute it.
2019-11-08 11:28:03 -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
dependabot-preview[bot] 98b688cc1a build(deps): bump remix-tests from 0.1.14 to 0.1.20
Bumps [remix-tests](https://github.com/ethereum/remix-tests) from 0.1.14 to 0.1.20.
- [Release notes](https://github.com/ethereum/remix-tests/releases)
- [Commits](https://github.com/ethereum/remix-tests/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-08 11:12:43 -06:00
Jonathan Rainville 95b5ae48c6 fix(@embark/accounts-manager): limit funding accounts to 1 at a time 2019-11-08 08:46:32 -05:00
Jonathan Rainville 776db1b7f7 feat(@embark/plugin): add priority to regsiterActionForEvents 2019-11-08 08:46:32 -05:00
dependabot-preview[bot] 6afe1ace08 build(deps-dev): bump @coreui/coreui from 2.1.0 to 2.1.16
Bumps [@coreui/coreui](https://github.com/coreui/coreui) from 2.1.0 to 2.1.16.
- [Release notes](https://github.com/coreui/coreui/releases)
- [Changelog](https://github.com/coreui/coreui/blob/v2.1.16/CHANGELOG.md)
- [Commits](https://github.com/coreui/coreui/compare/v2.1.0...v2.1.16)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-07 13:44:25 -06:00
Michael Bradley, Jr fccda21623 chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
dependabot-preview[bot] 6bfbedb8f7 build(deps-dev): bump qs from 6.5.2 to 6.9.0
Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.9.0.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.5.2...v6.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-05 11:28:03 -06:00
Michael Bradley 1a43dcaa79 fix(@cockpit/dashboard): "Deployed Contracts" should auto-update after deployment (#2020) 2019-11-05 12:07:59 -05: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
Michael Bradley, Jr 6b405d1d7e build(deps-dev): bump react-treebeard from 3.1.0 to 3.2.4
Also bump peerDeps: @emotion/core from 0.13.1 to 10.0.22 and @emotion/styled
from 0.10.6 to 10.0.23. Satisfy @babel/runtime peerDep with 7.6.3.

Make small refactors in components/FileExplorer and
containers/FileExplorerRowContainer re: the package upgrades.

Replaces #1998
2019-11-05 11:01:21 -06:00
Jonathan Rainville 863ae51a2f Fix embark test with --node (#2021)
* fix(@embark/solidity): fix solidity ipc connection with blockchain

When blockchain was run in another process, the IPC was connected,
but the compiler was not loaded, so the IPC calls never returned

* fix(@embark/geth): fix cb is not a fn because it needs request2
2019-11-05 12:00:42 -05: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
Iuri Matias 830e91de7f
bugfix(@embark): fix upload and graph command (#1993)
bugfix(@embark): fix upload command

bugfix(@embark): fix graph command

update graph cmd

update upload cmd
2019-11-05 10:34:33 -05:00
Pascal Precht b0e71d9427 fix(@embark/console): ensure Cockpit is only started in non-secondary mode (#2026)
`embark console` registers and tries to spin up `Cockpit`, even when there's already
a Cockpit instance running and thefore exits with an error that a certain port is already
in use.

This commit ensures that Cockpit is only bootstrapped when `embark console` is
executed as a non-secondary process, meaning that there's no other `embark run`
process active that might occupy Cockpit's default port.
2019-11-05 10:22:11 -05:00
Pascal Precht abe79c87f4 fix(@embark/cockpit): ensure correct data is send to web3's `ecRecover` (#2024)
We've introduced a regression in https://github.com/embark-framework/embark/commit/f9557d4c9 where invalid data
has been sent to web3's `ecRecover()` method to verify signed messages.

This causes an internal server error and the utility feature inside Cockpit
unsuable.

This commit ensures that the correct data is sent to `ecRecover()` making verifying
messages through Cockpit functional again.
2019-11-05 10:21:43 -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