Commit Graph

6134 Commits

Author SHA1 Message Date
Pascal Precht e37d3f73ff feat(@embark/test-runner): expose evmClientVersion for conditional tests
This commit introduces a new `global.getEvmVersion()` that can be used to
conditionally run tests, such as when tests rely on RPC APIs that are only
available in specific evm nodes.
2020-01-09 11:39:28 -05:00
emizzle 1e1172e86c fix(@embark/debugger): Prevent error if contract not tracked by Embark
Null check to prevent an error during automated debugging for failed transactions.
2020-01-09 11:37:25 -05:00
Pascal Precht 6797a8a9fc chore(@embark/proxy): suppress error logs when inside test-runner context
When running tests that expect the EVM to fail, Embark's proxy keeps logging
the VM errors to stdout making it look like tests weren't successful, while they
are actually passing.

Inside a test-runner it's probably expected not to see any error logs when the
tests in question expect errors.

This commit changes the proxy to use `debug()` logs instead of `error()`, making
it configurable through log verbosity how much errors are seen.
2020-01-09 11:36:18 -05:00
emizzle 5843a8e03e fix(@embark/transaction-logger): Circular JSON log and unknown contract log level
## Issue
Transaction logs for contracts that were unknown to Embark (ie not in the dapp) would often log super large objects (filling the terminal) that were not formatted with spaces so were hard to read without actually be that useful. In addition, occasionally the object logged would throw the error `TypeError: Converting circular structure to JSON`.

## Fix
Set the log level for transaction logs that are not from a known contract to `debug`, so that they do not flood the terminal with often usused information.

