Commit Graph

121 Commits

Author SHA1 Message Date
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
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
EmbarkBot d4136ffa8a chore(prerelease): 5.1.2-nightly.0 2020-02-05 00:12:23 +00: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
EmbarkBot 6b502e14d8 chore(prerelease): 5.1.1-nightly.4 2020-02-03 00:13:02 +00:00
EmbarkBot a9807b77f5 chore(prerelease): 5.1.1-nightly.2 2020-01-31 00:12:28 +00:00
EmbarkBot a5c7527d68 chore(prerelease): 5.1.1-nightly.1 2020-01-30 00:12:57 +00:00
Jonathan Rainville 2f5c16b8cd fix(@embark/contracts): fix ENS contracts not being resolved as deps
This was caused by the fact that we add the ENS contract to the
manager when before they deploy, but the dependency resolution was
done while building the contracts, so even before.
So the solution was to add a "before build" action so that the ENS
module could add its contracts to the manager if needed.
2020-01-29 10:15:48 -05:00
EmbarkBot 03ca790ffd chore(prerelease): 5.1.1-nightly.0 2020-01-29 00:12:23 +00:00
Iuri Matias d328b9953a chore: update site urls 2020-01-28 12:07:17 -05:00
Pascal Precht f5db7fe88d chore(stack/communication): update module dependencies 2020-01-28 11:36:24 -05:00
Michael Bradley, Jr 0d1da2971c chore(release): 5.1.0 2020-01-27 12:33:50 -06:00
Jonathan Rainville 0a4d13f64c fix(@embark/pipeline): make generateAll async so it completes tasks
generateAll was async, but it called the write functions with a sync
loop, so at the end of the function, the files were not written yet.
This is a problem in `embark build` because the process ends after
genrateAll is done, so no artifacts were written
2020-01-27 09:26:25 -05:00
EmbarkBot 84448f8732 chore(prerelease): 5.1.0-nightly.5 2020-01-24 00:10:58 +00:00
EmbarkBot e8b5c7ab89 chore(prerelease): 5.1.0-nightly.4 2020-01-23 00:13:38 +00:00
emizzle 9f7c6828a8 fix(@embark/proxy): Parse `rpcPort` from config as integer
## User reported error
i recently updated to embark 5.0 im having issues connecting to a local node each time i connect to it i get the following output from the embark console

```
Error during proxy setup: Port should be >= 0 and < 65536. Received 754510.. Use '--loglevel debug' for more detailed information.
```

This is what i have under the blockchain.js  file
```
localDev: {
    endpoint: "http://127.0.0.1:7545",
    accounts: [{
      nodeAccounts: true,
    }]
  }
```
### Problem
The port to start the proxy on is incremented by a constant value (using the `+` operator), however the port comes from the config and in the case where it is a string, the `+` operator acts as a string concatentation.

### Fix
Ensure the port from the config is always parsed to a number before attempting to add the constant proxy port offset.
2020-01-22 11:18:16 -05:00
EmbarkBot c98e769d0d chore(prerelease): 5.1.0-nightly.1 2020-01-20 09:57:35 -06:00
Michael Bradley, Jr c093cf88ea feat: support Node.js v12.x and newer
Remove the `<12.0.0` restriction re: Node.js version in the `"engines"`
settings for all the packages in the monorepo that had that restriction.

Add missing `"engines"` settings in `packages/plugins/snark/package.json`.

Adjust the Azure Pipelines config to include builds for Node.js v12.x and
v13.x.

Bump `solc` to `0.4.26` in `dapps/tests/app` and `dapps/tests/contracts`. It
was discovered that older versions suffered a fatal `Maximum call stack size
exceeded` error when run on Windows with Node.js v12.x or newer. Display a
warning re: the bad combo (solc version + Windows + Node version) if it's
detected at runtime.

