Several `embarkjs-*` packages specify a `"test":` script in their respective
`package.json` files but lack any tests, causing `yarn test` in the root of the
monorepo to fail. For now, disable those scripts.
Add support for `service blockchain on/off` in the console.
Add service on/off command for each process started by, ie `service blockchain on/off` and `service whisper on/off`.
`service blockchain off` - Kills the blockchain process, stops the web3 provider, and shuts down the proxy (if used). In the case of `embark blockchain`, the entire process is exited.
`service blockchain on` - Starts the blockchain process *as a child process of the main embark process* then starts the web3 provider. This happens regardless of whether or not it was initially started with `embark blockchain` (see known issues).
## Known issues
1. If the blockchain process was started with `embark blockchain`, and then the blockchain process is killed with the `service blockchain off` command, when the blockchain process is restarted with `service blockchain on`, it will be restarted as a child process of the main embark process. It may be possible to allow for the blockchain process to be restarted in the same process it was originally started in, however this will take more development effort and can be handled in a different PR.
2. Parity has not been tested as it is currently not working in the master branch.
3. This PR adds a generic registration of commands for each process, ie `service whisper on/off`, however the only supported command is the `service blockchain on/off` command. Further support for other commands can be handled in separate PRs.
Errors emitted as part of the `deployAll()` routine got swallowed by
Embark, leaving users in the unknown when the deployment process
"froze".
This commit ensures errors emitted are now logged, making it obvious
when something went wrong.
This commit introduces a feature where users can specify which files should be removed
as part of Embark's `reset` command.
This is done by specifying the `options.reset` section in a project's `embark.json`.
The possible options are `defaults: bool` and `files: Array<String>`:
```
// embark.json
{
...
"options": {
"reset": {
"defaults": true,
"files": ["some.file", "some/other.file"]
}
}
}
```
`defaults` tells Embark whether or not it should remove the default files that are
defined by the `reset` command. Setting it to `false` will prevent Embark from
removing any of these (mostly files located inside `.embark`).
This gives users fine control as they now can re-add subsets or those file paths
in the `files` property.
If `options.reset` doesn't exist Embark will do the default behaviour, which is
is simply resetting/removing the files it has always removed.
It now also honors `generationDir` and `buildDir` as part of the defaults.
`webSocketProcess` function in `embark-api-client` expects only a process name,
but cockpit was calling it with name-strings prepended with `/process-logs/`
resulting in bad URLs. Revise cockpit's `services/api` module to call
`webSocketProcess` with process names only.
Embark API server's development proxy from port 55555 to 3000 was attempting to
inappropriately forward an `/embark-api/` endpoint for the blockchain process
logs to Create React App's development server. Why it was only happening for
the one endpoint is not known but probably has to do with timing around
registration of the API server's express routes.
The problem can be fixed with a one-line `filter:` function in the options for
`express-http-proxy`. However, it was realized that to fix an unrelated
problem, whereby the proxy doesn't forward websockets to CRA such that hot
reload doesn't work when accessing `embark-ui` in development on port 55555, a
switch to `http-proxy-middleware` would be required. That was quickly
attempted (easy switch) but there are outstanding [difficulties][bug] with
`webpack-dev-server` and `node-http-proxy` that cause CRA to crash.
Switch strategies and refactor the API module to serve a page on port 55555 (in
development only) that alerts the developer `embark-ui` should be accessed on
port 3000. The page redirects (client-side) after 10 seconds, with URL query
params and/or hash preserved. A future version could instead do client-side
polling of port 3000 with `fetch` and then redirect only once it's
available. The reason for not redirecting immediately is that the intermediate
page makes it more obvious what needs to be done, e.g. CRA dev server may need
to be started with `yarn start`.
[bug]: https://github.com/webpack/webpack-dev-server/issues/1642
This commit enables new `beforeDeploy` deployment hooks. With this change
it's possible to add `beforeDeploy` to either `contracts: {}` within the contracts
configuration, or an individual contract.
For example:
```
contracts: {
SimpleStorage: {
beforeDeploy: async (context) => {
}
}
}
```
Runs the hook before `SimpleStorage` will be deployed. Whereas
```
contracts: {
...
beforeDeploy: async () => {
}
}
will be executed before *all* Smart Contracts will be deployed.
This will allow users to generated deploy hook specific output using the supplied `logger` within deployment hooks.
The logger will generate an output a la:
```
ContractName > deploymentHook > Output
```
and
```
afterDeploy > Output
```
respectively.
E.g. an `onDeploy` hook config like this:
```
contracts: {
SimpleStorage: {
fromIndex: 0,
args: [100],
onDeploy: (context) => {
context.logger.log('Hello from on deploy');
}
}
}
```
Will output:
```
SimpleStorage > onDeploy > Hello from on deploy
```
Support embarkjs-whisper with external pipeline.
`embarkjs-whisper` is required by code that is through the VM, and therefore the `embark` package needs to be able to resolve `embarkjs-whisper`.
Create a dev tx (a 0-value tx that is sent from the —dev account to itself) when a request goes through the proxy, but does not get a response after 5 seconds.
Log requests to disk (when log level is trace - enabled with the embark option `—loglevel trace`) that have not received a response and for which a dev tx has been sent.
Add logging to a `proxyLogs.json` log file as well, so that this information can be gleaned later for debugging purposes.
This particular PR Is meant to workaround an issue with running geth with the `—dev` option, as some transactions appear to get stuck, which then builds up further txs in a queue. Only when another tx is sent is the queue then purged as expected.
The remaining issue is that even though a dev tx is sent to relieve the queued txs, the originally offending tx still never receives a response from the node. This was the motivation behind creating a proxy log, so that a dev can inspect the txs that are essentially dropped.
**NOTE:** the base branch of this branch is `refactor/devfunds`. Please merge that branch first.
Change name “DevFunds” to “DevTxs”.
Remove unused functions in dev_funds (create accounts, unlock accounts, fund accounts).
Add console command `sendtx` to send a one-off dev transaction.
Modify the dev tx to send a 0-value tx to itself (ie the `web3.eth.defaultAccount` which is the `—dev` account).
Deprecate the command `regularTxs on/off` in favour of `devtxs on/off` (notice the casing).
Strip regulartxs from cockpit and modify the browser warning to instruct users to run a console command.
This commit has been originally cherry-picked from d0d89fc5ae and
slightly modified to update all packages, as meanwhile, new packages have been added to `master`.
The reason this commit is cherry-picked from `4.0.x` branch is because
it wasn't created from `master`.
Purpose is mainly to update `CHANGELOG` and get the package versions in sync again.
Display five contracts per page in the dashboard. Display ten contracts per
page in the contracts explorer and deployment page.
Sort contracts by name. In the future we can implement an option to sort by
block number and index within a block by calculating and including that
information as part of the server-side api response (based on a contract's
txhash).
Remove unnecessary contract filtering in the components since the containers
take care of it.
Make use of `listenToContracts` / `stopContracts` in DeploymentContainer.
feature(@embark/embarkjs-whisper: make embarkjs whisper plugin a module on its own
feature(@embark/embarkjs-whisper: make embarkjs whisper plugin a module on its own