Use `util.inspect` to print the transaction log instead of `JSON.stringify` to prevent circular structure errors.
2020-01-09 11:34:43 -05:00
Bouzaine Chamsddine 6be404bc7f docs: updating copyrights to 2019-2020 2020-01-09 11:33:20 -05:00
Bouzaine Chamsddine fa49c3b3a4 docs: updating copyrights to 2020 2020-01-09 11:33:20 -05:00
Michael Bradley, Jr ba0d6d17f3 chore(release): 5.0.0 2020-01-07 12:14:37 -06:00
Pascal Precht a865bc3d6a
article: remove paragraph 2020-01-07 11:06:34 +01:00
Jonathan Rainville c8f86e55f0 fix(@embark/watcher): endless loop when artifacts are put in src
The problem was that putting the artifacts in src caused them to be watched
and thus creating an infinite loop, because a change in src triggers the build of the artifacts
This was fixed by ignoring the artifacts by chokidar, wherever they are
2020-01-06 10:46:33 -05:00
Michael Bradley, Jr 89dceabc2b site: hexo build of site automatically triggers version metadata update in site/package.json 2020-01-06 09:19:36 -06:00
dependabot-preview[bot] c3ee150f62 build(deps): bump hexo from 4.1.1 to 4.2.0 in /site
Bumps [hexo](https://github.com/hexojs/hexo) from 4.1.1 to 4.2.0.
- [Release notes](https://github.com/hexojs/hexo/releases)
- [Commits](https://github.com/hexojs/hexo/compare/4.1.1...4.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 09:18:22 -06:00
dependabot-preview[bot] 4c46e87edd build(deps-dev): bump eslint from 6.7.2 to 6.8.0 in /site
Bumps [eslint](https://github.com/eslint/eslint) from 6.7.2 to 6.8.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.7.2...v6.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 09:08:51 -06:00
dependabot-preview[bot] a5c6a9e170 build(deps): [security] bump handlebars from 4.2.0 to 4.3.0
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.2.0 to 4.3.0. **This update includes a security fix.**
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.2.0...v4.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 09:05:25 -06:00
Michael Bradley, Jr 902dba0c02 chore(release): 5.0.0-beta.0 2020-01-03 09:37:36 -06:00
emizzle 2295f94ae0 fix(@embark/snark): Allow dapp to have no contracts
If using `embark-snark` in the dapp as a plugin, and the dapp didn’t have any contracts, the `embark-snark` plugin would not simply exit early and essentially do nothing.

Fix `embark-snark` plugin so that it will run its routine regardless of whether or not the dapp has contracts or not.

Bump `circom` and `snarkjs` to their latest patch version.
2020-01-03 13:50:06 +01:00
Iuri Matias b02b7ec751 chore(release): 5.0.0-alpha.10 2019-12-24 15:27:23 -05:00
Michael Bradley, Jr 441db4fd18 bugfix(@embark/scaffolding): upgrade scaffolding so it can be used in embark v5
WIP: refactor so that embark-scaffolding can be used in embark v5

fix scaffold cmd

fix generated files path
2019-12-24 14:50:26 -05:00
emizzle 8f9f631758 fix(@embark/embarkjs): Fix event name misspelling
Fix misspelling in event name. This event is new to v5, so there is no deprecation or major version bump needed.
2019-12-24 12:59:10 -05:00
Michael Bradley, Jr d7a5686de5 site: hexo build of site automatically triggers version metadata update in site/package.json 2019-12-22 18:24:06 -06:00
dependabot-preview[bot] 4f3e9c7868 build(deps-dev): bump eslint-config-hexo from 4.0.0 to 4.1.0 in /site
Bumps [eslint-config-hexo](https://github.com/hexojs/eslint-config-hexo) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/hexojs/eslint-config-hexo/releases)
- [Commits](https://github.com/hexojs/eslint-config-hexo/compare/4.0.0...4.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-22 18:17:55 -06:00
emizzle 349b2691c3 fix(@embark/ens): Handle cases when no “register” in config
## Issue 1 - “register” section missing
When the “register” section of `namesystem.json` was missing, ENS would not deploy the ENS contracts nor create the contracts’ artifacts.

### Fix 1
Fix ENS deployment routine to always deploy the ENS contracts. In the case of testnet/mainnet, the contracts’ addresses will be known and therefore will be understood as “already deployed” by the contract deployer.

## Issue 2 - “register” section exists for non-dev environment
Additionally, if a root domain was specified in the “register” section and the DApp connected to an external node where we do not own the ENS contracts (ie testnet), attempting to register a root domain would not be possible as we do not own the ENS contracts.

### Fix 2
Fix ENS deployment routine to check if we are on a network in which we own the ENS contracts. If we are not, and we have specified a “register” section, print a warning to the user that the  registration will be ignored. Additionally, remove the “register” section.
2019-12-20 18:35:18 -05:00
Iuri Matias 472efbbf6e chore(release): 5.0.0-alpha.9 2019-12-20 18:13:47 -05:00
Iuri Matias e7059030fe chore(@embark/templates): remove embarkjs dependencies from test plugin 2019-12-20 17:13:48 -05:00
Iuri Matias 8fb502d777 chore(@embark/templates): add embarkjs dependencies to test apps 2019-12-20 17:13:48 -05:00
Iuri Matias 70333cd5d4 chore(@embark/templates): add embarkjs dependencies to templates
chore(@embark/templates): add embarkjs dependencies to templats

chore(@embark/templates): add embarkjs dependencies to templats
2019-12-20 17:13:48 -05:00
Jonathan Rainville 1e9b8d8595 fix(@embark/tests): fix slow embark test because of the tx-logger
The transaction-logger was slowing down tests because each Tx, it
would read a file and write to it, but that's slow and even got
slower as the file grew bigger
To fix, I removed the Tx-logger from text, along with the profiler
as they are useless for tests

(cherry picked from commit a656eea7dda83ad970615cffd51cce5d53a1d034)
2019-12-20 16:16:16 -05:00
Pascal Precht 765e889121 fix(@embark/coverage): ensure handlers for 'tests:finished' are run as actions
There was a race condition in which the coverage module tried to read a generated
coverage report before it was actually generated.
The issue was that the coverage generation was done on Embark's `tests:finished` event
in a fire and forget manner via `emit('tests:finished')` which doesn't
ensure control flow.
This commit changes it to use `runActionsForEvent('tests:finished')` instead and also
registers the handler for coverage report generation as action via `registerActionForEvent()`.

This ensures that those actions are run first, before the code moves on with other
operations that might rely on the result of any of those actions.
2019-12-20 16:11:48 -05:00
Michael Bradley, Jr dc0923b3a9 docs: add CHANGELOG.md entry for v4.2.0 into master
The release of v4.2.0 was done from the `4.2.x` branch, so it's necessary to
add it manually.
2019-12-20 10:46:31 -06:00
Michael Bradley, Jr 09e2dbe49d fix(@embark/cli): find ejectable webpack files within embark-basic-pipeline 2019-12-20 10:04:16 -06:00
Michael Bradley, Jr 7e550f0e6f build(deps): bump web3[-*] from 1.2.1 to 1.2.4
Refactor typings as necessary. In order for `bignumber.js` in the root
`node_modules` to not conflict with `@types/bignumber.js`, specify
`"bignumber.js": "5.0.0"` in `devDependencies` and `"embark-ui/bignumber.js"`
in `nohoist` of the root `package.json`.

In `packages/plugins/rpc-manager` switch from callback to promise usage with
respect to `web3.eth.accounts.signTransaction` because of a [bug][bug]
discovered in web3 v1.2.4.

In `packages/plugins/solidity-tests` specialize the tsc compiler options with
`"skipLibCheck": true` because of a problematic web3-related typing in the
`.d.ts` files of the remix-tests package.

Bump ganache-cli from 6.4.3 to 6.7.0 (latest) because 6.4.3 doesn't support
`eth_chainId` but web3 1.2.4 makes use of the `eth_chainId` RPC method (EIP
695).

BREAKING CHANGE: bump embark's minimum supported version of parity from
`>=2.0.0` to `>=2.2.1`. This is necessary since web3 1.2.4 makes use of the
`eth_chainId` RPC method (EIP 695) and that parity version is the earliest one
to implement it.

[bug]: https://github.com/ethereum/web3.js/issues/3283
2019-12-20 08:35:48 -06:00
Iuri Matias 4091296924 chore(release): 5.0.0-alpha.8 2019-12-19 14:14:23 -05:00
Jonathan Rainville 03bd49cf64 fix(@embark/rpc-manager): fix duplicated accounts in rpc manager
Was caused by the fact that each rpc-modifier got its own node
accounts, but once the eth_accounts modifier is enabled, the
"node" accounts are always going to contain the custom accounts too
Now, the node accounts are set once eth_accounts is initiated, so
that every modifier is on the same page
Also implement a second layer of protection to make sure that if a
duplication happens, it is gotten rid of
2019-12-19 11:19:03 -05:00
emizzle 6f49992d57 fix(@embark/cockpit): Remove loading from ENS util
Removed loading component from rendering as it was causing the ENS components to unmount and ultimately not show ENS results.
2019-12-19 10:22:27 -05:00
Iuri Matias f72d6f2915 chore(release): 5.0.0-alpha.7 2019-12-18 12:07:13 -05:00
Bouzaine chamsddine df9b66f845 docs: update site readme to the current repo 2019-12-18 11:23:25 -05:00
Pascal Precht fba4ccfee8 refactor(@embark/engine): move back to arrow functions and ...args
As discussed in https://github.com/embark-framework/embark/pull/2143#issuecomment-566671315
2019-12-18 11:22:45 -05:00
Jonathan Rainville 1201879bdc fix contract app test by increasing gas 2019-12-18 11:22:18 -05:00
Jonathan Rainville 1bc967c6d1 fix(@embark/rpc-manager): fix sign data address comparison
Did not check correctly for if the account is a node account
2019-12-18 11:22:18 -05:00
Jonathan Rainville 13312128b3 fix(@embark/mocha-tests): set accounts correctly on each contracts 2019-12-18 11:22:18 -05:00
Iuri Matias 5893bc38b9 chore(release): 5.0.0-alpha.6 2019-12-17 15:41:00 -05:00
emizzle aea2b6f97f fix(@embark/ens): Show ENS controls for Test DApp
For the test DApp, when ENS is enabled, ENS controls were not showing in Cockpit (under Utils), nor were they available to test in the DApp interface as they did not exist.

Fix ENS controls not showing in Cockpit when enabled.

Add ENS tab to Test DApp for ENS UI.
2019-12-17 13:48:06 -05:00
emizzle 7dfa2b939c fix(@embark/dapps): Contracts app test failure
During `embark test`, the contracts dapp was throwing an error:
```
connection not open on send()
Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (/Users/michael/repos/embark/node_modules/web3-core-helpers/src/errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (/Users/michael/repos/embark/node_modules/web3-providers-http/src/index.js:92:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
    at XMLHttpRequest._setReadyState (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
    at XMLHttpRequest._onHttpRequestError (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request.ts:379:8)
    at ClientRequest.<anonymous> (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request.ts:266:37)
    at ClientRequest.emit (events.js:198:13)
    at Socket.socketErrorListener (_http_client.js:392:9)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:75120) UnhandledPromiseRejectionWarning: Error: Provider not set or invalid
...
```

This was due to the fact that during testing, the Ganache VM **provider** is used as the blockchain node, instead of spinning up an instance of Ganache. Due to this, there is no HTTP nor WebSockets RPC endpoint opened on the VM node, and the contracts dapp was not able to connect to the node during tests.

Add `$EMBARK` to the contract config’s `dappConnection` list, so that the contract test dapp can successfully connect to Embark’s proxy, which ultimately communicates with the Ganache VM.

As a side note, without `$EMBARK` in the `dappConnection` list, the tests could run successfully when using `embark test —node=embark`. This succeeds because the geth node exposes the RPC WebSockets endpoint that the contracts app connects to on `ws://localhost:8546`.
2019-12-17 10:44:01 -05:00
Pascal Precht aa5121ae0d fix(@cockpit/contracts): ensure contract state is emitted in realtime
This fixes a bug that redeployment of contracts has not been properly
reflected in the cockpit contract list.

The reason for that was that it's listening for a websocket API that
only updates when the `contractsState` event has been emitted.

The commit ensures `contractsState` is emitted during dedicated deployment
events.
2019-12-17 10:43:32 -05:00
Pascal Precht 920b07853a fix(@embark/engine): ensure deployment hook logs don't produce unexpected output
Since ee56f37713, any deployment hook that
was using simple `console.log()` statements to output information, would result in
unexpected `[[object object], [object object]]`.

Unfortunately, the reason for that was that we switched from non-arrow functions to
arrow functions [here](ee56f37713 (diff-a7c4cef8bfebeb39fcd092aca5570fecL324-L340)). Usually switching from non-arrow functions to arrow functions solves
a lot of lexical scope issues where the current reference of `this` isn't pointing at the
right thing.

We're tempering with the global `console.log` inside Embark, which then, combined with
**proper** lexical scope, causes the output described above.

Generally there are a few ways to go about this:

1. Ensure that our custom log functions doesn't turn every log statement into an array output
2. Tell users not to use `console.log` inside deployment hooks and instead rely on `deps.logger`
3. Revert the changes made in the mentioned commit and use non-arrow functions inside `interceptLogs`

Option 2) is not really a solution as we can't simply tell our users that they can't use one of
the most used functions in JavaScript. Option 1) requires finding out why we're formatting logs
by default in an array shapre in the first place. On top of that, we might be relying on this
inside Embark, so it could break certain output.

Option 3) seems to be the most pragmatic solution for now as it doesn't introduce any of the
downsides mentioned above at the cost of using non-arrow functions.
2019-12-17 10:42:14 -05:00
dependabot-preview[bot] 80f189f103 build(deps): bump hexo from 4.0.0 to 4.1.1 in /site
Bumps [hexo](https://github.com/hexojs/hexo) from 4.0.0 to 4.1.1.
- [Release notes](https://github.com/hexojs/hexo/releases)
- [Commits](https://github.com/hexojs/hexo/compare/4.0.0...4.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-17 00:31:40 -06:00
Iuri Matias 78a06c9d76 chore(release): 5.0.0-alpha.5 2019-12-16 13:49:41 -05:00
Bouzaine Chamsddine 5b10a93edb docs: update improve the guide link to the new repo 2019-12-16 11:06:17 +01:00
Bouzaine Chamsddine 209baec7da docs: update the improve the guide link to the new repo 2019-12-16 11:06:17 +01:00
Iuri Matias fc4188d247 bugfix(@embark/parity): add missing new to BlockchainClient initialization 2019-12-13 17:39:02 -05:00
Iuri Matias bd0da80625 bugfix(@embark/geth): add missing new to BlockchainClient initialization 2019-12-13 17:39:02 -05:00