Commit Graph

866 Commits

Author SHA1 Message Date
Iuri Matias 57fbe45af5 support selecting library to generate artifacts 2020-02-20 14:38:51 -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
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
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 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
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
Jonathan Rainville 78fc7b6a90 fix(@embark/ens): fix tests erroring on FIFS contract deploy
Was caused by the contract being added in case another contract uses
it as a dependency, but it automatically tried to deploy with it, so
instead, set it as `deploy: false` until we see if we need to
register it
2020-02-06 13:17:20 -05:00
emizzle d5294203b7 fix(@embark/contracts-manager): Remove `logger` from serialized contract
For all instances where a `Contract` instance is serialized using `JSON.stringify`, the `logger` property was being stringified and written to logs and contract artifact files.

Add Serializer class that allows ignoring of class properties during serialization when using `JSON.stringify`.

NOTE: The `Serializer` relies on TypeScript’s decorators which are still listed as experimental (requiring the necessary compiler flag) despite being around for several years. Decorators are a stage 2 proposal for JavaScript.
2020-02-06 12:37:29 -05:00
Jonathan Rainville de0102223d feat(@mbark/ens): enable the use of $accounts in registrations
Enable putting `$accounts[i]` in subdomain registrations, where `i`
is the index of the `getAccounts` array.
This is the same behaviour we have for contract deployement
2020-02-06 12:36:36 -05:00
EmbarkBot a71211e863 chore(prerelease): 5.1.2-nightly.1 2020-02-06 00:11:14 +00:00
Pascal Precht 88c8135d9c refactor(core/engine): make serviceMonitor a module group
`Engine`s internal `coreComponents()` API sets up a bunch of things like
a `ProcessManager` and the `ServiceMonitor`. The `ServiceMonitor` activates
itself on `embark:engine:started` and practically monitors registered services
until the process has been explicitly stopped.

There are some commands that don't actually need service monitoring like `build` and
a future `exec` command that's in the making. For those cases it's useful to have them
disable the service monitor when `coreComponents()` is used.

This commit moves the `ServiceMonitor` instantiation out of `coreComponents()` and introduces
a new module group instead. This then lets commands that need service monitoring instantiate it
explicitly.
2020-02-05 13:47:18 +01:00
EmbarkBot d4136ffa8a chore(prerelease): 5.1.2-nightly.0 2020-02-05 00:12:23 +00:00
Jonathan Rainville 5359cc63da fix(@embark/cmd-controller): exit build if afterDeploy is not array
Before, `embark build` would wait at the end if there was an
afterDeploy, because there was no way with the old string and array
syntax to know when the commands were done.
Now, with the function syntax, we can wait for the end.
This way, we can exit the build at the end if it is a function
afterDeploy.
Otherwise, we show a message saying that they should update
2020-02-04 12:46:49 -05:00
Jonathan Rainville f502650c17 fix: only show account warning when Geth will actually start
Before, we checked if the network was a testnet or mainnet and
warned if there were no account sconfigured to sync. However, that
didn't take into account that we could connect to an external node,
hence not starting Geth at all.
So to fix that, I moved the condition and message to the Geth module
and only log when we start the node and the condition is met.
2020-02-04 12:45:32 -05:00
Michael Bradley, Jr 63831f6110 fix(@embark/dashboard): update dashboard's `logEntry` to match core/logger's `logFunction`
`packages/embark/src/cmd/dashboard/dashboard.js` overwrites the logger
instance's `logFunction` method with a method named `logEntry` defined on the
class exported from `packages/embark/src/cmd/dashboard/monitor.js`. Update
`logEntry` in the same way as `logFunction` was revised in #2184.
2020-02-04 11:30:45 -06:00
Michael Bradley, Jr 5b988ead7a refactor(@embark/core): refactor logger to provide correct origins
Also make a few more revisions:

Revise the "write logs" testing strategy such that it's not necessary for the
logger functions to take an optional callback.

Drop unused `tmp` package from `packages/core/logger` since it's not used in
the tests.

Strip colors before writing to the log file, use a two-space delimiter between
sections of each logged line in the log file, and collapse whitespace in the
message section of each line. These changes make the log file more amenable to
being processed with cli tools such as awk, cut, etc. It's also possible in a
text editor to replace `'  '` with `\t` and then load the file in a spreadsheet,
with each line-section in its own column.

Rearrange the sections of each logged line so that it's easier to read, and
only include the origin if the loglevel is debug or trace.
2020-02-03 20:47:23 -06:00
Pascal Precht 60cbb9fa3e refactor(@embark/core): make logger async when writing to log file 2020-02-03 20:47:23 -06:00
Pascal Precht 8c9e6b11c8 refactor(@embark/core): refactor logger to use modern JS APIs
This also removes `parseLogFile()` as it's not used anywhere inside Embark.
2020-02-03 20:47:23 -06:00
Pascal Precht 6b4052ee7b test(@embark/core): add tests for logger module 2020-02-03 20:47:23 -06:00
Michael Bradley, Jr 110957f273 chore(release): 5.1.1 2020-02-03 13:59:08 -06:00
Michael Bradley, Jr 030fb4acc6 build(deps): bump web3[-*] from 1.2.4 to 1.2.6
Remove `bignumber.js` workaround (in the root, from PR #2152) because it's no
longer needed (verified locally).

Remove the `"skipLibCheck"` workaround (in `packages/plugins/solidity-tests`,
from PR #2152) because it's no longer needed (verified locally).

Refactor a typing in `packages/plugins/geth`. What's happening is that in web3
v1.2.4 `sendTransaction` has a return type of `PromiEvent<TransactionReceipt>`
but in v1.2.6 it has a return type of `PromiEvent<TransactionReceipt |
TransactionRevertInstructionError>`.

Compare:
* [v1.2.4/packages/web3-eth/types/index.d.ts#L291-L294](https://github.com/ethereum/web3.js/blob/v1.2.4/packages/web3-eth/types/index.d.ts#L291-L294)
* [v1.2.6/packages/web3-eth/types/index.d.ts#L295-L298](https://github.com/ethereum/web3.js/blob/v1.2.6/packages/web3-eth/types/index.d.ts#L295-L298)

The problem is that the `TransactionRevertInstructionError` type doesn't have a
`transactionHash` property. Since at present the code in
`packages/plugins/geth/src/devtxs.ts` only deals with the success case re:
`sendTransaction`, import the `TransactionReceipt` type from `web3-eth` and
cast the resolved return value's type using TypeScript's `as` operator.
2020-02-03 10:17:07 -06:00
Jonathan Rainville 5fc96c089f chore(@embarkens): update ENS Registry mainnet address
Change address to the updated one because of a flaw found in the old
2020-02-03 09:34:11 -06:00
Michael Bradley, Jr 7b16e834e5 build(deps): remove unused package node-http-proxy-json 2020-02-03 09:26:06 -06:00