Commit Graph

6113 Commits

Author SHA1 Message Date
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
Jonathan Rainville c920bd5e14 chore(@embark-site): add all links to status network projects 2019-11-22 11:18:39 +01:00
Robin Percy ae16b65eb4
article: Nim vs Crystal article #2 2019-11-22 10:29:48 +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
Robin Percy 41e351b961
article: blog post - nim vs crystal part 1 2019-11-19 09:58:55 +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
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
Pascal Precht 7c5d662772 fix(@embark/site): ensure fathom script is only loaded in production environment 2019-11-18 08:59:56 -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
Jakub Sokołowski 7088c957a8 add Fathom Analytics JS to the site
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-11-14 15:52:16 +01: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
Pascal Precht 3f4e12aa0f fix(@embark/dapps): add missing constructor argument in contracts config 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
dependabot-preview[bot] 2a2261e856 build(deps): bump hexo-generator-feed from 2.0.0 to 2.1.0 in /site
Bumps [hexo-generator-feed](https://github.com/hexojs/hexo-generator-feed) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/hexojs/hexo-generator-feed/releases)
- [Commits](https://github.com/hexojs/hexo-generator-feed/compare/2.0.0...2.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-13 11:03:11 -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 1c44a52027 build(deps-dev): satisfy eslint peer dependency in monorepo root 2019-11-08 14:57:56 -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
Pascal Precht 92f6dd4ce9 fix(@embark/dapps): add missing Smart Contract configurations
Those had been removed in a refactor while the Smart Contract sources have been
kept around, resulting in deployment errors as Embark doesn't know what to do
with the Smart Contracts that don't come with a dedicated config.

This commit re-adds the configurations to make the deployment pass again.
2019-11-06 13:16:44 +01: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
Pascal Precht bad22075ca fix(@embark/templates): ensure boilerplate template comes with valid whisper port
As part of the refactor in e330b338ea we've introduced a
second geth client process to enable whisper functionalities in DApps.
This introduced also a new default port for whisper (e330b338ea (diff-a61fbc84e4172487789d676437f26b5fR14)).
This default port has not been introduced on our boilerplate template which is
used in `embark new` when developers scaffold new apps.

This resulted in runtime errors where the geth process for whisper wasn't
able to successfuly boot up as its configured port address is already in use:

```
geth exited with error code 1
geth exited with error code 1
Blockchain process ended before the end of this process. Try running blockchain in a separate process using `$ embark blockchain`. Code: null
```

This commit changes the default port for whisper in the boilerplate template
to ensure apps created using `embark new` don't run into this error anymore.
2019-11-05 10:57:14 -06:00