Adjust the root `yarn.lock` so that the `sha3` transitive dependency resolves
to a newer version that is compatible with Node v13.x.
2020-01-20 08:28:24 -06:00
EmbarkBot 4d44e29b3c chore(prerelease): 5.1.0-nightly.0 2020-01-17 00:15:31 +00:00
Iuri Matias 9aeddaa998 chore: rename org references from embark-framework to embarklabs 2020-01-16 15:36:29 -05:00
Iuri Matias 8691716346 bugfix(@embark/embarkjs): tolerate a embarkjs plugin missing 2020-01-16 11:54:53 -05:00
Jonathan Rainville 42bd3b7792 fix(@embark/ens): fix Infura connection and testnet use of ENS
Fixes the use of Infura to connect to the ENS contracts. When
connecting directly to Infura, it would throw with `rejected due to
project ID settings`, because it doesn't accept the VM as the domain
Instead, when passing from the proxy, it works. So I changed the
default when no dappConnection to ['$EMBARK']. I also added a
message when the error happens to help users fix it themselves

When in the testnet, we don,t register because we already have the
addresses, which is fine, but we also didn't populate the ensConfig
object which contains the important information about the addresses
and ABI.

There was a lot of lint problems in a couple of files so I cleaned
that up
2020-01-16 11:45:14 -05:00
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
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
Michael Bradley, Jr ba0d6d17f3 chore(release): 5.0.0 2020-01-07 12:14:37 -06: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 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
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
Iuri Matias 472efbbf6e chore(release): 5.0.0-alpha.9 2019-12-20 18:13:47 -05: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
Iuri Matias 5893bc38b9 chore(release): 5.0.0-alpha.6 2019-12-17 15:41:00 -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
Iuri Matias 78a06c9d76 chore(release): 5.0.0-alpha.5 2019-12-16 13:49:41 -05:00
Michael Bradley, Jr ee56f37713 build: implement collective typecheck
This PR replaces #2057.

Implement a collective typecheck action that can be invoked in the root of the
monorepo with `yarn typecheck` or in watch-mode with `yarn watch:typecheck`.
Include the watch-mode typecheck action as part of `yarn start` (a.k.a
`yarn watch`).

To activate collective typecheck for a package in the monorepo, its
`package.json` file should specify:

```
{
  "embark-collective": {
    "typecheck": true
  }
}
```
*-or-*
```
{
  "embark-collective": {
    "typecheck": {...}
  }
}
```

Where `{...}` above is a `tsconfig.json` fragment that will be merged into the
config generated for the package according the same rules that `tsc` applies
when merging [configs][config].

When collective typecheck begins, it generates a `tsconfig.json` for the root
of the monorepo and for each package that is activated for the action. If the
generated JSON is different than what's on disk for the respective root/package
config, or if the config is not present on disk, then it will be
written. Changes to generated `tsconfig.json` files should be committed; such
changes will arise when there are structural changes to the monorepo, e.g. a
package is added, removed, moved and/or the directory containing it is
renamed. Since the configs are only generated at the beginning of collective
typecheck, when structural changes are made in the monorepo `yarn typecheck`
(or `yarn start` or `yarn watch:typecheck`) should be restarted.

Nearly all of the packages in the monorepo (i.e. all those for which it makes
sense) have been activated for collective typecheck. Even those packages that
don't contain `.ts` sources are activated because `tsc` can make better sense
of the code base as a whole owing to the project references included in the
generated `tsconfig.json` files. Also, owing to the fully cross-referenced
`tsconfig.json` files, it's possible for `tsc` to type check the whole code
base without babel (`yarn build` or `yarn watch:build`) having been run
beforehand.

**NOTE** that a *"cold typecheck"* of the whole monorepo is resource intensive:
on this author's 2019 MacBook Pro it takes around three minutes, the fans spin
up, and `tsc` uses nearly 0.5 GB of RAM. However, once a full typecheck has
completed, the next full typecheck will complete in a few seconds or less; and
when running in watch-mode there is likewise a *big* speedup once a full
typecheck has completed, whether that full check happened before it's running
in watch-mode or when watch-mode itself resulted in a full check before
switching automatically to incremental check, as well a corresponding *big*
reduction in resource consumption. A full check will be needed any time
`yarn typecheck` (or `yarn start` or `yarn watch:typecheck`) is run in a fresh
clone plus `yarn install`, or after doing `yarn reboot[:full]` or `yarn reset`.

The combination of options in each generated package-level `tsconfig.json` and
the root `tsconfig.base.json` result in `tsc` writing `.d.ts` files (TypeScript
declaration files) into the `dist/` directory of each package. That
output is intended to live side-by-side with babel's output, and therefore the
`"rootDir"` option in each generated config is set to `"./src"`.

