Commit Graph

77 Commits

Author SHA1 Message Date
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
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
Pascal Precht 3f4e12aa0f fix(@embark/dapps): add missing constructor argument in contracts config 2019-11-14 12:28:41 +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 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
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
Jonathan Rainville 95b5ae48c6 fix(@embark/accounts-manager): limit funding accounts to 1 at a time 2019-11-08 08:46:32 -05: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
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
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
Jonathan Rainville fe3e604fec fix(@embark/test-runner): fix test contracts being tracked 2019-10-30 12:39:21 -05:00
Michael Bradley, Jr 85235f88b2 chore(release): 5.0.0-alpha.0 2019-10-28 16:05:13 -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
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
Jonathan Rainville d86c26d71a Fix VM as a client and cleanup template configs (#1966)
* chore(templates): clean up template configs

* fix: enable vm as a client

Bug was caused by the web3 listening to events too late (race)
2019-10-14 10:42:13 +09:00
Jonathan Rainville c54b8d9e44 feat: call action before starting the blockchain node 2019-10-04 10:12:16 -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
Iuri Matias e330b338ea
Fix/whisper communication (#1895)
* fix(@cockpit/utils): make communications tab work again

* fix whisper node start; fix whisper console api registration; fix/refactor whisper web api
2019-09-11 14:21:53 -04:00
Jonathan Rainville ee634c8403 fix: fix test-app, contracts index file and reload on change (#1892)
* fix: fix test-app, contracts index file and reload on change

* fix(@embark/cmd_controller): fix missing nodes

Was removed by accident

* feat(@embark/demo): add favicon to embark demo

* chore(@embark/cockpit): change favicon to new Embark logo

* fix(@embark/embarkjs-ens): fix ENS config for embarkjs-ens

* remove comments
2019-09-11 12:31:57 -04: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 718d19f7d3
re-add embarkjs generation (#1858)
* fix embarkjs generation

fix ens setProvider

fix embarkjs objects

fix generated embarkjs provider

generate contracts

fix embarkjs-ens

* address some of the issues in the code review

* address some of the issues in the code review

* address some of the issues in the code review

* address some of the issues in the code review
2019-09-05 16:04:52 -04:00
Michael Bradley b736ebefcd refactor: initial steps toward 5.0.0-alpha.0 (#1856)
BREAKING CHANGE:

There are more than several breaking changes, including DApp configuration for
accounts.
2019-08-30 16:50:20 -04:00
Michael Bradley, Jr 706e43c9c5 chore(release): 4.1.1 2019-08-28 14:52:21 -05:00
Jonathan Rainville dd07f6713a fix(@embark/demo): add back lights 2019-08-27 20:58:22 -05:00
Michael Bradley, Jr 190d8de5f8 build(deps-dev): in dapps/tests/app bump bootstrap back to 3.4.1 2019-08-26 09:41:27 -05:00
Michael Bradley, Jr 6a64124e13 build(deps-dev): bump react-dom to 16.9.0 2019-08-26 09:41:27 -05:00
dependabot-preview[bot] 97cc709d7f build(deps-dev): bump react from 16.7.0 to 16.9.0
Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) from 16.7.0 to 16.9.0.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v16.9.0/packages/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-26 09:41:27 -05:00
Jonathan Rainville 844e8ca55f Fix demo style and improve (#1818)
* fix(@mbark/embarkjs): enable using wss in embarkjs and the Dapp

* fix(@embark/demo): fix demo style by and improvise

* update yarn.lock. CI please be gentle
2019-08-23 11:51:03 -04:00
dependabot-preview[bot] dca6342330 build(deps): bump rimraf from 2.6.3 to 3.0.0
Bumps [rimraf](https://github.com/isaacs/rimraf) from 2.6.3 to 3.0.0.
- [Release notes](https://github.com/isaacs/rimraf/releases)
- [Changelog](https://github.com/isaacs/rimraf/blob/master/CHANGELOG.md)
- [Commits](https://github.com/isaacs/rimraf/compare/v2.6.3...v3.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-20 13:44:24 -05:00
dependabot-preview[bot] 113ff0a00f build(deps-dev): [security] bump bootstrap from 4.1.2 to 4.3.1
Bumps [bootstrap](https://github.com/twbs/bootstrap) from 4.1.2 to 4.3.1. **This update includes a security fix.**
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](https://github.com/twbs/bootstrap/compare/v4.1.2...v4.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-19 09:15:34 -05:00
dependabot-preview[bot] e61921c43e build(deps-dev): [security] bump jquery from 3.3.1 to 3.4.0
Bumps [jquery](https://github.com/jquery/jquery) from 3.3.1 to 3.4.0. **This update includes security fixes.**
- [Release notes](https://github.com/jquery/jquery/releases)
- [Commits](https://github.com/jquery/jquery/compare/3.3.1...3.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-18 19:33:58 -05:00
dependabot-preview[bot] 80c7ff2264 build(deps-dev): [security] bump bootstrap from 3.3.7 to 4.1.2
Bumps [bootstrap](https://github.com/twbs/bootstrap) from 3.3.7 to 4.1.2. **This update includes security fixes.**
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](https://github.com/twbs/bootstrap/compare/v3.3.7...v4.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-18 19:33:25 -05:00
Michael Bradley, Jr 4b4a00bd4d chore(release): 4.1.0 2019-08-12 12:14:12 -05:00
Michael Bradley, Jr cda40b93c4 chore(release): 4.1.0-beta.6 2019-08-09 17:50:05 -05:00
Michael Bradley, Jr ad30a98169 refactor: upgrade to web3 v1.2.1
Upgrade all dependencies on web3/web3-* v1.0.0-beta.37 to v1.2.1.

Make various adjustments related to the previous convention of
`"web3": "1.0.0-beta"` in `embark.json` signifying that embark's own web3
dependency should be used in dapp builds.

Fix bugs in library manager, including a switch from using the
live-plugin-manager package to using npm in a child process to install
`"versions"` dependencies specified in `embark.json` when a specified version
doesn't match up with embark's own version for that package.

Avoid race conditions when installing `"versions"` by completing all installs
prior to starting other services. If an install fails, then after all the
installs have completed or failed the embark command will exit with error.

Change various comments and update docs to reflect the new default of web3
v1.2.1.
2019-08-07 11:01:23 -05:00
Jonathan Rainville c2094dbc49 fix(@embark/test-runner): fix describe in describe tests 2019-08-07 11:00:25 -05:00
Jonathan Rainville b5c81bd41a feat(@embark/pipeline): enable choosing which fields to filter out 2019-08-01 13:53:47 -04:00
Jonathan Rainville b0cccaea05 feat(@embark/pipeline): add minimalContractSize to remove bytecode 2019-08-01 13:53:47 -04:00
Jonathan Rainville 1491028665 use callbacks instead of exiting 2019-07-23 10:55:14 -04:00
Michael Bradley, Jr 5930cce7dd chore(release): 4.1.0-beta.5 2019-07-10 16:21:47 -05:00
Pascal Precht 93ca3ad97c fix(@embark/embarkjs-whisper): Messages.isAvailable() should always return a promise
`EmbarkJS.Messages.isAvailable()` in some cases return synchronously (when whisper isn't
set up), in other cases asynchronously. This actually breaks our demo application for
the following reason:

We check for Whisper's availability via:

```
EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => {
  if (err) {
    return console.log(err);
  }
  this.setState({whisperEnabled: true});
});
```

There's a couple of problems here:

- This code will break right away when whisper isn't available, resulting in an error:
  ```
  Cannot read property _requestManager of undefined
  ```

- The reason this error happens is because there's no `web3` object available inside
  our EmbarkJS.Messages code. Even though there **is** a web3 object, EmbarkJS.Messages
  doesn't know about this because it only sets it when its `setProvider()` API is called,
  which effectively doesn't happen at all when Whisper isn't enabled on the connected
  node

- While this could be fixed with a simple check on whether EmbarkJS.Messages' internal
  `web3` references is a thing, really what should be used in the demo is the `isAvailable()`
  API.

`isAvailable()` should always return a promise (similar to `EmbarkJS.Storage.isAvailable()`.

This commit ensures that `isAvailable()` always returns a promise and changes the demo
template to use `isAvailable()` over `getWhisperVersion()`.
2019-07-01 11:11:03 +02:00
Michael Bradley, Jr eecb48f5b6 chore(release): 4.1.0-beta.4 2019-06-27 14:23:32 -05:00
Pascal Precht 1b6987ee8f fix(@dapps/templates/demo): ensure whisper channel state is set correctly 2019-06-27 14:11:24 -05:00