Commit Graph

6283 Commits

Author SHA1 Message Date
Pascal Precht 794c7d5f24 test(stack/contracts-manager): add missing unit and API tests 2020-02-26 15:14:49 -05:00
Pascal Precht 4106a49379 feat(utils/testing): make mock apiCall() async
This is needed because API handlers are potentially async as well.
2020-02-26 15:14:49 -05:00
Pascal Precht 1a56d5f792 fix(utils/testing): ensure API mock works with `req.params` and method chaining 2020-02-26 15:14:49 -05:00
Pascal Precht 62a229198b fix(utils/testing): ensure runActionsForEvent() works without params object 2020-02-26 15:14:49 -05:00
Pascal Precht ef1ec3a606 refactor(utils/testing): expose `registerAPICall()` on testbed plugins 2020-02-26 15:14:49 -05:00
Pascal Precht 0ba8d86ea7 fix(utils/testing): add missing trace() API logger in testbed 2020-02-26 15:14:49 -05:00
EmbarkBot c54cc77e01 chore(prerelease): 5.2.4-nightly.0 2020-02-26 00:14:00 +00:00
dependabot-preview[bot] 56d360d7d7 build(deps-dev): bump @babel/plugin-proposal-nullish-coalescing-operator
Bumps [@babel/plugin-proposal-nullish-coalescing-operator](https://github.com/babel/babel) from 7.7.4 to 7.8.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.7.4...v7.8.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-25 17:41:05 -06:00
dependabot-preview[bot] 0a8b11f37c build(deps): bump @babel/plugin-proposal-class-properties
Bumps [@babel/plugin-proposal-class-properties](https://github.com/babel/babel) from 7.7.4 to 7.8.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/compare/v7.7.4...v7.8.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-25 16:42:13 -06:00
dependabot-preview[bot] 6cba7af03a build(deps-dev): bump jest from 24.9.0 to 25.1.0
Bumps [jest](https://github.com/facebook/jest) from 24.9.0 to 25.1.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v24.9.0...v25.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-25 16:12:54 -06:00
Michael Bradley, Jr 8e945a2caa chore(release): 5.2.3 2020-02-25 15:09:29 -06:00
Michael Bradley, Jr 3693ebd90d fix: ensure that packages properly specify their dependencies
Many packages in the monorepo did not specify all of their dependencies; they
were effectively relying on resolution in the monorepo's root
`node_modules`. In a production release of `embark` and `embark[js]-*` packages
this can lead to broken packages.

To fix the problem currently and to help prevent it from happening again, make
use of the `eslint-plugin-import` package's `import/no-extraneous-dependencies`
and `import/no-unresolved` rules. In the root `tslint.json` set
`"no-implicit-dependencies": true`, wich is the tslint equivalent of
`import/no-extraneous-dependencies`; there is no tslint equivalent for
`import/no-unresolved`, but we will eventually replace tslint with an eslint
configuration that checks both `.js` and `.ts` files.

For `import/no-unresolved` to work in our monorepo setup, in most packages add
an `index.js` that has:

```js
module.exports = require('./dist'); // or './dist/lib' in some cases
```

And point `"main"` in `package.json` to `"./index.js"`. Despite what's
indicated in npm's documentation for `package.json`, it's also necessary to add
`"index.js"` to the `"files"` array.

Make sure that all `.js` files that can and should be linted are in fact
linted. For example, files in `packages/embark/src/cmd/` weren't being linted
and many test suites weren't being linted.

Bump all relevant packages to `eslint@6.8.0`.

Fix all linter errors that arose after these changes.

Implement a `check-yarn-lock` script that's run as part of `"ci:full"` and
`"qa:full"`, and can manually be invoked via `yarn cylock` in the root of the
monorepo. The script exits with error if any specifiers are found in
`yarn.lock` for `embark[js][-*]` and/or `@embarklabs/*` (with a few exceptions,
cf. `scripts/check-yarn-lock.js`).
2020-02-25 14:52:10 -06:00
EmbarkBot ad19b9b8dc chore(prerelease): 5.2.3-nightly.1 2020-02-25 00:14:49 +00:00
Jonathan Rainville e99a32887d fix(cmd-controller): fix build --contracts command starting comm node
Fixes https://github.com/embarklabs/embark/issues/2288
Only start a blockchain node when there is no --contracts flag and
start only needed modules for compilation
2020-02-24 16:49:02 -05:00
EmbarkBot 584845b220 chore(prerelease): 5.2.3-nightly.0 2020-02-20 00:14:55 +00:00
Pascal Precht d3200e333d fix: revert custom `deploy()` API for `EmbarkJS.Contract`
`.deploy()` is an alias to `.new()` and in other tools also no longer used
as API to deploy instances. In addition, we don't want it to shadow the
original web3 `deploy()` API which actually caused a breeaking change.
2020-02-19 11:25:20 -05:00
Jonathan Rainville 0461fa01e0 fix(@embar/site): fix proxyFor docs
Change to smart contract and fix forProxy -> proxyFor
2020-02-19 09:16:41 -05:00
Michael Bradley, Jr e271cebbe3 chore(release): 5.2.2 2020-02-18 19:06:59 -06:00
Iuri Matias 45e90f33ac fix(@embark/core): fix templates not including embark as a dependency 2020-02-18 19:55:45 -05:00
Michael Bradley, Jr f27d77005d chore(release): 5.2.1 2020-02-18 14:15:09 -06:00
Jonathan Rainville 37fbc80e40 fix(@embark/ganache): fix status when ganache is not the client
We registered the status check for Ganache even when Ganache was not
the client
2020-02-18 14:14:19 -05:00
Michael Bradley, Jr f5db3f61b6 chore(release): 5.2.0 2020-02-18 11:45:33 -06:00
Jonathan Rainville caae92281d fix(@embark/proxy): only up event listeners on available providers
Only the  Ganache provider has the setMaxListener
2020-02-18 11:40:49 -05:00
EmbarkBot e5b15c3342 chore(prerelease): 5.2.0-nightly.5 2020-02-18 00:14:02 +00:00
Jonathan Rainville 9c8837d3cd fix(@embark/proxy): up max listener for proxy request manager
fix(@embark/proxy): up max listener for proxy request manager

In the tests, we had warnings about max listeners reached, because
the default limit is 10. So I upped the limit for the request
manager and the WS connection.

stoopid CI
2020-02-17 17:58:37 -05:00
Jonathan Rainville 5531b60f10 fix(@embark/ganache): fix connection to other nodes from Ganache
Using tests with a custom --node didn't work, because Ganache always
used it's own provider. Now, it actually checks before if there is
not another node started before using its own provider (+1 squashed commits)
2020-02-17 17:58:37 -05:00
EmbarkBot b4286bf59a chore(prerelease): 5.2.0-nightly.4 2020-02-15 00:15:19 +00:00
Michael Bradley, Jr 2bbf685bab style: enable Solidity syntax highlighting on GitHub 2020-02-14 09:43:28 -06:00
Jonathan Rainville cd934f8157 feat(@embark/blockchain): make GanacheCLI the default dev blockchain
Set Ganache as a blockchain client that doesn't need to be started.
Set it as the default client, at least for development.
Move all blockchain related stuff in the blockchain component
Includes a fix by @emmizle to fix the WS connection in the proxy
2020-02-14 09:14:45 -05:00
Jonathan Rainville b2f670ba46 docs(@embark/contracts-config): add docs for proxyFor 2020-02-14 08:27:34 -05:00
Jonathan Rainville 2e8b2554df feat(@embark/contracts): add proxyFor property for contracts
Requested here https://github.com/embarklabs/embark/issues/1689
Adds proxyFor to contracts that merges the ABI of the parent
contract to the child (proxy)  contract so that the proxy can use
the methods of the parent but is deployed as itself
2020-02-14 08:27:34 -05:00
EmbarkBot 414de52203 chore(prerelease): 5.2.0-nightly.3 2020-02-14 00:14:39 +00:00
Pascal Precht bfeec5d43a chore(stack/contracts-manager): update dependencies 2020-02-13 14:44:40 -05:00
emizzle a7693c0e53 chore(@embark/pipeline): Update pipeline dependencies and add tests
Update `embark-pipeline` dependencies.

Add unit tests for `embark-pipeline`.

Update Embark testing framework to include assertion testsing for API calls and event actions.
2020-02-13 13:08:36 -05:00
Iuri Matias d14e93ceb1 feat: warn about packages not configured as plugins; make geth/parity full plugins
feat(@embark/utils): add method to verify if a plugin is installed & configured

feature(@embark/utils): add method to verify if a plugin is installed & configured

feature: warn about packages that will be independent plugins and are not configured

chore: update templates to specify plugins

refactor: add to plugin api params so that blockchain plugins no longer need to be passed options

address changes in code review

remove unneded space

Update packages/core/utils/src/index.ts

Co-Authored-By: Jonathan Rainville <rainville.jonathan@gmail.com>

Update packages/core/utils/src/index.ts

Co-Authored-By: Michael Bradley <michaelsbradleyjr@gmail.com>

fix linting issue

add missing import

update dependency

fix plugins object

add missing whitespace
2020-02-13 11:48:43 -05:00
Jonathan Rainville 0016581225 fix(@embark/deployment): fix undefined in nb arguments in deploy
This is caused by web3 using the method name to show which method
doesn't have the right number of arguments, but the constructor does
not have a name
2020-02-13 10:19:42 -05:00
Pascal Precht b4b4848913 fix(stack/contracts-manager): ensure custom `abiDefinition` is set properly if provided
Turns out that 17cec1b787 has never worked as intended.
Custom provided `abiDefinition` values have been simply ignored. Embark always used the
`abiDefnition` that resulted from the Smart Contract compilation.
2020-02-13 11:12:06 +01:00
emizzle e9be40c289 fix(@embark/logger): Remove `writeToFile` for logger `dir`
When using `dir` in the logger, do not write this value to the log file, and instead only print the output to the screen
2020-02-13 10:21:23 +01:00
EmbarkBot 1a4f63df7e chore(prerelease): 5.2.0-nightly.2 2020-02-13 00:14:05 +00:00
Pascal Precht 40c3d98217 feat(plugins/scripts-runner): introduce exec command to run scripts
This commit introduces a new feature that enables users to run (migration) scripts.
Similar to deployment hooks, scripts are functions that may perform operations on newly
deployed Smart Contracts.

Therefore a script needs to export a function that has access to some dependencies:

```
// scripts/001-some-script.js

module.exports = async ({contracts, web3, logger}) => {
  ...
};
```

Where `contracts` is a map of newly deployed Smart Contract instances, `web3` a blockchain connector
instance and `logger` Embark's logger instance. Script functions can but don't have to be `async`.

To execute such a script users use the newly introduced `exec` command:

```
$ embark exec development scripts/001-some-script.js
```

In the example above, `development` defines the environment in which Smart Contracts are being
deployed to as well as where tracking data is stored.
Alternativey, users can also provide a directory in which case Embark will try to execute every
script living inside of it:

```
$ embark exec development scripts
```

Scripts can fail and therefore emit an error accordingly. When this happens, Embark will
abort the script execution (in case multiple are scheduled to run) and informs the user
about the original error:

```
.. 001_foo.js running....
Script '001_foo.js' failed to execute. Original error: Error: Some error
```

It's recommended for scripts to emit proper instances of `Error`.

(Migration) scripts can be tracked as well but there are a couple of rules to be aware of:

- Generally, tracking all scripts that have been executed by default is not a good thing because
  some scripts might be one-off operations.
- OTOH, there might be scripts that should always be tracked by default
- Therefore, we introduce a dedicated `migrations` directory in which scripts live that should be
  tracked by default
- Any other scripts that does not live in the specified `migrations` directory will not be tracked **unless**
- The new `--track` option was provided

For more information see: https://notes.status.im/h8XwB7xkR7GKnfNh6OnPMQ
2020-02-12 16:47:04 -06:00
Michael Bradley, Jr 0f59e0c216 fix(core/config): Fix `EmbarkConfig` type 2020-02-12 17:12:31 -05:00
Pascal Precht b021689387 feat(@embark/test-runner): introduce artifacts.require API
This commit adds a convenience API `artifacts.require(name)` that aims to make
requiring artifacts a little bit more straight forward.

Usage:

```
const SimpleStorage = artifacts.require('SimpleStorage');
const EmbarkJS = artifacts.require('EmbarkJS');
```
2020-02-12 14:17:30 -05:00
Andre Medeiros 70313352a5 fix: set helper methods on contracts
Set these up so we can call `deploy`, `at`, and `new` on contract
classes.
2020-02-12 14:14:13 -05:00
Pascal Precht d6d6a16169 chore: remove version switcher from docs layout 2020-02-12 10:02:22 +01:00
EmbarkBot e29a93bde5 chore(prerelease): 5.2.0-nightly.1 2020-02-08 00:12:06 +00:00
Jonathan Rainville 5592753116 fix(@embark/blockchain-api): add back contract event listen and log
Adds back the watch on contract events and writes them to a file
with the same method as contract logs from transaction-logger, so
I extracted those methods to utils/file so that both could use the
same functions.
2020-02-07 14:24:03 -05:00
Jonathan Rainville 87a04cd5db fix(@embark/contracts-manager): always deploy contracts with deploy: true
This was an issue experienced with ENS contracts not being deployed
because the configs used `strategy: explicit` and ENS configs are
not in configs.
To fix, I changed the way we check for deploy. If `deploy` is set as
`true` it should always deploy even if not in configs. It just means
they were added from a plugin (like ENS)
Also, I needed to set to `false` the `deploy` property of contracts
compiled that were not in config, because otherwise, they tried to
deploy, which goes against the strategy. This is because those
contracts get initiated as `deploy: true`.
2020-02-07 14:23:45 -05:00
Jonathan Rainville 0e30bf3926 fix(@embark/test-runner): fix reporter to only catch gas for txs
Before, we added the gas for all receipts that came in because they
had a `gasUsed`, instead of adding the gas for receipts that came
with a transaction
2020-02-07 14:20:31 -05:00
EmbarkBot a016fa8fb9 chore(prerelease): 5.2.0-nightly.0 2020-02-07 00:12:17 +00:00
Pascal Precht 3e3b4287a4 chore(stack/deployment): update dependencies 2020-02-06 13:19:10 -05:00