In projects activated for collective typecheck, `.js` may be converted to `.ts`
and/or `.ts` sources may be added without any additional changes needed in
package-level `package.json`.

---

Reorganize types in `packages/core/typings` (a.k.a `@types/embark`) into
`packages/core/core` (`embark-core`), refactor other packages' imports
accordingly, and delete `packages/core/typings` from the monorepo. This results
in some similarly named but incompatible types exported from `embark-core`
(e.g. `Events` and `EmbarkEvents`, the latter being the one from
`packages/core/typings`); future refactoring should consolidate those types. To
avoid circular dependency relationships it's also necessary to split out
`Engine` from `embark-core` into its own package (`embark-engine`) and to
introduce a bit of duplication, e.g. the `Maybe` type that's now defined in
both `embark-i18n` and `embark-core`.

In the process of the types reorg, move many dependencies spec'd in various
`package.json` to the `package.json` of the package/s that actually depend on
them, e.g. many are moved from `packages/embark/package.json` to
`packages/core/engine/package.json`. Related to those moves, fix some Node.js
`require`-logic related to bug-prone dependency resolution.

Fix all type errors that appeared as a result of activating collective
typecheck across the whole monorepo.

Reactivate `tslint` in `packages/core/core` and fix the remaining linter errors.

Tidy up and add a few items in the root `package.json` scripts.

Bump lerna from `3.16.4` to `3.19.0`.

Bumpt typescript from `3.6.3` to `3.7.2`.

Bumpt tslint from `5.16.0` to `5.20.1`.

Make various changes related to packages' `import`/`require`ing packages that
weren't spec'd in their respective `package.json`. More refactoring is needed
in this regard, but changes were made as the problems were observed in the
process of authoring this PR.

[config]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
2019-12-13 13:59:47 -05:00
Jonathan Rainville 0503bb24a3 fix: fix node connection test to use the endpoints correctly
This caused issues to connect to Infura for example, because we did
not support HTTPS at all, nor WSS
2019-12-13 10:38:53 -05:00
Iuri Matias c00511a0e2 chore(release): 5.0.0-alpha.4 2019-12-12 11:38:22 -05:00
Michael Bradley, Jr 9f2a5949c2 build: specify missing test action in relevant package.json "qa" scripts
It's a relevant `package.json` if the package has a test suite. If `test` isn't
specified then the tests won't run in CI (they have't been running).

Include a fix for one failing test in `packages/plugins/ens` and two failing
test in `packages/stack/deployment`. In all three cases, the mock embark
object's config needed a `blockchainConfig` section with `{ enabled: true }`.
2019-12-11 14:01:12 -06:00
emizzle acd1d72f2d fix(@embark/tests): Tests exiting early
Tests were exiting early and Mocha was reporting an exit code of 0. This allowed CI to complete as if the tests were successful.

Change `compiler:contracts` event request to `compiler:contracts:compile` and update documentation. Because the `compiler:contracts` event didn’t exist, this test was silently failing.

Update the `TestEvents` mock object to allow passing of parameters to an event that is not a callback.

Add unit tests to test for contracts loaded via node_modules.

1. This PR contains a change where any contracts loaded from node_modules will be imported in to `.embark/contracts/node_modules`. Previously, these contracts were loaded in to `.embark/node_modules` (with the `/contracts`).
2019-12-11 11:27:45 -05:00
emizzle 8e0f8b44d1 fix(@embark/debugger): Re-enable debugger
Re-enable debugger for cockpit and console.

Add missing request `blockchain:getTransaction` required to start a debugging session.

Fix error in console when stopping a debug session.
2019-12-11 11:12:52 -05:00
Pascal Precht 446197baff fix(@embark/blockchain): make disabling blockchain feature work
Users can turn of blockchain support if they want to using the blockchain.js
configuration. In practice however, this has never properly worked as several
places in Embark's codebase weren't actually honoring that configuration value.

This commit introduces the necessary changes so that disabling blockchain support will:

No longer generate blockchain related EmbarkJS artifacts
No longer try to deploy Smart Contracts but still compile them
2019-12-11 11:08:13 -05:00
Jonathan Rainville b82a240933 fix(@embark/test): fix using --node option in tests 2019-12-11 11:05:12 -05:00